Merge "Fix flaky test BlockListPagerTest::testFormatValue"
[lhc/web/wiklou.git] / maintenance / runJobs.php
index af2a318..802a114 100644 (file)
@@ -59,7 +59,7 @@ class RunJobs extends Maintenance {
                if ( $this->hasOption( 'procs' ) ) {
                        $procs = intval( $this->getOption( 'procs' ) );
                        if ( $procs < 1 || $procs > 1000 ) {
-                               $this->error( "Invalid argument to --procs", true );
+                               $this->fatalError( "Invalid argument to --procs" );
                        } elseif ( $procs != 1 ) {
                                $fc = new ForkController( $procs );
                                if ( $fc->start() != 'child' ) {
@@ -99,6 +99,10 @@ class RunJobs extends Maintenance {
                                $response['reached'] === 'job-limit' ||
                                $response['reached'] === 'memory-limit'
                        ) {
+                               // If job queue is empty, output it
+                               if ( !$outputJSON && $response['jobs'] === [] ) {
+                                       $this->output( "Job queue is empty.\n" );
+                               }
                                break;
                        }
 
@@ -118,5 +122,5 @@ class RunJobs extends Maintenance {
        }
 }
 
-$maintClass = "RunJobs";
+$maintClass = RunJobs::class;
 require_once RUN_MAINTENANCE_IF_MAIN;