From: Kunal Mehta Date: Sun, 10 Jun 2018 19:05:31 +0000 (-0700) Subject: Remove deprecated Linker::getLinkColour() X-Git-Tag: 1.34.0-rc.0~5098 X-Git-Url: http://git.heureux-cyclage.org/?a=commitdiff_plain;h=03e7ae45bcb1c94caa091eb9e63ca7638002853e;p=lhc%2Fweb%2Fwiklou.git Remove deprecated Linker::getLinkColour() Change-Id: I1818d9eb369c620cc436c13446a5362816e8362d --- diff --git a/RELEASE-NOTES-1.32 b/RELEASE-NOTES-1.32 index 16cea6db32..36e1f35e6c 100644 --- a/RELEASE-NOTES-1.32 +++ b/RELEASE-NOTES-1.32 @@ -160,6 +160,8 @@ because of Phabricator reports. or refer to T195256 for details on how to make the same change. * Hook 'EditPageBeforeEditChecks' was removed; use 'EditPageGetCheckboxesDefinition' instead. +* Linker::getLinkColour() and DummyLinker::getLinkColour(), deprecated since + 1.28, were removed. LinkRenderer::getLinkClasses() should be used instead. === Deprecations in 1.32 === * Use of a StartProfiler.php file is deprecated in favour of placing diff --git a/includes/DummyLinker.php b/includes/DummyLinker.php index 7958420933..2f5455ef5a 100644 --- a/includes/DummyLinker.php +++ b/includes/DummyLinker.php @@ -5,14 +5,6 @@ */ class DummyLinker { - /** - * @deprecated since 1.28, use LinkRenderer::getLinkClasses() instead - */ - public function getLinkColour( $t, $threshold ) { - wfDeprecated( __METHOD__, '1.28' ); - return Linker::getLinkColour( $t, $threshold ); - } - public function link( $target, $html = null, diff --git a/includes/Linker.php b/includes/Linker.php index 96385028d7..ec61984c77 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -38,29 +38,6 @@ class Linker { const TOOL_LINKS_NOBLOCK = 1; const TOOL_LINKS_EMAIL = 2; - /** - * Return the CSS colour of a known link - * - * @deprecated since 1.28, use LinkRenderer::getLinkClasses() instead - * - * @since 1.16.3 - * @param LinkTarget $t - * @param int $threshold User defined threshold - * @return string CSS class - */ - public static function getLinkColour( LinkTarget $t, $threshold ) { - wfDeprecated( __METHOD__, '1.28' ); - $services = MediaWikiServices::getInstance(); - $linkRenderer = $services->getLinkRenderer(); - if ( $threshold !== $linkRenderer->getStubThreshold() ) { - // Need to create a new instance with the right stub threshold... - $linkRenderer = $services->getLinkRendererFactory()->create(); - $linkRenderer->setStubThreshold( $threshold ); - } - - return $linkRenderer->getLinkClasses( $t ); - } - /** * This function returns an HTML link to the given target. It serves a few * purposes: diff --git a/tests/phpunit/includes/LinkerTest.php b/tests/phpunit/includes/LinkerTest.php index f90ece921b..4c508e3851 100644 --- a/tests/phpunit/includes/LinkerTest.php +++ b/tests/phpunit/includes/LinkerTest.php @@ -1,6 +1,5 @@ assertEquals( $expected, $out ); } - - /** - * @covers Linker::getLinkColour - */ - public function testGetLinkColour() { - $this->hideDeprecated( 'Linker::getLinkColour' ); - $linkCache = MediaWikiServices::getInstance()->getLinkCache(); - $foobarTitle = Title::makeTitle( NS_MAIN, 'FooBar' ); - $redirectTitle = Title::makeTitle( NS_MAIN, 'Redirect' ); - $userTitle = Title::makeTitle( NS_USER, 'Someuser' ); - $linkCache->addGoodLinkObj( - 1, // id - $foobarTitle, - 10, // len - 0 // redir - ); - $linkCache->addGoodLinkObj( - 2, // id - $redirectTitle, - 10, // len - 1 // redir - ); - - $linkCache->addGoodLinkObj( - 3, // id - $userTitle, - 10, // len - 0 // redir - ); - - $this->assertEquals( - '', - Linker::getLinkColour( $foobarTitle, 0 ) - ); - - $this->assertEquals( - 'stub', - Linker::getLinkColour( $foobarTitle, 20 ) - ); - - $this->assertEquals( - 'mw-redirect', - Linker::getLinkColour( $redirectTitle, 0 ) - ); - - $this->assertEquals( - '', - Linker::getLinkColour( $userTitle, 20 ) - ); - } }