diff options
author | Robin Appelman <icewind@owncloud.com> | 2013-04-20 23:27:46 +0200 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2013-04-20 23:27:46 +0200 |
commit | 7948341a86fb08d236bb53f8aece809ae10ba5f2 (patch) | |
tree | 61bf8cc11b2212953f5f87216d33a7744869385f /lib/public/backgroundjob.php | |
parent | d0a5fe1f4a39f21c596293232be19d70ad30652e (diff) | |
download | nextcloud-server-7948341a86fb08d236bb53f8aece809ae10ba5f2.tar.gz nextcloud-server-7948341a86fb08d236bb53f8aece809ae10ba5f2.zip |
Rework background job system
Diffstat (limited to 'lib/public/backgroundjob.php')
-rw-r--r-- | lib/public/backgroundjob.php | 71 |
1 files changed, 6 insertions, 65 deletions
diff --git a/lib/public/backgroundjob.php b/lib/public/backgroundjob.php index 601046fe691..785a9408aa5 100644 --- a/lib/public/backgroundjob.php +++ b/lib/public/backgroundjob.php @@ -59,7 +59,7 @@ class BackgroundJob { /** * @brief sets the background jobs execution type - * @param $type execution type + * @param string $type execution type * @return boolean * * This method sets the execution type of the background jobs. Possible types @@ -70,71 +70,12 @@ class BackgroundJob { } /** - * @brief creates a regular task - * @param $klass class name - * @param $method method name - * @return true + * @param \OC\BackgroundJob\Job|string $job + * @param mixed $argument */ - public static function addRegularTask( $klass, $method ) { - return \OC_BackgroundJob_RegularTask::register( $klass, $method ); + public static function registerJob($job, $argument = null){ + $jobList = new \OC\BackgroundJob\JobList(); + $jobList->add($job, $argument); } - /** - * @brief gets all regular tasks - * @return associative array - * - * key is string "$klass-$method", value is array( $klass, $method ) - */ - static public function allRegularTasks() { - return \OC_BackgroundJob_RegularTask::all(); - } - - /** - * @brief Gets one queued task - * @param $id ID of the task - * @return associative array - */ - public static function findQueuedTask( $id ) { - return \OC_BackgroundJob_QueuedTask::find( $id ); - } - - /** - * @brief Gets all queued tasks - * @return array with associative arrays - */ - public static function allQueuedTasks() { - return \OC_BackgroundJob_QueuedTask::all(); - } - - /** - * @brief Gets all queued tasks of a specific app - * @param $app app name - * @return array with associative arrays - */ - public static function queuedTaskWhereAppIs( $app ) { - return \OC_BackgroundJob_QueuedTask::whereAppIs( $app ); - } - - /** - * @brief queues a task - * @param $app app name - * @param $klass class name - * @param $method method name - * @param $parameters all useful data as text - * @return id of task - */ - public static function addQueuedTask( $app, $klass, $method, $parameters ) { - return \OC_BackgroundJob_QueuedTask::add( $app, $klass, $method, $parameters ); - } - - /** - * @brief deletes a queued task - * @param $id id of task - * @return true/false - * - * Deletes a report - */ - public static function deleteQueuedTask( $id ) { - return \OC_BackgroundJob_QueuedTask::delete( $id ); - } } |