#!/usr/bin/perl # # bin/worker/resolve-extacct # # Gearman worker for resolving journal type of external accounts. # # Authors: # Jen Griffin # # Copyright (c) 2010-2011 by Dreamwidth Studios, LLC. # # This program is free software; you may redistribute it and/or modify it under # the same terms as Perl itself. For a copy of the license, please reference # 'perldoc perlartistic' or 'perldoc perlgpl'. # use strict; BEGIN { require "$ENV{LJHOME}/cgi-bin/ljlib.pl"; } use LJ::Worker::Gearman; use Storable qw/ thaw /; use DW::External::Userinfo; use DW::External::User; gearman_decl( 'resolve-extacct' => \&worker ); gearman_work(); sub worker { my $job = $_[0]; my %in = %{ thaw( $job->arg ) || {} }; # reconstruct DW::External::User object my $u = DW::External::User->new( user => $in{user}, site => $in{site} ); return unless $u; # the processor is defined in DW::External::Userinfo return DW::External::Userinfo->check_remote( $u, $in{url} ); }