*
* @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
*/
* 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)
*/
/**
* 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" );
/**
* Get/set the SELECT ... FOR UPDATE flag
* @deprecated since 1.18
+ *
+ * @param $x Bool
*/
public function forUpdate( $x = null ) {
# noop
/**
* 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 );
* 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
*/
/**
* Get a timestamp of the expiry for autoblocks
*
+ * @param $timestamp String|Int
* @return String
*/
public static function getAutoblockExpiry( $timestamp ) {
* 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 ) {
* @var Block
*/
var $mBlock;
+ private $mBlockedFromCreateAccount = false;
static $idCacheByName = array();
$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' );
# 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;
}
* 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
* 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
/**
* 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,
/**
* 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
*/