X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FrunJobs.php;h=40605cebaed736cc0df12a56452eb4f782033d30;hb=a586c22aeb19d3244a7ac17ff665db380071e27b;hp=3e6fa52c8c35cd824ab5a14fbb40d26fb8a41381;hpb=825f0701d8096bbc926ec6c2d0027f0100a398e9;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/runJobs.php b/maintenance/runJobs.php index 3e6fa52c8c..40605cebae 100644 --- a/maintenance/runJobs.php +++ b/maintenance/runJobs.php @@ -37,6 +37,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 ); } public function memoryLimit() { @@ -65,14 +66,21 @@ class RunJobs extends Maintenance { } } + $json = ( $this->getOption( 'result' ) === 'json' ); + $runner = new JobRunner(); - $runner->setDebugHandler( array( $this, 'debugInternal' ) ); - $runner->run( array( + if ( !$json ) { + $runner->setDebugHandler( array( $this, 'debugInternal' ) ); + } + $response = $runner->run( array( 'type' => $this->getOption( 'type', false ), 'maxJobs' => $this->getOption( 'maxjobs', false ), 'maxTime' => $this->getOption( 'maxtime', false ), 'throttle' => $this->hasOption( 'nothrottle' ) ? false : true, ) ); + if ( $json ) { + $this->output( FormatJson::encode( $response, true ) ); + } } /**