Move legacy backgroundjob classes to a place where they can be autoloaded
This commit is contained in:
parent
b31dc10c3c
commit
b7585050b5
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Copyright (c) 2013 Robin Appelman <icewind@owncloud.com>
|
||||||
|
* This file is licensed under the Affero General Public License version 3 or
|
||||||
|
* later.
|
||||||
|
* See the COPYING-README file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace OC\BackgroundJob\Legacy;
|
||||||
|
|
||||||
|
class QueuedJob extends \OC\BackgroundJob\QueuedJob {
|
||||||
|
public function run($argument) {
|
||||||
|
$class = $argument['klass'];
|
||||||
|
$method = $argument['method'];
|
||||||
|
$parameters = $argument['parameters'];
|
||||||
|
call_user_func(array($class, $method), $parameters);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Copyright (c) 2013 Robin Appelman <icewind@owncloud.com>
|
||||||
|
* This file is licensed under the Affero General Public License version 3 or
|
||||||
|
* later.
|
||||||
|
* See the COPYING-README file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace OC\BackgroundJob\Legacy;
|
||||||
|
|
||||||
|
class RegularJob extends \OC\BackgroundJob\Job {
|
||||||
|
public function run($argument) {
|
||||||
|
call_user_func($argument);
|
||||||
|
}
|
||||||
|
}
|
|
@ -21,7 +21,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Public interface of ownCloud forbackground jobs.
|
* Public interface of ownCloud for background jobs.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// use OCP namespace for all classes that are considered public.
|
// use OCP namespace for all classes that are considered public.
|
||||||
|
@ -83,7 +83,7 @@ class BackgroundJob {
|
||||||
* @return true
|
* @return true
|
||||||
*/
|
*/
|
||||||
public static function addRegularTask($klass, $method) {
|
public static function addRegularTask($klass, $method) {
|
||||||
self::registerJob('RegularLegacyJob', array($klass, $method));
|
self::registerJob('OC\BackgroundJob\Legacy\RegularJob', array($klass, $method));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,7 +169,7 @@ class BackgroundJob {
|
||||||
* @return int id of task
|
* @return int id of task
|
||||||
*/
|
*/
|
||||||
public static function addQueuedTask($app, $class, $method, $parameters) {
|
public static function addQueuedTask($app, $class, $method, $parameters) {
|
||||||
self::registerJob('QueuedLegacyJob', array('app' => $app, 'klass' => $class, 'method' => $method, 'parameters' => $parameters));
|
self::registerJob('OC\BackgroundJob\Legacy\QueuedJob', array('app' => $app, 'klass' => $class, 'method' => $method, 'parameters' => $parameters));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,21 +189,3 @@ class BackgroundJob {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Wrappers to support old versions of the BackgroundJob api
|
|
||||||
*/
|
|
||||||
class RegularLegacyJob extends \OC\BackgroundJob\Job {
|
|
||||||
public function run($argument) {
|
|
||||||
call_user_func($argument);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class QueuedLegacyJob extends \OC\BackgroundJob\QueuedJob {
|
|
||||||
public function run($argument) {
|
|
||||||
$class = $argument['klass'];
|
|
||||||
$method = $argument['method'];
|
|
||||||
$parameters = $argument['parameters'];
|
|
||||||
call_user_func(array($class, $method), $parameters);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue