'tasks' => 'jobs', 'maxjobs' => $n, 'sigexpiry' => time() + 5 );
$query['signature'] = ApiRunJobs::getQuerySignature( $query );
- // Slow job running method in case of API or socket functions being disabled
- $fallback = function() use ( $query ) {
- $api = new ApiMain( new FauxRequest( $query, true ) );
- $api->execute();
- };
-
if ( !$wgEnableAPI ) {
- $fallback();
+ // Fall back to running the job here while the user waits
+ ApiRunJobs::executeJobs( $n );
return;
}
wfRestoreWarnings();
if ( !$sock ) {
wfDebugLog( 'runJobs', "Failed to start cron API (socket error $errno): $errstr\n" );
- $fallback();
+ // Fall back to running the job here while the user waits
+ ApiRunJobs::executeJobs( $n );
return;
}
// Do not wait for the response (the script should handle client aborts).
// Make sure that we don't close before that script reaches ignore_user_abort().
$status = fgets( $sock );
- if ( !preg_match( '#^HTTP/\d\.\d 204 #', $status ) ) {
+ if ( !preg_match( '#^HTTP/\d\.\d 202 #', $status ) ) {
wfDebugLog( 'runJobs', "Failed to start cron API: received '$status'\n" );
}
}