Follow-up r84475 CR; and also documentation fixes; PhpStorm 2.1 is *even more* fussy...
authorHappy-melon <happy-melon@users.mediawiki.org>
Sun, 26 Jun 2011 23:01:29 +0000 (23:01 +0000)
committerHappy-melon <happy-melon@users.mediawiki.org>
Sun, 26 Jun 2011 23:01:29 +0000 (23:01 +0000)
includes/Block.php
includes/User.php
includes/db/Database.php

index e875e9e..7911163 100644 (file)
@@ -160,7 +160,6 @@ class Block {
         *
         * @param $address string The IP address of the user, or blank to skip IP blocks
         * @param $user int The user ID, or zero for anonymous users
-        * @param $killExpired bool Whether to delete expired rows while loading
         * @return Boolean: the user is blocked from editing
         * @deprecated since 1.18
         */
@@ -394,6 +393,7 @@ class Block {
         * Insert a block into the block table. Will fail if there is a conflicting
         * block (same name and options) already in the database.
         *
+        * @param $dbw DatabaseBase if you have one available
         * @return mixed: false on failure, assoc array on success:
         *      ('id' => block ID, 'autoIds' => array of autoblock IDs)
         */
@@ -428,6 +428,9 @@ class Block {
        /**
         * Update a block in the DB with new parameters.
         * The ID field needs to be loaded first.
+        *
+        * @return Int number of affected rows, which should probably be 1 or something's
+        *     gone slightly awry
         */
        public function update() {
                wfDebug( "Block::update; timestamp {$this->mTimestamp}\n" );
@@ -770,6 +773,8 @@ class Block {
        /**
         * Get/set the SELECT ... FOR UPDATE flag
         * @deprecated since 1.18
+        *
+        * @param $x Bool
         */
        public function forUpdate( $x = null ) {
                # noop
@@ -777,6 +782,9 @@ class Block {
 
        /**
         * Get/set a flag determining whether the master is used for reads
+        *
+        * @param $x Bool
+        * @return Bool
         */
        public function fromMaster( $x = null ) {
                return wfSetVar( $this->mFromMaster, $x );
@@ -864,7 +872,7 @@ class Block {
         * Decode expiry which has come from the DB
         *
         * @param $expiry String: Database expiry format
-        * @param $timestampType Requested timestamp format
+        * @param $timestampType Int Requested timestamp format
         * @return String
         * @deprecated since 1.18; use $wgLang->decodeExpiry() instead
         */
@@ -876,6 +884,7 @@ class Block {
        /**
         * Get a timestamp of the expiry for autoblocks
         *
+        * @param $timestamp String|Int
         * @return String
         */
        public static function getAutoblockExpiry( $timestamp ) {
@@ -1016,6 +1025,8 @@ class Block {
         * From an existing Block, get the target and the type of target.  Note that it is
         * always safe to treat the target as a string; for User objects this will return
         * User::__toString() which in turn gives User::getName().
+        *
+        * @param $target String|Int|User
         * @return array( User|String, Block::TYPE_ constant )
         */
        public static function parseTarget( $target ) {
index 6bd26a4..7d66443 100644 (file)
@@ -194,6 +194,7 @@ class User {
         * @var Block
         */
        var $mBlock;
+       private $mBlockedFromCreateAccount = false;
 
        static $idCacheByName = array();
 
@@ -1246,7 +1247,7 @@ class User {
                $this->mBlock = Block::newFromTarget( $this->getName(), $ip, !$bFromSlave );
                if ( $this->mBlock instanceof Block ) {
                        wfDebug( __METHOD__ . ": Found block.\n" );
-                       $this->mBlockedby = $this->mBlock->getBlocker()->getName();
+                       $this->mBlockedby = $this->mBlock->getByName();
                        $this->mBlockreason = $this->mBlock->mReason;
                        $this->mHideName = $this->mBlock->mHideName;
                        $this->mAllowUsertalk = !$this->mBlock->prevents( 'editownusertalk' );
@@ -2921,12 +2922,11 @@ class User {
                # bug 13611: if the IP address the user is trying to create an account from is
                # blocked with createaccount disabled, prevent new account creation there even
                # when the user is logged in
-               static $accBlock = false;
-               if( $accBlock === false ){
-                       $accBlock = Block::newFromTarget( null, wfGetIP() );
+               if( $this->mBlockedFromCreateAccount === false ){
+                       $this->mBlockedFromCreateAccount = Block::newFromTarget( null, wfGetIP() );
                }
-               return $accBlock instanceof Block && $accBlock->prevents( 'createaccount' )
-                       ? $accBlock
+               return $this->mBlockedFromCreateAccount instanceof Block && $this->mBlockedFromCreateAccount->prevents( 'createaccount' )
+                       ? $this->mBlockedFromCreateAccount
                        : false;
        }
 
index c0ced73..c5ae946 100644 (file)
@@ -1138,12 +1138,12 @@ abstract class DatabaseBase implements DatabaseType {
         * Execute a SELECT query constructed using the various parameters provided.
         * See below for full details of the parameters.
         *
-        * @param $table Table name
-        * @param $vars Field names
-        * @param $conds Conditions
-        * @param $fname Caller function name
-        * @param $options Query options
-        * @param $join_conds Join conditions
+        * @param $table String|Array Table name
+        * @param $vars String|Array Field names
+        * @param $conds String|Array Conditions
+        * @param $fname String Caller function name
+        * @param $options Array Query options
+        * @param $join_conds Array Join conditions
         *
         *
         * @b    $table
@@ -1549,10 +1549,10 @@ abstract class DatabaseBase implements DatabaseType {
         *     possible to determine how many rows were successfully inserted using 
         *     DatabaseBase::affectedRows().
         *
-        * @param $table   Table name. This will be passed through 
+        * @param $table   String Table name. This will be passed through
         *                 DatabaseBase::tableName().
         * @param $a       Array of rows to insert
-        * @param $fname   Calling function name (use __METHOD__) for logs/profiling
+        * @param $fname   String Calling function name (use __METHOD__) for logs/profiling
         * @param $options Array of options
         *
         * @return bool
@@ -1626,7 +1626,7 @@ abstract class DatabaseBase implements DatabaseType {
        /**
         * UPDATE wrapper. Takes a condition array and a SET array.
         *
-        * @param $table  The name of the table to UPDATE. This will be passed through 
+        * @param $table  String name of the table to UPDATE. This will be passed through
         *                DatabaseBase::tableName().
         *
         * @param $values Array:  An array of values to SET. For each array element, 
@@ -2392,9 +2392,10 @@ abstract class DatabaseBase implements DatabaseType {
        /**
         * DELETE query wrapper.
         *
-        * @param $table Table name
-        * @param $conds Condition array. See $conds in DatabaseBase::select() for 
+        * @param $table Array Table name
+        * @param $conds String|Array of conditions. See $conds in DatabaseBase::select() for
         *               the format. Use $conds == "*" to delete all rows
+        * @param $fname String name of the calling function
         *
         * @return bool
         */