From 7d2b121ac830bd6de6a52e6c050e0c4b57dbf7c6 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Tue, 2 Oct 2018 13:53:32 -0700 Subject: [PATCH] MessageCache: remove confusing and unused $isFullKey parameter from get() Follows-up cba0fb1c1576324e87b27, which removed the last caller. Change-Id: I00c17fedff39b1b35519cff2a0f8eac3e4d6f2ab --- includes/cache/MessageCache.php | 10 +--------- .../includes/cache/MessageCacheTest.php | 19 ------------------- 2 files changed, 1 insertion(+), 28 deletions(-) diff --git a/includes/cache/MessageCache.php b/includes/cache/MessageCache.php index aa929bcbbc..bf2ed2e430 100644 --- a/includes/cache/MessageCache.php +++ b/includes/cache/MessageCache.php @@ -776,13 +776,12 @@ class MessageCache { * - If boolean and false, create object from the current users language * - If boolean and true, create object from the wikis content language * - If language object, use it as given - * @param bool $isFullKey Specifies whether $key is a two part key "msg/lang". * * @throws MWException When given an invalid key * @return string|bool False if the message doesn't exist, otherwise the * message (which can be empty) */ - function get( $key, $useDB = true, $langcode = true, $isFullKey = false ) { + function get( $key, $useDB = true, $langcode = true ) { if ( is_int( $key ) ) { // Fix numerical strings that somehow become ints // on their way here @@ -794,13 +793,6 @@ class MessageCache { return false; } - // For full keys, get the language code from the key - $pos = strrpos( $key, '/' ); - if ( $isFullKey && $pos !== false ) { - $langcode = substr( $key, $pos + 1 ); - $key = substr( $key, 0, $pos ); - } - // Normalise title-case input (with some inlining) $lckey = self::normalizeKey( $key ); diff --git a/tests/phpunit/includes/cache/MessageCacheTest.php b/tests/phpunit/includes/cache/MessageCacheTest.php index 1edb9354ff..f6ea6802e3 100644 --- a/tests/phpunit/includes/cache/MessageCacheTest.php +++ b/tests/phpunit/includes/cache/MessageCacheTest.php @@ -129,25 +129,6 @@ class MessageCacheTest extends MediaWikiLangTestCase { $this->assertEquals( $oldText, $messageCache->get( $message ), 'Content restored' ); } - /** - * There's a fallback case where the message key is given as fully qualified -- this - * should ignore the passed $lang and use the language from the key - * - * @dataProvider provideMessagesForFullKeys - */ - public function testFullKeyBehaviour( $message, $lang, $expectedContent ) { - $result = MessageCache::singleton()->get( $message, true, $lang, true ); - $this->assertEquals( $expectedContent, $result, "Full key message fallback failed." ); - } - - function provideMessagesForFullKeys() { - return [ - [ 'MessageCacheTest-FullKeyTest/ru', 'ru', 'ru' ], - [ 'MessageCacheTest-FullKeyTest/ru', 'ab', 'ru' ], - [ 'MessageCacheTest-FullKeyTest/ru/foo', 'ru', false ], - ]; - } - /** * @dataProvider provideNormalizeKey */ -- 2.20.1