Browse Source

Merge pull request #9241 from owncloud/backgroundjob-check

Check if classes/method exists before trying to call them in background jobs
tags/v7.0.0RC1
icewind1991 10 years ago
parent
commit
58c03f5e85

+ 4
- 0
lib/private/backgroundjob/joblist.php View File

@@ -152,6 +152,10 @@ class JobList implements IJobList {
if ($class === 'OC_Cache_FileGlobalGC') {
$class = '\OC\Cache\FileGlobalGC';
}
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']);

+ 3
- 1
lib/private/backgroundjob/legacy/queuedjob.php View File

@@ -13,6 +13,8 @@ class QueuedJob extends \OC\BackgroundJob\QueuedJob {
$class = $argument['klass'];
$method = $argument['method'];
$parameters = $argument['parameters'];
call_user_func(array($class, $method), $parameters);
if (is_callable(array($class, $method))) {
call_user_func(array($class, $method), $parameters);
}
}
}

+ 3
- 1
lib/private/backgroundjob/legacy/regularjob.php View File

@@ -10,6 +10,8 @@ namespace OC\BackgroundJob\Legacy;

class RegularJob extends \OC\BackgroundJob\Job {
public function run($argument) {
call_user_func($argument);
if (is_callable($argument)) {
call_user_func($argument);
}
}
}

Loading…
Cancel
Save