Rename Backgroundjobs to BackgroundJob
This commit is contained in:
parent
4f90860001
commit
6025d2ebc3
|
@ -23,7 +23,7 @@
|
||||||
/**
|
/**
|
||||||
* This class manages the regular tasks.
|
* This class manages the regular tasks.
|
||||||
*/
|
*/
|
||||||
class OC_Backgroundjobs_RegularTask{
|
class OC_BackgroundJob_RegularTask{
|
||||||
static private $registered = array();
|
static private $registered = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -32,7 +32,7 @@ class OC_Backgroundjobs_RegularTask{
|
||||||
* @param $method method name
|
* @param $method method name
|
||||||
* @return true
|
* @return true
|
||||||
*/
|
*/
|
||||||
static public function create( $klass, $method ){
|
static public function register( $klass, $method ){
|
||||||
// Create the data structure
|
// Create the data structure
|
||||||
self::$registered["$klass-$method"] = array( $klass, $method );
|
self::$registered["$klass-$method"] = array( $klass, $method );
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ownCloud - Background Job
|
* ownCloud - Background Job
|
||||||
*
|
*
|
||||||
|
@ -24,7 +23,7 @@
|
||||||
/**
|
/**
|
||||||
* This class manages our scheduled tasks.
|
* This class manages our scheduled tasks.
|
||||||
*/
|
*/
|
||||||
class OC_Backgroundjobs_ScheduledTask{
|
class OC_BackgroundJob_ScheduledTask{
|
||||||
/**
|
/**
|
||||||
* @brief Gets one scheduled task
|
* @brief Gets one scheduled task
|
||||||
* @param $id ID of the task
|
* @param $id ID of the task
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
*
|
*
|
||||||
* TODO: locking in doAllSteps
|
* TODO: locking in doAllSteps
|
||||||
*/
|
*/
|
||||||
class OC_Backgroundjobs_Worker{
|
class OC_BackgroundJob_Worker{
|
||||||
/**
|
/**
|
||||||
* @brief executes all tasks
|
* @brief executes all tasks
|
||||||
* @return boolean
|
* @return boolean
|
||||||
|
@ -36,16 +36,16 @@ class OC_Backgroundjobs_Worker{
|
||||||
*/
|
*/
|
||||||
public static function doAllSteps(){
|
public static function doAllSteps(){
|
||||||
// Do our regular work
|
// Do our regular work
|
||||||
$regular_tasks = OC_Backgroundjobs_RegularTask::all();
|
$regular_tasks = OC_BackgroundJob_RegularTask::all();
|
||||||
foreach( $regular_tasks as $key => $value ){
|
foreach( $regular_tasks as $key => $value ){
|
||||||
call_user_func( $value );
|
call_user_func( $value );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do our scheduled tasks
|
// Do our scheduled tasks
|
||||||
$scheduled_tasks = OC_Backgroundjobs_ScheduledTask::all();
|
$scheduled_tasks = OC_BackgroundJob_ScheduledTask::all();
|
||||||
foreach( $scheduled_tasks as $task ){
|
foreach( $scheduled_tasks as $task ){
|
||||||
call_user_func( array( $task['klass'], $task['method'] ), $task['parameters'] );
|
call_user_func( array( $task['klass'], $task['method'] ), $task['parameters'] );
|
||||||
OC_Backgroundjobs_ScheduledTask::delete( $task['id'] );
|
OC_BackgroundJob_ScheduledTask::delete( $task['id'] );
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -67,7 +67,7 @@ class OC_Backgroundjobs_Worker{
|
||||||
$lasttask = OC_Appconfig::getValue( 'core', 'backgroundjobs_task', '' );
|
$lasttask = OC_Appconfig::getValue( 'core', 'backgroundjobs_task', '' );
|
||||||
|
|
||||||
// What's the next step?
|
// What's the next step?
|
||||||
$regular_tasks = OC_Backgroundjobs_RegularTask::all();
|
$regular_tasks = OC_BackgroundJob_RegularTask::all();
|
||||||
ksort( $regular_tasks );
|
ksort( $regular_tasks );
|
||||||
$done = false;
|
$done = false;
|
||||||
|
|
||||||
|
@ -87,12 +87,12 @@ class OC_Backgroundjobs_Worker{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$tasks = OC_Backgroundjobs_ScheduledTask::all();
|
$tasks = OC_BackgroundJob_ScheduledTask::all();
|
||||||
if( length( $tasks )){
|
if( length( $tasks )){
|
||||||
$task = $tasks[0];
|
$task = $tasks[0];
|
||||||
// delete job before we execute it. This prevents endless loops
|
// delete job before we execute it. This prevents endless loops
|
||||||
// of failing jobs.
|
// of failing jobs.
|
||||||
OC_Backgroundjobs_ScheduledTask::delete($task['id']);
|
OC_BackgroundJob_ScheduledTask::delete($task['id']);
|
||||||
|
|
||||||
// execute job
|
// execute job
|
||||||
call_user_func( array( $task['klass'], $task['method'] ), $task['parameters'] );
|
call_user_func( array( $task['klass'], $task['method'] ), $task['parameters'] );
|
||||||
|
|
Loading…
Reference in New Issue