Pass phpcs-strict on maintenance/ (3/8)
authorSiebrand Mazeland <siebrand@kitano.nl>
Tue, 22 Apr 2014 21:07:08 +0000 (23:07 +0200)
committerSiebrand <siebrand@kitano.nl>
Tue, 22 Apr 2014 21:25:52 +0000 (21:25 +0000)
Change-Id: I453ecc474139c7a5f1d0d20306ad28c2cee80ec9

maintenance/populateImageSha1.php
maintenance/populateLogSearch.php
maintenance/populateParentId.php
maintenance/populateRecentChangesSource.php
maintenance/populateRevisionLength.php
maintenance/populateRevisionSha1.php
maintenance/preprocessDump.php
maintenance/preprocessorFuzzTest.php
maintenance/reassignEdits.php
maintenance/rebuildall.php

index 4964bf1..575573b 100644 (file)
@@ -36,7 +36,12 @@ class PopulateImageSha1 extends LoggedUpdateMaintenance {
                $this->addOption( 'multiversiononly', "Calculate only for files with several versions" );
                $this->addOption( 'method', "Use 'pipe' to pipe to mysql command line,\n" .
                        "\t\tdefault uses Database class", false, true );
-               $this->addOption( 'file', 'Fix for a specific file, without File: namespace prefixed', false, true );
+               $this->addOption(
+                       'file',
+                       'Fix for a specific file, without File: namespace prefixed',
+                       false,
+                       true
+               );
        }
 
        protected function getUpdateKey() {
index d65635e..83e470d 100644 (file)
@@ -31,7 +31,12 @@ require_once __DIR__ . '/Maintenance.php';
  * @ingroup Maintenance
  */
 class PopulateLogSearch extends LoggedUpdateMaintenance {
-       static $tableMap = array( 'rev' => 'revision', 'fa' => 'filearchive', 'oi' => 'oldimage', 'ar' => 'archive' );
+       private static $tableMap = array(
+               'rev' => 'revision',
+               'fa' => 'filearchive',
+               'oi' => 'oldimage',
+               'ar' => 'archive'
+       );
 
        public function __construct() {
                parent::__construct();
index e29fa5f..35eef83 100644 (file)
@@ -85,10 +85,16 @@ class PopulateParentId extends LoggedUpdateMaintenance {
                                # If there are none, check the the highest ID with a lower timestamp
                                if ( !$previousID ) {
                                        # Get the highest older timestamp
-                                       $lastTimestamp = $db->selectField( 'revision', 'rev_timestamp',
-                                               array( 'rev_page' => $row->rev_page, "rev_timestamp < " . $db->addQuotes( $row->rev_timestamp ) ),
+                                       $lastTimestamp = $db->selectField(
+                                               'revision',
+                                               'rev_timestamp',
+                                               array(
+                                                       'rev_page' => $row->rev_page,
+                                                       "rev_timestamp < " . $db->addQuotes( $row->rev_timestamp )
+                                               ),
                                                __METHOD__,
-                                               array( 'ORDER BY' => 'rev_timestamp DESC' ) );
+                                               array( 'ORDER BY' => 'rev_timestamp DESC' )
+                                       );
                                        # If there is one, let the highest rev ID win
                                        if ( $lastTimestamp ) {
                                                $previousID = $db->selectField( 'revision', 'rev_id',
index 0e8e501..e9c9407 100644 (file)
@@ -21,7 +21,7 @@
  * @ingroup Maintenance
  */
 
-require_once dirname( __FILE__ ) . '/Maintenance.php';
+require_once __DIR__ . '/Maintenance.php';
 
 /**
  * Maintenance script to populate the rc_source field.
@@ -32,7 +32,8 @@ require_once dirname( __FILE__ ) . '/Maintenance.php';
 class PopulateRecentChangesSource extends LoggedUpdateMaintenance {
        public function __construct() {
                parent::__construct();
-               $this->mDescription = "Populates rc_source field of the recentchanges table with the data in rc_type.";
+               $this->mDescription =
+                       "Populates rc_source field of the recentchanges table with the data in rc_type.";
                $this->setBatchSize( 100 );
        }
 
index d5e40e4..636d63e 100644 (file)
@@ -58,7 +58,8 @@ class PopulateRevisionLength extends LoggedUpdateMaintenance {
                $this->output( "Populating ar_len column\n" );
                $ar = $this->doLenUpdates( 'archive', 'ar_id', 'ar', Revision::selectArchiveFields() );
 
-               $this->output( "rev_len and ar_len population complete [$rev revision rows, $ar archive rows].\n" );
+               $this->output( "rev_len and ar_len population complete "
+                       . "[$rev revision rows, $ar archive rows].\n" );
                return true;
        }
 
index 9bb510f..03f9b09 100644 (file)
@@ -61,7 +61,8 @@ class PopulateRevisionSha1 extends LoggedUpdateMaintenance {
                $this->output( "Populating ar_sha1 column legacy rows\n" );
                $ac += $this->doSha1LegacyUpdates();
 
-               $this->output( "rev_sha1 and ar_sha1 population complete [$rc revision rows, $ac archive rows].\n" );
+               $this->output( "rev_sha1 and ar_sha1 population complete "
+                       . "[$rc revision rows, $ac archive rows].\n" );
                return true;
        }
 
index 25ef1a7..c69e5c2 100644 (file)
@@ -87,7 +87,8 @@ class PreprocessDump extends DumpIterator {
                try {
                        $this->mPreprocessor->preprocessToObj( strval( $content->getNativeData() ), 0 );
                } catch ( Exception $e ) {
-                       $this->error( "Caught exception " . $e->getMessage() . " in " . $rev->getTitle()->getPrefixedText() );
+                       $this->error( "Caught exception " . $e->getMessage() . " in "
+                               . $rev->getTitle()->getPrefixedText() );
                }
        }
 }
index 53aeb09..498ddf6 100644 (file)
@@ -45,7 +45,8 @@ class PPFuzzTester {
        // public $outputTypes = array( 'OT_HTML', 'OT_WIKI', 'OT_PREPROCESS' );
        public $entryPoints = array( 'testSrvus', 'testPst', 'testPreprocess' );
        public $verbose = false;
-       static $currentTest = false;
+
+       private static $currentTest = false;
 
        function execute() {
                if ( !file_exists( 'results' ) ) {
@@ -195,7 +196,13 @@ class PPFuzzTest {
                $options = ParserOptions::newFromUser( $wgUser );
                $options->setTemplateCallback( array( $this, 'templateHook' ) );
                $options->setTimestamp( wfTimestampNow() );
-               $this->output = call_user_func( array( $wgParser, $this->entryPoint ), $this->mainText, $this->title, $options );
+               $this->output = call_user_func(
+                       array( $wgParser, $this->entryPoint ),
+                       $this->mainText,
+                       $this->title,
+                       $options
+               );
+
                return $this->output;
        }
 
@@ -203,7 +210,8 @@ class PPFuzzTest {
                $s = "Title: " . $this->title->getPrefixedDBkey() . "\n" .
 //                     "Output type: {$this->outputType}\n" .
                        "Entry point: {$this->entryPoint}\n" .
-                       "User: " . ( $this->fancySig ? 'fancy' : 'no-fancy' ) . ' ' . var_export( $this->nickname, true ) . "\n" .
+                       "User: " . ( $this->fancySig ? 'fancy' : 'no-fancy' ) .
+                               ' ' . var_export( $this->nickname, true ) . "\n" .
                        "Main text: " . var_export( $this->mainText, true ) . "\n";
                foreach ( $this->templates as $titleText => $template ) {
                        $finalTitle = $template['finalTitle'];
@@ -214,6 +222,7 @@ class PPFuzzTest {
                        }
                }
                $s .= "Output: " . var_export( $this->output, true ) . "\n";
+
                return $s;
        }
 }
index 89237a5..9b10470 100644 (file)
@@ -79,13 +79,23 @@ class ReassignEdits extends Maintenance {
 
                # Count things
                $this->output( "Checking current edits..." );
-               $res = $dbw->select( 'revision', 'COUNT(*) AS count', $this->userConditions( $from, 'rev_user', 'rev_user_text' ), __METHOD__ );
+               $res = $dbw->select(
+                       'revision',
+                       'COUNT(*) AS count',
+                       $this->userConditions( $from, 'rev_user', 'rev_user_text' ),
+                       __METHOD__
+               );
                $row = $dbw->fetchObject( $res );
                $cur = $row->count;
                $this->output( "found {$cur}.\n" );
 
                $this->output( "Checking deleted edits..." );
-               $res = $dbw->select( 'archive', 'COUNT(*) AS count', $this->userConditions( $from, 'ar_user', 'ar_user_text' ), __METHOD__ );
+               $res = $dbw->select(
+                       'archive',
+                       'COUNT(*) AS count',
+                       $this->userConditions( $from, 'ar_user', 'ar_user_text' ),
+                       __METHOD__
+               );
                $row = $dbw->fetchObject( $res );
                $del = $row->count;
                $this->output( "found {$del}.\n" );
@@ -93,7 +103,12 @@ class ReassignEdits extends Maintenance {
                # Don't count recent changes if we're not supposed to
                if ( $rc ) {
                        $this->output( "Checking recent changes..." );
-                       $res = $dbw->select( 'recentchanges', 'COUNT(*) AS count', $this->userConditions( $from, 'rc_user', 'rc_user_text' ), __METHOD__ );
+                       $res = $dbw->select(
+                               'recentchanges',
+                               'COUNT(*) AS count',
+                               $this->userConditions( $from, 'rc_user', 'rc_user_text' ),
+                               __METHOD__
+                       );
                        $row = $dbw->fetchObject( $res );
                        $rec = $row->count;
                        $this->output( "found {$rec}.\n" );
@@ -138,7 +153,9 @@ class ReassignEdits extends Maintenance {
         * @return array
         */
        private function userConditions( &$user, $idfield, $utfield ) {
-               return $user->getId() ? array( $idfield => $user->getId() ) : array( $utfield => $user->getName() );
+               return $user->getId()
+                       ? array( $idfield => $user->getId() )
+                       : array( $utfield => $user->getName() );
        }
 
        /**
index 1268d20..eeee9c2 100644 (file)
@@ -42,7 +42,8 @@ class RebuildAll extends Maintenance {
        public function execute() {
                // Rebuild the text index
                if ( wfGetDB( DB_SLAVE )->getType() != 'postgres' ) {
-                       $this->output( "** Rebuilding fulltext search index (if you abort this will break searching; run this script again to fix):\n" );
+                       $this->output( "** Rebuilding fulltext search index (if you abort "
+                               . "this will break searching; run this script again to fix):\n" );
                        $rebuildText = $this->runChild( 'RebuildTextIndex', 'rebuildtextindex.php' );
                        $rebuildText->execute();
                }
@@ -53,7 +54,8 @@ class RebuildAll extends Maintenance {
                $rebuildRC->execute();
 
                // Rebuild link tables
-               $this->output( "\n\n** Rebuilding links tables -- this can take a long time. It should be safe to abort via ctrl+C if you get bored.\n" );
+               $this->output( "\n\n** Rebuilding links tables -- this can take a long time. "
+                       . "It should be safe to abort via ctrl+C if you get bored.\n" );
                $rebuildLinks = $this->runChild( 'RefreshLinks', 'refreshLinks.php' );
                $rebuildLinks->execute();