diff options
author | Robin McCorkell <rmccorkell@owncloud.com> | 2015-09-05 16:50:02 +0100 |
---|---|---|
committer | Robin McCorkell <rmccorkell@owncloud.com> | 2015-09-05 16:50:02 +0100 |
commit | 0fac2e3f3aaaeaddf431f7877ebddb6372a00a42 (patch) | |
tree | a940bf4d733550b3829a213abd311de627683917 /lib/private/backgroundjob | |
parent | 895e6337325f4a107aeb834268bbcc0205ecb308 (diff) | |
download | nextcloud-server-0fac2e3f3aaaeaddf431f7877ebddb6372a00a42.tar.gz nextcloud-server-0fac2e3f3aaaeaddf431f7877ebddb6372a00a42.zip |
Unique exception for invalid autoload paths, better handling
Background jobs are tolerant of stale entries left by disabled apps,
which will cause an autoload exception.
Diffstat (limited to 'lib/private/backgroundjob')
-rw-r--r-- | lib/private/backgroundjob/joblist.php | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/lib/private/backgroundjob/joblist.php b/lib/private/backgroundjob/joblist.php index f297bccbc7d..deadadfb77e 100644 --- a/lib/private/backgroundjob/joblist.php +++ b/lib/private/backgroundjob/joblist.php @@ -26,6 +26,7 @@ namespace OC\BackgroundJob; use OCP\BackgroundJob\IJobList; +use OCP\AutoloadNotAllowedException; class JobList implements IJobList { /** @@ -185,15 +186,20 @@ class JobList implements IJobList { /** * @var Job $job */ - if (!class_exists($class)) { - // job from disabled app or old version of an app, no need to do anything - return null; + try { + if (!class_exists($class)) { + // job from disabled app or old version of an app, no need to do anything + return null; + } + $job = new $class(); + $job->setId($row['id']); + $job->setLastRun($row['last_run']); + $job->setArgument(json_decode($row['argument'], true)); + return $job; + } catch (AutoloadNotAllowedException $e) { + // job is from a disabled app, ignore } - $job = new $class(); - $job->setId($row['id']); - $job->setLastRun($row['last_run']); - $job->setArgument(json_decode($row['argument'], true)); - return $job; + return null; } /** |