From d7fddb8d59bdcb8ec6bb31572d392fa29a858947 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Thu, 19 Jun 2014 17:12:21 +0200 Subject: [PATCH] Task-Server: vor jedem Job mehr Variablen re-initialisieren MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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. --- scripts/task_server.pl | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) 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; -- 2.20.1