From: Siebrand Mazeland Date: Tue, 22 Apr 2014 21:07:08 +0000 (+0200) Subject: Pass phpcs-strict on maintenance/ (3/8) X-Git-Tag: 1.31.0-rc.0~16074^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/journal.php?a=commitdiff_plain;h=0619388d87ff07ad0100a57b81d61d2c034fd8cc;p=lhc%2Fweb%2Fwiklou.git Pass phpcs-strict on maintenance/ (3/8) Change-Id: I453ecc474139c7a5f1d0d20306ad28c2cee80ec9 --- diff --git a/maintenance/populateImageSha1.php b/maintenance/populateImageSha1.php index 4964bf116c..575573ba02 100644 --- a/maintenance/populateImageSha1.php +++ b/maintenance/populateImageSha1.php @@ -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() { diff --git a/maintenance/populateLogSearch.php b/maintenance/populateLogSearch.php index d65635e57e..83e470d59b 100644 --- a/maintenance/populateLogSearch.php +++ b/maintenance/populateLogSearch.php @@ -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(); diff --git a/maintenance/populateParentId.php b/maintenance/populateParentId.php index e29fa5f1cf..35eef83bc6 100644 --- a/maintenance/populateParentId.php +++ b/maintenance/populateParentId.php @@ -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', diff --git a/maintenance/populateRecentChangesSource.php b/maintenance/populateRecentChangesSource.php index 0e8e501252..e9c94070ab 100644 --- a/maintenance/populateRecentChangesSource.php +++ b/maintenance/populateRecentChangesSource.php @@ -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 ); } diff --git a/maintenance/populateRevisionLength.php b/maintenance/populateRevisionLength.php index d5e40e4843..636d63ee86 100644 --- a/maintenance/populateRevisionLength.php +++ b/maintenance/populateRevisionLength.php @@ -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; } diff --git a/maintenance/populateRevisionSha1.php b/maintenance/populateRevisionSha1.php index 9bb510f956..03f9b09068 100644 --- a/maintenance/populateRevisionSha1.php +++ b/maintenance/populateRevisionSha1.php @@ -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; } diff --git a/maintenance/preprocessDump.php b/maintenance/preprocessDump.php index 25ef1a776e..c69e5c24ac 100644 --- a/maintenance/preprocessDump.php +++ b/maintenance/preprocessDump.php @@ -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() ); } } } diff --git a/maintenance/preprocessorFuzzTest.php b/maintenance/preprocessorFuzzTest.php index 53aeb09b67..498ddf6462 100644 --- a/maintenance/preprocessorFuzzTest.php +++ b/maintenance/preprocessorFuzzTest.php @@ -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; } } diff --git a/maintenance/reassignEdits.php b/maintenance/reassignEdits.php index 89237a5fae..9b10470ddf 100644 --- a/maintenance/reassignEdits.php +++ b/maintenance/reassignEdits.php @@ -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() ); } /** diff --git a/maintenance/rebuildall.php b/maintenance/rebuildall.php index 1268d20916..eeee9c21b7 100644 --- a/maintenance/rebuildall.php +++ b/maintenance/rebuildall.php @@ -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();