Merge "Cleanup to ImagePage::openShowImage()"
[lhc/web/wiklou.git] / maintenance / runJobs.php
index 80a2278..8d2819d 100644 (file)
@@ -53,6 +53,10 @@ class RunJobs extends Maintenance {
        public function execute() {
                global $wgTitle;
 
+               if ( wfReadOnly() ) {
+                       $this->error( "Unable to run jobs; the wiki is in read-only mode.", 1 ); // die
+               }
+
                if ( $this->hasOption( 'procs' ) ) {
                        $procs = intval( $this->getOption( 'procs' ) );
                        if ( $procs < 1 || $procs > 1000 ) {
@@ -74,7 +78,7 @@ class RunJobs extends Maintenance {
                $group = JobQueueGroup::singleton();
                do {
                        $job = ( $type === false )
-                               ? $group->pop() // job from any queue
+                               ? $group->pop( JobQueueGroup::TYPE_DEFAULT, JobQueueGroup::USE_CACHE )
                                : $group->get( $type )->pop(); // job from a single queue
                        if ( $job ) { // found a job
                                // Perform the job (logging success/failure and runtime)...
@@ -91,10 +95,10 @@ class RunJobs extends Maintenance {
                                }
                                // Break out if we hit the job count or wall time limits...
                                if ( $maxJobs && ++$n >= $maxJobs ) {
-                                       break 2;
+                                       break;
                                }
                                if ( $maxTime && ( time() - $startTime ) > $maxTime ) {
-                                       break 2;
+                                       break;
                                }
                                // Don't let any slaves/backups fall behind...
                                $group->get( $type )->waitForBackups();