Merge "Fix typo in doc comment on MWSaltedPassword.php"
[lhc/web/wiklou.git] / includes / cache / MessageCache.php
index ef70589..47960ca 100644 (file)
@@ -154,7 +154,7 @@ class MessageCache {
                $this->mExpiry = $expiry;
 
                if ( $wgUseLocalMessageCache ) {
-                       $this->localCache = ObjectCache::newAccelerator( CACHE_NONE );
+                       $this->localCache = ObjectCache::getLocalServerInstance( CACHE_NONE );
                } else {
                        $this->localCache = wfGetCache( CACHE_NONE );
                }
@@ -574,11 +574,12 @@ class MessageCache {
 
                foreach ( $codes as $code ) {
                        $sidebarKey = wfMemcKey( 'sidebar', $code );
-                       $this->wanCache->delete( $sidebarKey, 5 );
+                       $this->wanCache->delete( $sidebarKey );
                }
 
                // Update the message in the message blob store
-               $blobStore = new MessageBlobStore();
+               $resourceloader = RequestContext::getMain()->getOutput()->getResourceLoader();
+               $blobStore = $resourceloader->getMessageBlobStore();
                $blobStore->updateMessage( $wgContLang->lcfirst( $msg ) );
 
                Hooks::run( 'MessageCacheReplace', array( $title, $text ) );
@@ -675,7 +676,7 @@ class MessageCache {
                                'hash' => $cache['HASH'],
                                'latest' => isset( $cache['LATEST'] ) ? $cache['LATEST'] : 0
                        ),
-                       WANObjectCache::TTL_NONE
+                       WANObjectCache::TTL_INDEFINITE
                );
        }
 
@@ -723,8 +724,6 @@ class MessageCache {
         *   message (which can be empty)
         */
        function get( $key, $useDB = true, $langcode = true, $isFullKey = false ) {
-               global $wgContLang;
-
                if ( is_int( $key ) ) {
                        // Fix numerical strings that somehow become ints
                        // on their way here
@@ -748,18 +747,11 @@ class MessageCache {
 
                Hooks::run( 'MessageCache::get', array( &$lckey ) );
 
-               if ( ord( $lckey ) < 128 ) {
-                       $uckey = ucfirst( $lckey );
-               } else {
-                       $uckey = $wgContLang->ucfirst( $lckey );
-               }
-
                // Loop through each language in the fallback list until we find something useful
                $lang = wfGetLangObj( $langcode );
                $message = $this->getMessageFromFallbackChain(
                        $lang,
                        $lckey,
-                       $uckey,
                        !$this->mDisable && $useDB
                );
 
@@ -801,21 +793,21 @@ class MessageCache {
        }
 
        /**
-        * Given a language, try and fetch a message from that language, then the
-        * fallbacks of that language, then the site language, then the fallbacks for the
-        * site language.
+        * Given a language, try and fetch messages from that language.
         *
-        * @param Language $lang Requested language
-        * @param string $lckey Lowercase key for the message
-        * @param string $uckey Uppercase key for the message
-        * @param bool $useDB Whether to use the database
+        * Will also consider fallbacks of that language, the site language, and fallbacks for
+        * the site language.
         *
         * @see MessageCache::get
+        * @param Language|StubObject $lang Preferred language
+        * @param string $lckey Lowercase key for the message (as for localisation cache)
+        * @param bool $useDB Whether to include messages from the wiki database
         * @return string|bool The message, or false if not found
         */
-       protected function getMessageFromFallbackChain( $lang, $lckey, $uckey, $useDB ) {
+       protected function getMessageFromFallbackChain( $lang, $lckey, $useDB ) {
                global $wgLanguageCode, $wgContLang;
 
+               $uckey = $wgContLang->ucfirst( $lckey );
                $langcode = $lang->getCode();
                $message = false;
 
@@ -903,7 +895,7 @@ class MessageCache {
         * @param string $code Code denoting the language to try.
         * @return string|bool The message, or false if it does not exist or on error
         */
-       function getMsgFromNamespace( $title, $code ) {
+       public function getMsgFromNamespace( $title, $code ) {
                $this->load( $code );
                if ( isset( $this->mCache[$code][$title] ) ) {
                        $entry = $this->mCache[$code][$title];