]> source.dussan.org Git - nextcloud-server.git/commitdiff
Check if classes/method exists before trying to call them in background jobs
authorRobin Appelman <icewind@owncloud.com>
Thu, 26 Jun 2014 20:39:40 +0000 (22:39 +0200)
committerRobin Appelman <icewind@owncloud.com>
Thu, 26 Jun 2014 20:40:12 +0000 (22:40 +0200)
lib/private/backgroundjob/joblist.php
lib/private/backgroundjob/legacy/queuedjob.php
lib/private/backgroundjob/legacy/regularjob.php

index 6641097cf9076dc947ca0561e4ef289272eb6f5b..09bba53edb8e783b7fc0ff951fbc39e55f91606c 100644 (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']);
index 2bc001103b8607008d1dbb27a6466555a51880cb..c5705abb467e38d4d90665cd4d1af619b678f41a 100644 (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);
+               }
        }
 }
index d4cfa348ceace0ecd286df18d6d2a2f51bafa592..eb85a30b4bed6e54721dcdbb1cc66be75680abf6 100644 (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);
+               }
        }
 }