jobFromName($jobName); if (!$job) throw new SimpleException('Unknown job: ' . $jobName); if (isset($_FILES['args'])) { foreach (array_keys($_FILES['args']['name']) as $key) { $jobArgs[$key] = new ApiFileInput( $_FILES['args']['tmp_name'][$key], $_FILES['args']['name'][$key]); } } $context->transport->status = Api::run($job, $jobArgs); } catch (Exception $e) { Messenger::fail($e->getMessage()); } $this->renderAjax(); } private function jobFromName($jobName) { $jobClassNames = Api::getAllJobClassNames(); foreach ($jobClassNames as $className) { $job = (new ReflectionClass($className))->newInstance(); if ($job->getName() == $jobName) return $job; $job = null; } return null; } }