X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialRunJobs.php;h=530c5802cf432edea0f77d7e59cfba356f255245;hb=25242105e8fd03c9900250bdf9ea91be9a286625;hp=375694be0836e16ad955bd1a431103a2fee67577;hpb=f428f95ac49e71bde47bc982e31ff60b3ef41706;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialRunJobs.php b/includes/specials/SpecialRunJobs.php index 375694be08..530c5802cf 100644 --- a/includes/specials/SpecialRunJobs.php +++ b/includes/specials/SpecialRunJobs.php @@ -52,7 +52,8 @@ class SpecialRunJobs extends UnlistedSpecialPage { } // Validate request parameters - $optional = [ 'maxjobs' => 0, 'maxtime' => 30, 'type' => false, 'async' => true ]; + $optional = [ 'maxjobs' => 0, 'maxtime' => 30, 'type' => false, + 'async' => true, 'stats' => false ]; $required = array_flip( [ 'title', 'tasks', 'signature', 'sigexpiry' ] ); $params = array_intersect_key( $this->getRequest()->getValues(), $required + $optional ); $missing = array_diff_key( $required, $params ); @@ -95,14 +96,20 @@ class SpecialRunJobs extends UnlistedSpecialPage { DeferredUpdates::POSTSEND ); } else { - $this->doRun( $params ); - print "Done\n"; + $stats = $this->doRun( $params ); + + if ( $params['stats'] ) { + $this->getRequest()->response()->header( 'Content-Type: application/json' ); + print FormatJson::encode( $stats ); + } else { + print "Done\n"; + } } } protected function doRun( array $params ) { $runner = new JobRunner( LoggerFactory::getInstance( 'runJobs' ) ); - $runner->run( [ + return $runner->run( [ 'type' => $params['type'], 'maxJobs' => $params['maxjobs'] ?: 1, 'maxTime' => $params['maxtime'] ?: 30