$this->mAuto = $auto;
$this->isHardblock( !$anonOnly );
$this->prevents( 'createaccount', $createAccount );
- if ( $expiry == wfGetDB( DB_SLAVE )->getInfinity() ) {
- $this->mExpiry = $expiry;
+ if ( $expiry == 'infinity' || $expiry == wfGetDB( DB_SLAVE )->getInfinity() ) {
+ $this->mExpiry = 'infinity';
} else {
$this->mExpiry = wfTimestamp( TS_MW, $expiry );
}
* @deprecated since 1.18
*/
public static function newFromDB( $address, $user = 0 ) {
+ wfDeprecated( __METHOD__, '1.18' );
return self::newFromTarget( User::whoIs( $user ), $address );
}
* @deprecated since 1.18
*/
public function clear() {
+ wfDeprecated( __METHOD__, '1.18' );
# Noop
}
* @deprecated since 1.18
*/
public function load( $address = '', $user = 0 ) {
- wfDeprecated( __METHOD__ );
+ wfDeprecated( __METHOD__, '1.18' );
if( $user ){
$username = User::whoIs( $user );
$block = self::newFromTarget( $username, $address );
$this->mId = $row->ipb_id;
// I wish I didn't have to do this
- if ( $row->ipb_expiry == wfGetDB( DB_SLAVE )->getInfinity() ) {
- $this->mExpiry = $row->ipb_expiry;
+ $db = wfGetDB( DB_SLAVE );
+ if ( $row->ipb_expiry == $db->getInfinity() ) {
+ $this->mExpiry = 'infinity';
} else {
$this->mExpiry = wfTimestamp( TS_MW, $row->ipb_expiry );
}
$row = $this->getDatabaseArray();
$row['ipb_id'] = $dbw->nextSequenceValue("ipblocks_ipb_id_seq");
-
+
$dbw->insert(
'ipblocks',
$row,
$autoblock->mHideName = $this->mHideName;
$autoblock->prevents( 'editownusertalk', $this->prevents( 'editownusertalk' ) );
- if ( $this->mExpiry == wfGetDB( DB_SLAVE )->getInfinity() ) {
+ if ( $this->mExpiry == 'infinity' ) {
# Original block was indefinite, start an autoblock now
$autoblock->mExpiry = Block::getAutoblockExpiry( $timestamp );
} else {
* @param $x Bool
*/
public function forUpdate( $x = null ) {
+ wfDeprecated( __METHOD__, '1.18' );
# noop
}
* @deprecated since 1.18; use $dbw->encodeExpiry() instead
*/
public static function encodeExpiry( $expiry, $db ) {
+ wfDeprecated( __METHOD__, '1.18' );
return $db->encodeExpiry( $expiry );
}
* @deprecated since 1.18; use $wgLang->formatExpiry() instead
*/
public static function decodeExpiry( $expiry, $timestampType = TS_MW ) {
+ wfDeprecated( __METHOD__, '1.18' );
global $wgContLang;
return $wgContLang->formatExpiry( $expiry, $timestampType );
}
* @deprecated since 1.18, call IP::sanitizeRange() directly
*/
public static function normaliseRange( $range ) {
+ wfDeprecated( __METHOD__, '1.18' );
return IP::sanitizeRange( $range );
}
* @return String
*/
public static function infinity() {
+ wfDeprecated( __METHOD__, '1.18' );
return wfGetDB( DB_SLAVE )->getInfinity();
}
* @deprecated since 1.18; use $wgLang->formatExpiry() instead
*/
public static function formatExpiry( $encoded_expiry ) {
+ wfDeprecated( __METHOD__, '1.18' );
+
global $wgContLang;
static $msg = null;
* @deprecated since 1.18 moved to SpecialBlock::parseExpiryInput()
*/
public static function parseExpiryInput( $expiry ) {
- wfDeprecated( __METHOD__ );
+ wfDeprecated( __METHOD__, '1.18' );
return SpecialBlock::parseExpiryInput( $expiry );
}
# passed by some callers (bug 29116)
return null;
- } elseif( in_array( $type, array( Block::TYPE_USER, Block::TYPE_IP, Block::TYPE_RANGE, null ) ) ) {
+ } elseif( in_array( $type, array( Block::TYPE_USER, Block::TYPE_IP, Block::TYPE_RANGE ) ) ) {
$block = new Block();
$block->fromMaster( $fromMaster );
if( $block->newLoad( $vagueTarget ) ){
return $block;
- } else {
- return null;
}
- } else {
- return null;
}
+ return null;
}
/**
return $this->target;
}
+ /**
+ * @since 1.19
+ *
+ * @return Mixed|string
+ */
+ public function getExpiry() {
+ return $this->mExpiry;
+ }
+
/**
* Set the target for this block, and update $this->type accordingly
* @param $target Mixed