Merge "Fix "UTPage" creation in tests"
[lhc/web/wiklou.git] / includes / specials / SpecialRunJobs.php
index 8a4026d..10e7009 100644 (file)
@@ -38,10 +38,12 @@ class SpecialRunJobs extends UnlistedSpecialPage {
                if ( wfReadOnly() ) {
                        header( "HTTP/1.0 423 Locked" );
                        print 'Wiki is in read-only mode';
+
                        return;
                } elseif ( !$this->getRequest()->wasPosted() ) {
                        header( "HTTP/1.0 400 Bad Request" );
                        print 'Request must be POSTed';
+
                        return;
                }
 
@@ -53,6 +55,7 @@ class SpecialRunJobs extends UnlistedSpecialPage {
                if ( count( $missing ) ) {
                        header( "HTTP/1.0 400 Bad Request" );
                        print 'Missing parameters: ' . implode( ', ', array_keys( $missing ) );
+
                        return;
                }
 
@@ -69,13 +72,14 @@ class SpecialRunJobs extends UnlistedSpecialPage {
                } else {
                        $result = 0;
                        for ( $i = 0; $i < strlen( $cSig ); $i++ ) {
-                               $result |= ord( $cSig{$i} ) ^ ord( $rSig{$i} );
+                               $result |= ord( $cSig[$i] ) ^ ord( $rSig[$i] );
                        }
                        $verified = ( $result == 0 );
                }
                if ( !$verified || $params['sigexpiry'] < time() ) {
                        header( "HTTP/1.0 400 Bad Request" );
                        print 'Invalid or stale signature provided';
+
                        return;
                }
 
@@ -113,7 +117,7 @@ class SpecialRunJobs extends UnlistedSpecialPage {
         *
         * @note: also called from Wiki.php
         *
-        * @param integer $maxJobs Maximum number of jobs to run
+        * @param int $maxJobs Maximum number of jobs to run
         * @return void
         */
        public static function executeJobs( $maxJobs ) {
@@ -132,7 +136,7 @@ class SpecialRunJobs extends UnlistedSpecialPage {
                                $job = $group->pop( JobQueueGroup::TYPE_DEFAULT, JobQueueGroup::USE_CACHE );
                                if ( $job ) {
                                        $output = $job->toString() . "\n";
-                                       $t = - microtime( true );
+                                       $t = -microtime( true );
                                        wfProfileIn( __METHOD__ . '-' . get_class( $job ) );
                                        $success = $job->run();
                                        wfProfileOut( __METHOD__ . '-' . get_class( $job ) );
@@ -148,6 +152,7 @@ class SpecialRunJobs extends UnlistedSpecialPage {
                                }
                        } while ( --$n && $job );
                } catch ( MWException $e ) {
+                       MWExceptionHandler::rollbackMasterChangesAndLog( $e );
                        // We don't want exceptions thrown during job execution to
                        // be reported to the user since the output is already sent.
                        // Instead we just log them.