Easier to use addWikiText() in wrapWikiMsg()
[lhc/web/wiklou.git] / includes / LocalisationCache.php
index 8ceb499..f81b9bf 100644 (file)
@@ -77,12 +77,6 @@ class LocalisationCache {
         */
        var $recachedLangs = array();
 
-       /**
-        * Data added by extensions using the deprecated $wgMessageCache->addMessages() 
-        * interface.
-        */
-       var $legacyData = array();
-
        /**
         * All item keys
         */
@@ -215,9 +209,6 @@ class LocalisationCache {
         * Get a subitem, for instance a single message for a given language.
         */
        public function getSubitem( $code, $key, $subkey ) {
-               if ( isset( $this->legacyData[$code][$key][$subkey] ) ) {
-                       return $this->legacyData[$code][$key][$subkey];
-               }
                if ( !isset( $this->loadedSubitems[$code][$key][$subkey] ) 
                        && !isset( $this->loadedItems[$code][$key] ) ) 
                {
@@ -586,9 +577,6 @@ class LocalisationCache {
                        $allData['defaultUserOptionOverrides'] = array();
                }
 
-               # Set the preload key
-               $allData['preload'] = $this->buildPreload( $allData );
-
                # Set the list keys
                $allData['list'] = array();
                foreach ( self::$splitKeys as $key ) {
@@ -603,6 +591,9 @@ class LocalisationCache {
                                'Check that your languages/messages/MessagesEn.php file is intact.' );
                }
 
+               # Set the preload key
+               $allData['preload'] = $this->buildPreload( $allData );
+
                # Save to the process cache and register the items loaded
                $this->data[$code] = $allData;
                foreach ( $allData as $key => $item ) {
@@ -621,6 +612,13 @@ class LocalisationCache {
                        }
                }
                $this->store->finishWrite();
+               
+               # Clear out the MessageBlobStore
+               # HACK: If using a null (i.e. disabled) storage backend, we
+               # can't write to the MessageBlobStore either
+               if ( !$this->store instanceof LCStore_Null ) {
+                       MessageBlobStore::clear();
+               }
 
                wfProfileOut( __METHOD__ );
        }
@@ -656,8 +654,6 @@ class LocalisationCache {
                unset( $this->loadedItems[$code] );
                unset( $this->loadedSubitems[$code] );
                unset( $this->initialisedLangs[$code] );
-               // We don't unload legacyData because there's no way to get it back 
-               // again, it's not really a cache
                foreach ( $this->shallowFallbacks as $shallowCode => $fbCode ) {
                        if ( $fbCode === $code ) {
                                $this->unload( $shallowCode );
@@ -674,22 +670,6 @@ class LocalisationCache {
                }
        }
 
-       /**
-        * Add messages to the cache, from an extension that has not yet been 
-        * migrated to $wgExtensionMessages or the LocalisationCacheRecache hook. 
-        * Called by deprecated function $wgMessageCache->addMessages(). 
-        */
-       public function addLegacyMessages( $messages ) {
-               foreach ( $messages as $lang => $langMessages ) {
-                       if ( isset( $this->legacyData[$lang]['messages'] ) ) {
-                               $this->legacyData[$lang]['messages'] = 
-                                       $langMessages + $this->legacyData[$lang]['messages'];
-                       } else {
-                               $this->legacyData[$lang]['messages'] = $langMessages;
-                       }
-               }
-       }
-
        /**
         * Disable the storage backend
         */
@@ -722,24 +702,24 @@ interface LCStore {
         * @param $code Language code
         * @param $key Cache key
         */
-       public function get( $code, $key );
+       function get( $code, $key );
 
        /**
         * Start a write transaction.
         * @param $code Language code
         */
-       public function startWrite( $code );
+       function startWrite( $code );
 
        /**
         * Finish a write transaction.
         */
-       public function finishWrite();
+       function finishWrite();
 
        /**
         * Set a key to a given value. startWrite() must be called before this
         * is called, and finishWrite() must be called afterwards.
         */
-       public function set( $key, $value );
+       function set( $key, $value );
 
 }