Siebrand has uploaded a new change for review.
https://gerrit.wikimedia.org/r/106912
Change subject: Remove methods in Block deprecated in 1.18
......................................................................
Remove methods in Block deprecated in 1.18
One use found in core or Gerrit extensions which was replaced.
* Block::clear() (deprecated in 1.18)
* Block::decodeExpiry() (deprecated in 1.18)
* Block::encodeExpiry() (deprecated in 1.18)
* Block::forUpdate() (deprecated in 1.18)
* Block::infinity() (deprecated in 1.18)
* Block::load() (deprecated in 1.18)
* Block::newFromDB() (deprecated in 1.18)
* Block::normaliseRange() (deprecated in 1.18)
* Block::parseExpiryInput() (deprecated in 1.18)
Change-Id: Ia8ea6b5248111326f929062346f3868a0550421b
---
M RELEASE-NOTES-1.23
M includes/Block.php
M tests/phpunit/includes/BlockTest.php
3 files changed, 9 insertions(+), 148 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/12/106912/1
diff --git a/RELEASE-NOTES-1.23 b/RELEASE-NOTES-1.23
index 6e245bf..d5f98c2 100644
--- a/RELEASE-NOTES-1.23
+++ b/RELEASE-NOTES-1.23
@@ -215,6 +215,15 @@
* Article::markpatrolled() (deprecated in 1.18)
* Article::unwatch() (deprecated in 1.18)
* Article::watch() (deprecated in 1.18)
+* Block::clear() (deprecated in 1.18)
+* Block::decodeExpiry() (deprecated in 1.18)
+* Block::encodeExpiry() (deprecated in 1.18)
+* Block::forUpdate() (deprecated in 1.18)
+* Block::infinity() (deprecated in 1.18)
+* Block::load() (deprecated in 1.18)
+* Block::newFromDB() (deprecated in 1.18)
+* Block::normaliseRange() (deprecated in 1.18)
+* Block::parseExpiryInput() (deprecated in 1.18)
* CategoryViewer::addSubcategory() (deprecated in 1.17)
* EditPage::spamPage() (deprecated since 1.17)
* Exif::getFormattedData() (deprecated in 1.18)
diff --git a/includes/Block.php b/includes/Block.php
index 8673a3d..3c22f9b 100644
--- a/includes/Block.php
+++ b/includes/Block.php
@@ -102,21 +102,6 @@
}
/**
- * Load a block from the database, using either the IP address or
- * user ID. Tries the user ID first, and if that doesn't work, tries
- * the address.
- *
- * @param string $address IP address of user/anon
- * @param $user Integer: user id of user
- * @return Block Object
- * @deprecated since 1.18
- */
- public static function newFromDB( $address, $user = 0 ) {
- wfDeprecated( __METHOD__, '1.18' );
- return self::newFromTarget( User::whoIs( $user ), $address );
- }
-
- /**
* Load a blocked user from their block id.
*
* @param $id Integer: Block id to search for
@@ -184,44 +169,6 @@
&& $this->prevents( 'editownusertalk' ) ==
$block->prevents( 'editownusertalk' )
&& $this->mReason == $block->mReason
);
- }
-
- /**
- * Clear all member variables in the current object. Does not clear
- * the block from the DB.
- * @deprecated since 1.18
- */
- public function clear() {
- wfDeprecated( __METHOD__, '1.18' );
- # Noop
- }
-
- /**
- * Get a block from the DB, with either the given address or the given
username
- *
- * @param string $address The IP address of the user, or blank to skip
IP blocks
- * @param int $user The user ID, or zero for anonymous users
- * @return Boolean: the user is blocked from editing
- * @deprecated since 1.18
- */
- public function load( $address = '', $user = 0 ) {
- wfDeprecated( __METHOD__, '1.18' );
- if ( $user ) {
- $username = User::whoIs( $user );
- $block = self::newFromTarget( $username, $address );
- } else {
- $block = self::newFromTarget( null, $address );
- }
-
- if ( $block instanceof Block ) {
- # This is mildly evil, but hey, it's B/C :D
- foreach ( $block as $variable => $value ) {
- $this->$variable = $value;
- }
- return true;
- } else {
- return false;
- }
}
/**
@@ -860,17 +807,6 @@
}
/**
- * Get/set the SELECT ... FOR UPDATE flag
- * @deprecated since 1.18
- *
- * @param $x Bool
- */
- public function forUpdate( $x = null ) {
- wfDeprecated( __METHOD__, '1.18' );
- # noop
- }
-
- /**
* Get/set a flag determining whether the master is used for reads
*
* @param $x Bool
@@ -947,33 +883,6 @@
}
/**
- * Encode expiry for DB
- *
- * @param string $expiry timestamp for expiry, or
- * @param $db DatabaseBase object
- * @return String
- * @deprecated since 1.18; use $dbw->encodeExpiry() instead
- */
- public static function encodeExpiry( $expiry, $db ) {
- wfDeprecated( __METHOD__, '1.18' );
- return $db->encodeExpiry( $expiry );
- }
-
- /**
- * Decode expiry which has come from the DB
- *
- * @param string $expiry Database expiry format
- * @param int $timestampType Requested timestamp format
- * @return String
- * @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 );
- }
-
- /**
* Get a timestamp of the expiry for autoblocks
*
* @param $timestamp String|Int
@@ -983,18 +892,6 @@
global $wgAutoblockExpiry;
return wfTimestamp( TS_MW, wfTimestamp( TS_UNIX, $timestamp ) +
$wgAutoblockExpiry );
- }
-
- /**
- * Gets rid of unneeded numbers in quad-dotted/octet IP strings
- * For example, 127.111.113.151/24 -> 127.111.113.0/24
- * @param string $range IP address to normalize
- * @return string
- * @deprecated since 1.18, call IP::sanitizeRange() directly
- */
- public static function normaliseRange( $range ) {
- wfDeprecated( __METHOD__, '1.18' );
- return IP::sanitizeRange( $range );
}
/**
@@ -1011,29 +908,6 @@
$dbw->delete( 'ipblocks',
array( 'ipb_expiry < ' . $dbw->addQuotes(
$dbw->timestamp() ) ), $method );
} );
- }
-
- /**
- * Get a value to insert into expiry field of the database when
infinite expiry
- * is desired
- * @deprecated since 1.18, call $dbr->getInfinity() directly
- * @return String
- */
- public static function infinity() {
- wfDeprecated( __METHOD__, '1.18' );
- return wfGetDB( DB_SLAVE )->getInfinity();
- }
-
- /**
- * Convert a submitted expiry time, which may be relative ("2 weeks",
etc) or absolute
- * ("24 May 2034"), into an absolute timestamp we can put into the
database.
- * @param string $expiry whatever was typed into the form
- * @return String: timestamp or "infinity" string for th DB
implementation
- * @deprecated since 1.18 moved to SpecialBlock::parseExpiryInput()
- */
- public static function parseExpiryInput( $expiry ) {
- wfDeprecated( __METHOD__, '1.18' );
- return SpecialBlock::parseExpiryInput( $expiry );
}
/**
diff --git a/tests/phpunit/includes/BlockTest.php
b/tests/phpunit/includes/BlockTest.php
index f0049fe..480d7d2 100644
--- a/tests/phpunit/includes/BlockTest.php
+++ b/tests/phpunit/includes/BlockTest.php
@@ -92,28 +92,6 @@
}
/**
- * This is the method previously used to load block info in CheckUser
etc
- * passing an empty value (empty string, null, etc) as the ip parameter
bypasses IP lookup checks.
- *
- * This stopped working with r84475 and friends: regression being fixed
for bug 29116.
- *
- * @dataProvider provideBug29116Data
- * @covers Block::load
- */
- public function testBug29116LoadWithEmptyIp( $vagueTarget ) {
- $this->hideDeprecated( 'Block::load' );
-
- $uid = User::idFromName( 'UTBlockee' );
- $this->assertTrue( ( $uid > 0 ), 'Must be able to look up the
target user during tests' );
-
- $block = new Block();
- $ok = $block->load( $vagueTarget, $uid );
- $this->assertTrue( $ok, "Block->load() with empty IP and user
ID '$uid' should return a block" );
-
- $this->assertTrue( $this->block->equals( $block ),
"Block->load() returns the same block as the one that was made when given empty
ip param " . var_export( $vagueTarget, true ) );
- }
-
- /**
* CheckUser since being changed to use Block::newFromTarget started
failing
* because the new function didn't accept empty strings like
Block::load()
* had. Regression bug 29116.
--
To view, visit https://gerrit.wikimedia.org/r/106912
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia8ea6b5248111326f929062346f3868a0550421b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Siebrand <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits