summaryrefslogtreecommitdiffstats
path: root/lib/backgroundjob
diff options
context:
space:
mode:
authorJakob Sack <mail@jakobsack.de>2012-08-09 19:04:04 +0200
committerJakob Sack <mail@jakobsack.de>2012-08-09 19:04:04 +0200
commitceda0ae0525d66417b4cf8e39e8cedbcbd5f6258 (patch)
treee77d9ad120668d38750daa69889c01152e9e8d7a /lib/backgroundjob
parent1ce2cd73ffd9c76912f8ba03809a5b347cec38a9 (diff)
downloadnextcloud-server-ceda0ae0525d66417b4cf8e39e8cedbcbd5f6258.tar.gz
nextcloud-server-ceda0ae0525d66417b4cf8e39e8cedbcbd5f6258.zip
Backgroundjobs: rename ScheduledTask to QueuedTask
Diffstat (limited to 'lib/backgroundjob')
-rw-r--r--lib/backgroundjob/scheduledtask.php25
-rw-r--r--lib/backgroundjob/worker.php20
2 files changed, 22 insertions, 23 deletions
diff --git a/lib/backgroundjob/scheduledtask.php b/lib/backgroundjob/scheduledtask.php
index 47f332a204a..da5d4ddc694 100644
--- a/lib/backgroundjob/scheduledtask.php
+++ b/lib/backgroundjob/scheduledtask.php
@@ -21,22 +21,22 @@
*/
/**
- * This class manages our scheduled tasks.
+ * This class manages our queued tasks.
*/
-class OC_BackgroundJob_ScheduledTask{
+class OC_BackgroundJob_QueuedTask{
/**
- * @brief Gets one scheduled task
+ * @brief Gets one queued task
* @param $id ID of the task
* @return associative array
*/
public static function find( $id ){
- $stmt = OC_DB::prepare( 'SELECT * FROM *PREFIX*scheduledtasks WHERE id = ?' );
+ $stmt = OC_DB::prepare( 'SELECT * FROM *PREFIX*queuedtasks WHERE id = ?' );
$result = $stmt->execute(array($id));
return $result->fetchRow();
}
/**
- * @brief Gets all scheduled tasks
+ * @brief Gets all queued tasks
* @return array with associative arrays
*/
public static function all(){
@@ -44,18 +44,17 @@ class OC_BackgroundJob_ScheduledTask{
$return = array();
// Get Data
- $stmt = OC_DB::prepare( 'SELECT * FROM *PREFIX*scheduledtasks' );
+ $stmt = OC_DB::prepare( 'SELECT * FROM *PREFIX*queuedtasks' );
$result = $stmt->execute(array());
while( $row = $result->fetchRow()){
$return[] = $row;
}
- // Und weg damit
return $return;
}
/**
- * @brief Gets all scheduled tasks of a specific app
+ * @brief Gets all queued tasks of a specific app
* @param $app app name
* @return array with associative arrays
*/
@@ -64,7 +63,7 @@ class OC_BackgroundJob_ScheduledTask{
$return = array();
// Get Data
- $stmt = OC_DB::prepare( 'SELECT * FROM *PREFIX*scheduledtasks WHERE app = ?' );
+ $stmt = OC_DB::prepare( 'SELECT * FROM *PREFIX*queuedtasks WHERE app = ?' );
$result = $stmt->execute(array($app));
while( $row = $result->fetchRow()){
$return[] = $row;
@@ -75,7 +74,7 @@ class OC_BackgroundJob_ScheduledTask{
}
/**
- * @brief schedules a task
+ * @brief queues a task
* @param $app app name
* @param $klass class name
* @param $method method name
@@ -83,21 +82,21 @@ class OC_BackgroundJob_ScheduledTask{
* @return id of task
*/
public static function add( $task, $klass, $method, $parameters ){
- $stmt = OC_DB::prepare( 'INSERT INTO *PREFIX*scheduledtasks (app, klass, method, parameters) VALUES(?,?,?,?)' );
+ $stmt = OC_DB::prepare( 'INSERT INTO *PREFIX*queuedtasks (app, klass, method, parameters) VALUES(?,?,?,?)' );
$result = $stmt->execute(array($app, $klass, $method, $parameters, time));
return OC_DB::insertid();
}
/**
- * @brief deletes a scheduled task
+ * @brief deletes a queued task
* @param $id id of task
* @return true/false
*
* Deletes a report
*/
public static function delete( $id ){
- $stmt = OC_DB::prepare( 'DELETE FROM *PREFIX*scheduledtasks WHERE id = ?' );
+ $stmt = OC_DB::prepare( 'DELETE FROM *PREFIX*queuedtasks WHERE id = ?' );
$result = $stmt->execute(array($id));
return true;
diff --git a/lib/backgroundjob/worker.php b/lib/backgroundjob/worker.php
index 799fa5306c6..0acbb9d3217 100644
--- a/lib/backgroundjob/worker.php
+++ b/lib/backgroundjob/worker.php
@@ -30,7 +30,7 @@ class OC_BackgroundJob_Worker{
* @brief executes all tasks
* @return boolean
*
- * This method executes all regular tasks and then all scheduled tasks.
+ * This method executes all regular tasks and then all queued tasks.
* This method should be called by cli scripts that do not let the user
* wait.
*/
@@ -41,11 +41,11 @@ class OC_BackgroundJob_Worker{
call_user_func( $value );
}
- // Do our scheduled tasks
- $scheduled_tasks = OC_BackgroundJob_ScheduledTask::all();
- foreach( $scheduled_tasks as $task ){
+ // Do our queued tasks
+ $queued_tasks = OC_BackgroundJob_QueuedTask::all();
+ foreach( $queued_tasks as $task ){
call_user_func( array( $task['klass'], $task['method'] ), $task['parameters'] );
- OC_BackgroundJob_ScheduledTask::delete( $task['id'] );
+ OC_BackgroundJob_QueuedTask::delete( $task['id'] );
}
return true;
@@ -82,23 +82,23 @@ class OC_BackgroundJob_Worker{
}
if( $done == false ){
- // Next time load scheduled tasks
- OC_Appconfig::setValue( 'core', 'backgroundjobs_step', 'scheduled_tasks' );
+ // Next time load queued tasks
+ OC_Appconfig::setValue( 'core', 'backgroundjobs_step', 'queued_tasks' );
}
}
else{
- $tasks = OC_BackgroundJob_ScheduledTask::all();
+ $tasks = OC_BackgroundJob_QueuedTask::all();
if( count( $tasks )){
$task = $tasks[0];
// delete job before we execute it. This prevents endless loops
// of failing jobs.
- OC_BackgroundJob_ScheduledTask::delete($task['id']);
+ OC_BackgroundJob_QueuedTask::delete($task['id']);
// execute job
call_user_func( array( $task['klass'], $task['method'] ), $task['parameters'] );
}
else{
- // Next time load scheduled tasks
+ // Next time load queued tasks
OC_Appconfig::setValue( 'core', 'backgroundjobs_step', 'regular_tasks' );
OC_Appconfig::setValue( 'core', 'backgroundjobs_task', '' );
}