Merge "Fix spacing in SpecialRevisiondelete.php"
[lhc/web/wiklou.git] / includes / Wiki.php
index 0f6a0b8..d78d7cb 100644 (file)
@@ -643,14 +643,9 @@ class MediaWiki {
                        '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;
                }
 
@@ -666,7 +661,8 @@ class MediaWiki {
                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;
                }
 
@@ -684,7 +680,7 @@ class MediaWiki {
                        // 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" );
                        }
                }