From: Moritz Bunkus Date: Thu, 19 Jun 2014 15:12:21 +0000 (+0200) Subject: Task-Server: vor jedem Job mehr Variablen re-initialisieren X-Git-Tag: release-3.2.0beta~411^2~45 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=d7fddb8d59bdcb8ec6bb31572d392fa29a858947;p=kivitendo-erp.git Task-Server: vor jedem Job mehr Variablen re-initialisieren Besonders wichtig: $::request, da sie zum Cachen genutzt wird und die Garantie vom Cache ist, dass er nach jedem »Request« (beim Task-Server: nach jedem Job) geleert wird. --- diff --git a/scripts/task_server.pl b/scripts/task_server.pl index cb332ec07..f3422d62d 100755 --- a/scripts/task_server.pl +++ b/scripts/task_server.pl @@ -75,6 +75,21 @@ sub lxinit { die "cannot find locale for user $login" unless $::locale = Locale->new('de'); } +sub per_job_initialization { + $::locale = Locale->new($::lx_office_conf{system}->{language}); + $::form = Form->new; + $::instance_conf = SL::InstanceConfiguration->new; + $::request = SL::Request->new( + cgi => CGI->new({}), + layout => SL::Layout::None->new, + ); + + $::auth->restore_session; + + $::form->{login} = $lx_office_conf{task_server}->{login}; + $::instance_conf->init; +} + sub drop_privileges { my $user = $lx_office_conf{task_server}->{run_as}; return unless $user; @@ -174,8 +189,7 @@ sub gd_run { foreach my $job (@{ $jobs }) { # Provide fresh global variables in case legacy code modifies # them somehow. - $::locale = Locale->new($::lx_office_conf{system}->{language}); - $::form = Form->new; + per_job_initialization(); chdir $exe_dir;