MessageCache: remove confusing and unused $isFullKey parameter from get()
authorAaron Schulz <aschulz@wikimedia.org>
Tue, 2 Oct 2018 20:53:32 +0000 (13:53 -0700)
committerKrinkle <krinklemail@gmail.com>
Tue, 2 Oct 2018 23:34:53 +0000 (23:34 +0000)
Follows-up cba0fb1c1576324e87b27, which removed the last caller.

Change-Id: I00c17fedff39b1b35519cff2a0f8eac3e4d6f2ab

includes/cache/MessageCache.php
tests/phpunit/includes/cache/MessageCacheTest.php

index aa929bc..bf2ed2e 100644 (file)
@@ -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 );
 
index 1edb935..f6ea680 100644 (file)
@@ -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
         */