summaryrefslogtreecommitdiffstats
path: root/lib/backgroundjob
diff options
context:
space:
mode:
authorJakob Sack <mail@jakobsack.de>2012-08-09 22:30:11 +0200
committerJakob Sack <mail@jakobsack.de>2012-08-09 22:30:11 +0200
commitf46fdfd814de7a43af94cad1dcf456e65350f254 (patch)
tree76850d9ba74624a9c33f68948bd698dccf350627 /lib/backgroundjob
parent66511469e04fdf17dfc45711ad98518fab94a712 (diff)
downloadnextcloud-server-f46fdfd814de7a43af94cad1dcf456e65350f254.tar.gz
nextcloud-server-f46fdfd814de7a43af94cad1dcf456e65350f254.zip
Backgroundjobs: Add reset counter in worker
Diffstat (limited to 'lib/backgroundjob')
-rw-r--r--lib/backgroundjob/worker.php13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/backgroundjob/worker.php b/lib/backgroundjob/worker.php
index 8a58a76e3a4..b4f0429b319 100644
--- a/lib/backgroundjob/worker.php
+++ b/lib/backgroundjob/worker.php
@@ -36,16 +36,25 @@ class OC_BackgroundJob_Worker{
*/
public static function doAllSteps(){
// Do our regular work
+ $lasttask = OC_Appconfig::getValue( 'core', 'backgroundjobs_task', '' );
+
$regular_tasks = OC_BackgroundJob_RegularTask::all();
+ ksort( $regular_tasks );
foreach( $regular_tasks as $key => $value ){
- call_user_func( $value );
+ if( strcmp( $key, $lasttask ) > 0 ){
+ // Set "restart here" config value
+ OC_Appconfig::setValue( 'core', 'backgroundjobs_task', $key );
+ call_user_func( $value );
+ }
}
+ // Reset "start here" config value
+ OC_Appconfig::setValue( 'core', 'backgroundjobs_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_QueuedTask::delete( $task['id'] );
+ call_user_func( array( $task['klass'], $task['method'] ), $task['parameters'] );
}
return true;