diff --git a/GlobalSettings.php b/GlobalSettings.php index bc50318465..813f08491e 100644 --- a/GlobalSettings.php +++ b/GlobalSettings.php @@ -910,4 +910,4 @@ $wgHTTPImportTimeout = 50; // Notifications -$wgNotifyTypeAvailabilityByCategory['login-success']['web'] = false; \ No newline at end of file +$wgNotifyTypeAvailabilityByCategory['login-success']['web'] = false; diff --git a/rpc/RunJobs.php b/rpc/RunJobs.php new file mode 100644 index 0000000000..131639e308 --- /dev/null +++ b/rpc/RunJobs.php @@ -0,0 +1,66 @@ +getDBLoadBalancerFactory(); +$lbFactory->disableChronologyProtection(); + +try { + $mediawiki = new MediaWiki(); + $runner = MediaWikiServices::getInstance()->getJobRunner(); + $response = $runner->run( [ + 'type' => isset( $_GET['type'] ) ? $_GET['type'] : false, + 'maxJobs' => isset( $_GET['maxjobs'] ) ? $_GET['maxjobs'] : 5000, + 'maxTime' => isset( $_GET['maxtime'] ) ? $_GET['maxtime'] : 30 + ] ); + + print json_encode( $response, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ); + + $mediawiki->restInPeace(); +} catch ( Exception $e ) { + http_response_code( 500 ); + MWExceptionHandler::rollbackPrimaryChangesAndLog( $e ); +}