diff options
-rw-r--r-- | RELEASE-NOTES-1.35 | 1 | ||||
-rw-r--r-- | includes/GlobalFunctions.php | 16 | ||||
-rw-r--r-- | tests/phpunit/includes/GlobalFunctions/GlobalWithDBTest.php | 13 | ||||
-rw-r--r-- | tests/phpunit/unit/includes/BadFileLookupTest.php | 6 |
4 files changed, 6 insertions, 30 deletions
diff --git a/RELEASE-NOTES-1.35 b/RELEASE-NOTES-1.35 index c26f72e52a3c..92c85a2e7293 100644 --- a/RELEASE-NOTES-1.35 +++ b/RELEASE-NOTES-1.35 @@ -660,6 +660,7 @@ because of Phabricator reports. * The parameters to ChronologyProtector::getTouched() and ILBFactory::getChronologyProtectorTouched() were changed without backwards compatibility. +* The deprecated $blacklist parameter to wfIsBadImage() has been removed. * … === Deprecations in 1.35 === diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index f53643252245..86c7cf73c44b 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -24,7 +24,6 @@ if ( !defined( 'MEDIAWIKI' ) ) { die( "This file is part of MediaWiki, it is not a valid entry point" ); } -use MediaWiki\BadFileLookup; use MediaWiki\Linker\LinkTarget; use MediaWiki\Logger\LoggerFactory; use MediaWiki\MediaWikiServices; @@ -2800,23 +2799,10 @@ function wfUnpack( $format, $data, $length = false ) { * * @param string $name The image name to check * @param Title|bool $contextTitle The page on which the image occurs, if known - * @param string|null $blacklist Wikitext of a file blacklist * @return bool */ -function wfIsBadImage( $name, $contextTitle = false, $blacklist = null ) { +function wfIsBadImage( $name, $contextTitle = false ) { $services = MediaWikiServices::getInstance(); - if ( $blacklist !== null ) { - wfDeprecated( __FUNCTION__ . ' with $blacklist parameter', '1.34' ); - return ( new BadFileLookup( - function () use ( $blacklist ) { - return $blacklist; - }, - $services->getLocalServerObjectCache(), - $services->getRepoGroup(), - $services->getTitleParser(), - $services->getHookContainer() - ) )->isBadFile( $name, $contextTitle ?: null ); - } return $services->getBadFileLookup()->isBadFile( $name, $contextTitle ?: null ); } diff --git a/tests/phpunit/includes/GlobalFunctions/GlobalWithDBTest.php b/tests/phpunit/includes/GlobalFunctions/GlobalWithDBTest.php index fb383751a386..efae24dd0501 100644 --- a/tests/phpunit/includes/GlobalFunctions/GlobalWithDBTest.php +++ b/tests/phpunit/includes/GlobalFunctions/GlobalWithDBTest.php @@ -37,22 +37,11 @@ class GlobalWithDBTest extends MediaWikiTestCase { public function testWfIsBadImage( $name, $title, $expected ) { $this->setUpBadImageTests( $name ); - $this->editPage( 'MediaWiki:Bad image list', BadFileLookupTest::BLACKLIST ); + $this->editPage( 'MediaWiki:Bad image list', BadFileLookupTest::BAD_FILE_LIST ); $this->resetServices(); // Enable messages from MediaWiki namespace MediaWikiServices::getInstance()->getMessageCache()->enable(); $this->assertEquals( $expected, wfIsBadImage( $name, $title ) ); } - - /** - * @dataProvider BadFileLookupTest::provideIsBadFile - * @covers ::wfIsBadImage - */ - public function testWfIsBadImage_blacklistParam( $name, $title, $expected ) { - $this->setUpBadImageTests( $name ); - - $this->hideDeprecated( 'wfIsBadImage with $blacklist parameter' ); - $this->assertSame( $expected, wfIsBadImage( $name, $title, BadFileLookupTest::BLACKLIST ) ); - } } diff --git a/tests/phpunit/unit/includes/BadFileLookupTest.php b/tests/phpunit/unit/includes/BadFileLookupTest.php index fb37fadb2085..cf14a7dc46e6 100644 --- a/tests/phpunit/unit/includes/BadFileLookupTest.php +++ b/tests/phpunit/unit/includes/BadFileLookupTest.php @@ -8,7 +8,7 @@ use MediaWiki\MediaWikiServices; */ class BadFileLookupTest extends MediaWikiUnitTestCase { /** Shared with GlobalWithDBTest */ - public const BLACKLIST = <<<WIKITEXT + public const BAD_FILE_LIST = <<<WIKITEXT Comment line, no effect [[File:Good.jpg]] * Indented list is also a comment [[File:Good.jpg]] * [[File:Bad.jpg]] except [[Nasty page]] @@ -127,7 +127,7 @@ WIKITEXT; public function testIsBadFile( $name, $title, $expected ) { $bfl = new BadFileLookup( function () { - return self::BLACKLIST; + return self::BAD_FILE_LIST; }, new EmptyBagOStuff, $this->getMockRepoGroup(), @@ -146,7 +146,7 @@ WIKITEXT; public function testIsBadFile_nullRepoGroup( $name, $title, $expected ) { $bfl = new BadFileLookup( function () { - return self::BLACKLIST; + return self::BAD_FILE_LIST; }, new EmptyBagOStuff, $this->getMockRepoGroupNull(), |