X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FrunJobs.php;h=51c52be61997bffdfe531e6f3c39ab07b4ef468d;hb=0bf48b72331598fa464886f2bc9ca8259c610175;hp=2e011fecde54b2f356e9fdb1aed7b43f2192a5c8;hpb=e968a1f431ad058dcb14adb2757bde5664b99a79;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/runJobs.php b/maintenance/runJobs.php index 2e011fecde..51c52be619 100644 --- a/maintenance/runJobs.php +++ b/maintenance/runJobs.php @@ -25,6 +25,9 @@ require_once __DIR__ . '/Maintenance.php'; use MediaWiki\Logger\LoggerFactory; +// So extensions (and other code) can check whether they're running in job mode +define( 'MEDIAWIKI_JOB_RUNNER', true ); + /** * Maintenance script that runs pending jobs. * @@ -39,7 +42,7 @@ class RunJobs extends Maintenance { $this->addOption( 'type', 'Type of job to run', false, true ); $this->addOption( 'procs', 'Number of processes to use', false, true ); $this->addOption( 'nothrottle', 'Ignore job throttling configuration', false, false ); - $this->addOption( 'result', 'Set to JSON to print only a JSON response', false, true ); + $this->addOption( 'result', 'Set to "json" to print only a JSON response', false, true ); $this->addOption( 'wait', 'Wait for new jobs instead of exiting', false, false ); } @@ -56,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' ) { @@ -115,5 +118,5 @@ class RunJobs extends Maintenance { } } -$maintClass = "RunJobs"; +$maintClass = RunJobs::class; require_once RUN_MAINTENANCE_IF_MAIN;