Remove some unused getting of non existent arguments
authorSam Reed <reedy@users.mediawiki.org>
Tue, 18 Oct 2011 17:32:20 +0000 (17:32 +0000)
committerSam Reed <reedy@users.mediawiki.org>
Tue, 18 Oct 2011 17:32:20 +0000 (17:32 +0000)
Documentation

12 files changed:
maintenance/namespaceDupes.php
maintenance/nextJobDB.php
maintenance/populateImageSha1.php
maintenance/rollbackEdits.php
maintenance/runBatchedQuery.php
maintenance/sqlite.php
maintenance/storage/checkStorage.php
maintenance/storage/compressOld.php
maintenance/storage/fixBug20757.php
maintenance/storage/recompressTracked.php
maintenance/upgrade1_5.php
maintenance/userOptions.inc

index 08783d7..0a5fec3 100644 (file)
@@ -70,6 +70,8 @@ class NamespaceConflictChecker extends Maintenance {
         * @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 @@ class NamespaceConflictChecker extends Maintenance {
         * @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 @@ class NamespaceConflictChecker extends Maintenance {
 
        /**
         * @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 @@ class NamespaceConflictChecker extends Maintenance {
         * @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 @@ class NamespaceConflictChecker extends Maintenance {
         * @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... " );
index 2d3608d..70cfdf7 100644 (file)
@@ -37,7 +37,7 @@ class nextJobDB extends Maintenance {
                $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 @@ class nextJobDB extends Maintenance {
                        $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 @@ class nextJobDB extends Maintenance {
 
        /**
         * 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 );
index 90fe82c..5eec8f4 100644 (file)
@@ -105,11 +105,7 @@ class PopulateImageSha1 extends LoggedUpdateMaintenance {
                $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
        }
 }
 
index e1c126e..6a7e85a 100644 (file)
@@ -76,6 +76,7 @@ class RollbackEdits extends Maintenance {
        /**
         * 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 );
index 9a6b638..83e0cab 100644 (file)
@@ -36,7 +36,6 @@ class BatchedQueryRunner extends Maintenance {
                        $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 {
index dc8a430..864d5ab 100644 (file)
@@ -35,6 +35,8 @@ class SqliteMaintenance extends Maintenance {
        /**
         * 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 @@ class SqliteMaintenance extends Maintenance {
 }
 
 $maintClass = "SqliteMaintenance";
-require_once( RUN_MAINTENANCE_IF_MAIN );
\ No newline at end of file
+require_once( RUN_MAINTENANCE_IF_MAIN );
index bc47f95..af1f9ee 100644 (file)
@@ -56,7 +56,6 @@ class CheckStorage {
        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";
index da82d93..8f0e92f 100644 (file)
@@ -123,7 +123,12 @@ class CompressOld extends Maintenance {
                } 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 @@ class CompressOld extends Maintenance {
                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 )
        {
index b6def2d..cb2663d 100644 (file)
@@ -302,6 +302,9 @@ class FixBug20757 extends Maintenance {
        /**
         * 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 );
index 09ab3e5..c8aac64 100644 (file)
@@ -169,6 +169,7 @@ class RecompressTracked {
 
        /**
         * Make sure the tracking table exists and isn't empty
+        * @return bool
         */
        function checkTrackingTable() {
                $dbr = wfGetDB( DB_SLAVE );
@@ -588,6 +589,7 @@ class RecompressTracked {
 
        /**
         * Returns the name of the next target cluster
+        * @return string
         */
        function getTargetCluster() {
                $cluster = next( $this->destClusters );
@@ -599,6 +601,8 @@ class RecompressTracked {
 
        /**
         * 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 @@ class CgzCopyTransaction {
        /**
         * Add text.
         * Returns false if it's ready to commit.
+        * @param $text string
+        * @param $textId
+        * @return bool
         */
        function addItem( $text, $textId ) {
                if ( !$this->cgz ) {
index 730e763..1577c23 100644 (file)
@@ -39,6 +39,12 @@ define( 'MW_UPGRADE_CALLBACK', null  ); // for self-documentation only
  * @ingroup Maintenance
  */
 class FiveUpgrade extends Maintenance {
+
+       /**
+        * @var DatabaseBase
+        */
+       protected $db;
+
        function __construct() {
                parent::__construct();
 
@@ -321,6 +327,8 @@ class FiveUpgrade extends Maintenance {
 
        /**
         * Helper function for copyTable array_filter
+        * @param $x
+        * @return bool
         */
        static private function notUpgradeNull( $x ) {
                return $x !== MW_UPGRADE_NULL;
@@ -800,8 +808,10 @@ END;
         * 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 ) {
index 6edef9d..a6659fe 100644 (file)
@@ -50,7 +50,14 @@ class userOptions {
        }
 
 
-       /** 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 @@ class userOptions {
                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 @@ class userOptions {
                        return false;
                }
 
-               $this-> { $this->mMode } ( );
-
+               $this->{ $this->mMode } ( );
+               return true;
        }
 
        #
@@ -206,8 +220,10 @@ class userOptions {
                }
        }
 
-
-       /** 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 @@ class userOptions {
                return $ret;
        }
 
-
        #
        # Helper methods
        #
@@ -250,7 +265,10 @@ USAGE;
        exit( 0 );
        }
 
-       /** The warning message and countdown */
+       /**
+        * The warning message and countdown
+        * @return bool
+        */
        public function warn() {
 
                if ( $this->mQuick ) {