http://www.mediawiki.org/wiki/Special:Code/MediaWiki/100131
Revision: 100131
Author: reedy
Date: 2011-10-18 17:32:20 +0000 (Tue, 18 Oct 2011)
Log Message:
-----------
Remove some unused getting of non existent arguments
Documentation
Modified Paths:
--------------
trunk/phase3/maintenance/namespaceDupes.php
trunk/phase3/maintenance/nextJobDB.php
trunk/phase3/maintenance/populateImageSha1.php
trunk/phase3/maintenance/rollbackEdits.php
trunk/phase3/maintenance/runBatchedQuery.php
trunk/phase3/maintenance/sqlite.php
trunk/phase3/maintenance/storage/checkStorage.php
trunk/phase3/maintenance/storage/compressOld.php
trunk/phase3/maintenance/storage/fixBug20757.php
trunk/phase3/maintenance/storage/recompressTracked.php
trunk/phase3/maintenance/upgrade1_5.php
trunk/phase3/maintenance/userOptions.inc
Modified: trunk/phase3/maintenance/namespaceDupes.php
===================================================================
--- trunk/phase3/maintenance/namespaceDupes.php 2011-10-18 17:31:54 UTC (rev
100130)
+++ trunk/phase3/maintenance/namespaceDupes.php 2011-10-18 17:32:20 UTC (rev
100131)
@@ -70,6 +70,8 @@
* @todo Document
* @param $fix Boolean: whether or not to fix broken entries
* @param $suffix String: suffix to append to renamed articles
+ *
+ * @return bool
*/
private function checkAll( $fix, $suffix = '' ) {
global $wgContLang, $wgNamespaceAliases, $wgCapitalLinks;
@@ -156,6 +158,7 @@
* @param $name String
* @param $fix Boolean: whether to fix broken entries
* @param $suffix String: suffix to append to renamed articles
+ * @return bool
*/
private function checkNamespace( $ns, $name, $fix, $suffix = '' ) {
$conflicts = $this->getConflicts( $ns, $name );
@@ -177,6 +180,11 @@
/**
* @todo: do this for reals
+ * @param $key
+ * @param $prefix
+ * @param $fix
+ * @param $suffix string
+ * @return bool
*/
private function checkPrefix( $key, $prefix, $fix, $suffix = '' ) {
$this->output( "Checking prefix \"$prefix\" vs namespace
$key\n" );
@@ -264,6 +272,7 @@
* @param $row Object: row from the page table to fix
* @param $resolvable Boolean
* @param $suffix String: suffix to append to the fixed page
+ * @return bool
*/
private function resolveConflict( $row, $resolvable, $suffix ) {
if ( !$resolvable ) {
@@ -295,6 +304,7 @@
* @param $row Object: row from the old broken entry
* @param $table String: table to update
* @param $prefix String: prefix for column name, like page or ar
+ * @return bool
*/
private function resolveConflictOn( $row, $table, $prefix ) {
$this->output( "... resolving on $table... " );
Modified: trunk/phase3/maintenance/nextJobDB.php
===================================================================
--- trunk/phase3/maintenance/nextJobDB.php 2011-10-18 17:31:54 UTC (rev
100130)
+++ trunk/phase3/maintenance/nextJobDB.php 2011-10-18 17:32:20 UTC (rev
100131)
@@ -37,7 +37,7 @@
$memcKey = 'jobqueue:dbs:v2';
$pendingDBs = $wgMemc->get( $memcKey );
- // If the cache entry wasn't present, or in 1% of cases
otherwise,
+ // If the cache entry wasn't present, or in 1% of cases
otherwise,
// regenerate the cache.
if ( !$pendingDBs || mt_rand( 0, 100 ) == 0 ) {
$pendingDBs = $this->getPendingDbs();
@@ -65,7 +65,7 @@
$candidates = array_values( $candidates );
$db = $candidates[ mt_rand( 0, count( $candidates ) - 1
) ];
if ( !$this->checkJob( $type, $db ) ) {
- // This job is not available in the current
database. Remove it from
+ // This job is not available in the current
database. Remove it from
// the cache.
if ( $type === false ) {
foreach ( $pendingDBs as $type2 => $dbs
) {
@@ -85,7 +85,10 @@
/**
* Check if the specified database has a job of the specified type in
it.
- * The type may be false to indicate "all".
+ * The type may be false to indicate "all".
+ * @param $type string
+ * @param $dbName string
+ * @return bool
*/
function checkJob( $type, $dbName ) {
$lb = wfGetLB( $dbName );
Modified: trunk/phase3/maintenance/populateImageSha1.php
===================================================================
--- trunk/phase3/maintenance/populateImageSha1.php 2011-10-18 17:31:54 UTC
(rev 100130)
+++ trunk/phase3/maintenance/populateImageSha1.php 2011-10-18 17:32:20 UTC
(rev 100131)
@@ -105,11 +105,7 @@
$t += microtime( true );
$this->output( sprintf( "\nDone %d files in %.1f seconds\n",
$numRows, $t ) );
- if ( $file ) {
- return false; // we only updated *some* files, don't log
- } else {
- return true;
- }
+ return !$file; // we only updated *some* files, don't log
}
}
Modified: trunk/phase3/maintenance/rollbackEdits.php
===================================================================
--- trunk/phase3/maintenance/rollbackEdits.php 2011-10-18 17:31:54 UTC (rev
100130)
+++ trunk/phase3/maintenance/rollbackEdits.php 2011-10-18 17:32:20 UTC (rev
100131)
@@ -76,6 +76,7 @@
/**
* Get all pages that should be rolled back for a given user
* @param $user String a name to check against rev_user_text
+ * @return array
*/
private function getRollbackTitles( $user ) {
$dbr = wfGetDB( DB_SLAVE );
Modified: trunk/phase3/maintenance/runBatchedQuery.php
===================================================================
--- trunk/phase3/maintenance/runBatchedQuery.php 2011-10-18 17:31:54 UTC
(rev 100130)
+++ trunk/phase3/maintenance/runBatchedQuery.php 2011-10-18 17:32:20 UTC
(rev 100131)
@@ -36,7 +36,6 @@
$this->error( "No query specified. Specify the query as
a command line parameter.", true );
$query = $this->getArg();
- $wait = $this->getOption( 'wait', 5 );
$n = 1;
$dbw = wfGetDB( DB_MASTER );
do {
Modified: trunk/phase3/maintenance/sqlite.php
===================================================================
--- trunk/phase3/maintenance/sqlite.php 2011-10-18 17:31:54 UTC (rev 100130)
+++ trunk/phase3/maintenance/sqlite.php 2011-10-18 17:32:20 UTC (rev 100131)
@@ -35,6 +35,8 @@
/**
* While we use database connection, this simple lie prevents useless
--dbpass and
* --dbuser options from appearing in help message for this script.
+ *
+ * @return int DB constant
*/
public function getDbType() {
return Maintenance::DB_NONE;
@@ -129,4 +131,4 @@
}
$maintClass = "SqliteMaintenance";
-require_once( RUN_MAINTENANCE_IF_MAIN );
\ No newline at end of file
+require_once( RUN_MAINTENANCE_IF_MAIN );
Modified: trunk/phase3/maintenance/storage/checkStorage.php
===================================================================
--- trunk/phase3/maintenance/storage/checkStorage.php 2011-10-18 17:31:54 UTC
(rev 100130)
+++ trunk/phase3/maintenance/storage/checkStorage.php 2011-10-18 17:32:20 UTC
(rev 100131)
@@ -56,7 +56,6 @@
function check( $fix = false, $xml = '' ) {
$dbr = wfGetDB( DB_SLAVE );
if ( $fix ) {
- $dbw = wfGetDB( DB_MASTER );
print "Checking, will fix errors if possible...\n";
} else {
print "Checking...\n";
Modified: trunk/phase3/maintenance/storage/compressOld.php
===================================================================
--- trunk/phase3/maintenance/storage/compressOld.php 2011-10-18 17:31:54 UTC
(rev 100130)
+++ trunk/phase3/maintenance/storage/compressOld.php 2011-10-18 17:32:20 UTC
(rev 100131)
@@ -123,7 +123,12 @@
} while( true );
}
- /** @todo document */
+ /**
+ * @todo document
+ * @param $row
+ * @param $extdb
+ * @return bool
+ */
private function compressPage( $row, $extdb ) {
if ( false !== strpos( $row->old_flags, 'gzip' ) || false !==
strpos( $row->old_flags, 'object' ) ) {
#print "Already compressed row {$row->old_id}\n";
@@ -156,7 +161,15 @@
return true;
}
- /** @todo document */
+ /**
+ * @param $startId
+ * @param $maxChunkSize
+ * @param $beginDate
+ * @param $endDate
+ * @param $extdb string
+ * @param $maxPageId bool|int
+ * @return bool
+ */
private function compressWithConcat( $startId, $maxChunkSize,
$beginDate,
$endDate, $extdb = "", $maxPageId = false )
{
Modified: trunk/phase3/maintenance/storage/fixBug20757.php
===================================================================
--- trunk/phase3/maintenance/storage/fixBug20757.php 2011-10-18 17:31:54 UTC
(rev 100130)
+++ trunk/phase3/maintenance/storage/fixBug20757.php 2011-10-18 17:32:20 UTC
(rev 100131)
@@ -302,6 +302,9 @@
/**
* This is based on part of HistoryBlobStub::getText().
* Determine if the text can be retrieved from the row in the normal
way.
+ * @param $stub
+ * @param $secondaryRow
+ * @return bool
*/
function isUnbrokenStub( $stub, $secondaryRow ) {
$flags = explode( ',', $secondaryRow->old_flags );
Modified: trunk/phase3/maintenance/storage/recompressTracked.php
===================================================================
--- trunk/phase3/maintenance/storage/recompressTracked.php 2011-10-18
17:31:54 UTC (rev 100130)
+++ trunk/phase3/maintenance/storage/recompressTracked.php 2011-10-18
17:32:20 UTC (rev 100131)
@@ -169,6 +169,7 @@
/**
* Make sure the tracking table exists and isn't empty
+ * @return bool
*/
function checkTrackingTable() {
$dbr = wfGetDB( DB_SLAVE );
@@ -588,6 +589,7 @@
/**
* Returns the name of the next target cluster
+ * @return string
*/
function getTargetCluster() {
$cluster = next( $this->destClusters );
@@ -599,6 +601,8 @@
/**
* Gets a DB master connection for the given external cluster name
+ * @param $cluster string
+ * @return DatabaseBase
*/
function getExtDB( $cluster ) {
$lb = wfGetLBFactory()->getExternalLB( $cluster );
@@ -684,6 +688,9 @@
/**
* Add text.
* Returns false if it's ready to commit.
+ * @param $text string
+ * @param $textId
+ * @return bool
*/
function addItem( $text, $textId ) {
if ( !$this->cgz ) {
Modified: trunk/phase3/maintenance/upgrade1_5.php
===================================================================
--- trunk/phase3/maintenance/upgrade1_5.php 2011-10-18 17:31:54 UTC (rev
100130)
+++ trunk/phase3/maintenance/upgrade1_5.php 2011-10-18 17:32:20 UTC (rev
100131)
@@ -39,6 +39,12 @@
* @ingroup Maintenance
*/
class FiveUpgrade extends Maintenance {
+
+ /**
+ * @var DatabaseBase
+ */
+ protected $db;
+
function __construct() {
parent::__construct();
@@ -321,6 +327,8 @@
/**
* Helper function for copyTable array_filter
+ * @param $x
+ * @return bool
*/
static private function notUpgradeNull( $x ) {
return $x !== MW_UPGRADE_NULL;
@@ -800,8 +808,10 @@
* Rename a given image or archived image file to the converted
filename,
* leaving a symlink for URL compatibility.
*
- * @param string $oldname pre-conversion filename
- * @param string $basename pre-conversion base filename for dir
hashing, if an archive
+ * @param $oldname string pre-conversion filename
+ * @param $subdirCallback string
+ * @param $basename string pre-conversion base filename for dir
hashing, if an archive
+ * @return bool|string
* @access private
*/
function renameFile( $oldname, $subdirCallback = 'wfImageDir',
$basename = null ) {
Modified: trunk/phase3/maintenance/userOptions.inc
===================================================================
--- trunk/phase3/maintenance/userOptions.inc 2011-10-18 17:31:54 UTC (rev
100130)
+++ trunk/phase3/maintenance/userOptions.inc 2011-10-18 17:32:20 UTC (rev
100131)
@@ -50,7 +50,14 @@
}
- /** This is used to check options. Only needed on construction */
+ /**
+ * This is used to check options. Only needed on construction
+ *
+ * @param $opts array
+ * @param $args array
+ *
+ * @return bool
+ */
private function checkOpts( $opts, $args ) {
// The three possible ways to run the script:
$list = isset( $opts['list'] );
@@ -63,7 +70,14 @@
return $isValid;
}
- /** load script options in the object */
+ /**
+ * load script options in the object
+ *
+ * @param $opts array
+ * @param $args array
+ *
+ * @return true
+ */
private function initializeOpts( $opts, $args ) {
$this->mQuick = isset( $opts['nowarn'] );
@@ -94,8 +108,8 @@
return false;
}
- $this-> { $this->mMode } ( );
-
+ $this->{ $this->mMode } ( );
+ return true;
}
#
@@ -206,8 +220,10 @@
}
}
-
- /** Return an array of option names */
+ /**
+ * Return an array of option names
+ * @return array
+ */
public static function getDefaultOptionsNames() {
$def = User::getDefaultOptions();
$ret = array();
@@ -217,7 +233,6 @@
return $ret;
}
-
#
# Helper methods
#
@@ -250,7 +265,10 @@
exit( 0 );
}
- /** The warning message and countdown */
+ /**
+ * The warning message and countdown
+ * @return bool
+ */
public function warn() {
if ( $this->mQuick ) {
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs