From 59c8afd6f264246c0e5819ac02da0dd0bb10ee4d Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Mon, 22 Jul 2019 11:36:59 +0200 Subject: [PATCH] =?utf8?q?Hintergrundjobs:=20einmalige=20Jobausf=C3=BChrun?= =?utf8?q?g:=20Daten=20=C3=BCbergeben=20k=C3=B6nnen?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Entweder, man übergibt `data` als Parameter in URI-Hash-Form (z.B. '&data.var=value'), als normaler YAML-encodierter String, so wie er auch in der Datenbank steht (z.B. '&data=---%0Avar%3Dvalue'), oder man übergibt JSON-encodierte Daten in `json_data` (z.B. '&json_data=%7B%22var%22%3A%22value%22%7D`). --- SL/Controller/BackgroundJob.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/SL/Controller/BackgroundJob.pm b/SL/Controller/BackgroundJob.pm index e97b36970..27a1c69a6 100644 --- a/SL/Controller/BackgroundJob.pm +++ b/SL/Controller/BackgroundJob.pm @@ -131,7 +131,9 @@ sub action_execute_class { my $package = "SL::BackgroundJob::" . $::form->{class}; eval "require $package" or die $@; - $result = $package->new->run(SL::DB::BackgroundJob->new); + my $job = SL::DB::BackgroundJob->new(data => $::form->{data}); + $job->data(decode_json($::form->{json_data})) if $::form->{json_data}; + $result = $package->new->run($job); 1; }; -- 2.20.1