Merge "Remove the deprecated IP class"

This commit is contained in:
jenkins-bot 2021-09-27 22:37:13 +00:00 committed by Gerrit Code Review
commit 7833853b49
5 changed files with 6 additions and 86 deletions

View file

@ -92,6 +92,10 @@ because of Phabricator reports.
* …
=== Breaking changes in 1.38 ===
* (T291008) The IP class, deprecated since 1.35 in favor of the IPUtils library,
has been removed. The IP related regexes which were also deprecated in favor
of the IPUtils library were also removed, IPUtils::RE_* should be used
instead.
* LinkCache::singleton(), deprecated since 1.28, has been removed.
* RepoGroup::singleton(), ::destroySingletons() and setSingleton(), all
deprecated since 1.34, have been removed.

View file

@ -642,7 +642,6 @@ $wgAutoloadLocalClasses = [
'ILanguageConverter' => __DIR__ . '/includes/language/ILanguageConverter.php',
'ILocalizedException' => __DIR__ . '/includes/exception/ILocalizedException.php',
'IMaintainableDatabase' => __DIR__ . '/includes/libs/rdbms/database/IMaintainableDatabase.php',
'IP' => __DIR__ . '/includes/compat/IP.php',
'IPTC' => __DIR__ . '/includes/media/IPTC.php',
'IRCColourfulRCFeedFormatter' => __DIR__ . '/includes/rcfeed/IRCColourfulRCFeedFormatter.php',
'ISearchResultSet' => __DIR__ . '/includes/search/ISearchResultSet.php',

View file

@ -1,82 +0,0 @@
<?php
/**
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/gpl.html
*
* @file
*/
use Wikimedia\IPUtils;
/**
* An IPv4 address is made of 4 bytes from x00 to xFF which is d0 to d255
* @deprecated since 1.35 use Wikimedia\IPUtils::RE_IP_BYTE instead
*/
define( 'RE_IP_BYTE', IPUtils::RE_IP_BYTE );
/**
* @deprecated since 1.35 use Wikimedia\IPUtils::RE_IP_ADD instead
*/
define( 'RE_IP_ADD', IPUtils::RE_IP_ADD );
/**
* An IPv4 range is an IP address and a prefix (d1 to d32)
* @deprecated since 1.35 use Wikimedia\IPUtils::RE_IP_PREFIX instead
*/
define( 'RE_IP_PREFIX', IPUtils::RE_IP_PREFIX );
/**
* @deprecated since 1.35 use Wikimedia\IPUtils::RE_IP_RANGE instead
*/
define( 'RE_IP_RANGE', IPUtils::RE_IP_RANGE );
/**
* An IPv6 address is made up of 8 words (each x0000 to xFFFF).
* However, the "::" abbreviation can be used on consecutive x0000 words.
* @deprecated since 1.35 use Wikimedia\IPUtils::RE_IPV6_WORD instead
*/
define( 'RE_IPV6_WORD', IPUtils::RE_IPV6_WORD );
/**
* @deprecated since 1.35 use Wikimedia\IPUtils::RE_IPV6_PREFIX instead
*/
define( 'RE_IPV6_PREFIX', IPUtils::RE_IPV6_PREFIX );
/**
* @deprecated since 1.35 use Wikimedia\IPUtils::RE_IPV6_ADD instead
*/
define( 'RE_IPV6_ADD', IPUtils::RE_IPV6_ADD );
/**
* An IPv6 range is an IP address and a prefix (d1 to d128)
* @deprecated since 1.35 use Wikimedia\IPUtils::RE_IPV6_RANGE instead
*/
define( 'RE_IPV6_RANGE', IPUtils::RE_IPV6_RANGE );
/**
* For IPv6 canonicalization (NOT for strict validation; these are quite lax!)
* @deprecated since 1.35 use Wikimedia\IPUtils::RE_IPV6_GAP instead
*/
define( 'RE_IPV6_GAP', IPUtils::RE_IPV6_GAP );
/**
* @deprecated since 1.35 use Wikimedia\IPUtils::RE_IPV6_V4_PREFIX instead
*/
define( 'RE_IPV6_V4_PREFIX', IPUtils::RE_IPV6_V4_PREFIX );
/**
* This might be useful for regexps used elsewhere, matches any IPv4 or IPv6 address or network
* @deprecated since 1.35 use Wikimedia\IPUtils::RE_IP_ADDRESS_STRING instead
*/
define( 'IP_ADDRESS_STRING', IPUtils::RE_IP_ADDRESS_STRING );
/**
* Pre-librarized class name for IPUtils
*
* @deprecated since 1.35
*/
class IP extends IPUtils {
// Direct wrapper.
}

View file

@ -21,6 +21,7 @@
use MediaWiki\MediaWikiServices;
use MediaWiki\Page\PageReference;
use Wikimedia\Assert\Assert;
use Wikimedia\IPUtils;
/**
* Handles purging the appropriate CDN objects given a list of URLs or Title instances
@ -300,7 +301,7 @@ class CdnCacheUpdate implements DeferrableUpdate, MergeableUpdate {
$url = self::expand( $url );
$urlInfo = wfParseUrl( $url );
$urlHost = strlen( $urlInfo['port'] ?? null )
? IP::combineHostAndPort( $urlInfo['host'], $urlInfo['port'] )
? IPUtils::combineHostAndPort( $urlInfo['host'], $urlInfo['port'] )
: $urlInfo['host'];
$baseReq = [
'method' => 'PURGE',

View file

@ -506,7 +506,6 @@ class MediaWikiTitleCodecTest extends MediaWikiIntegrationTestCase {
/**
* @dataProvider provideMakeTitleValueSafe
* @covers IP::sanitizeIP
*/
public function testMakeTitleValueSafe(
$expected, $ns, $text, $fragment = '', $interwiki = '', $lang = 'en'
@ -521,7 +520,6 @@ class MediaWikiTitleCodecTest extends MediaWikiIntegrationTestCase {
* @covers Title::makeTitleSafe
* @covers Title::makeName
* @covers Title::secureAndSplit
* @covers IP::sanitizeIP
*/
public function testMakeTitleSafe(
$expected, $ns, $text, $fragment = '', $interwiki = '', $lang = 'en'