+ # Update caches
+ $this->saveToCaches( $this->mCache[$code], true, $code );
+ $this->unlock( $cacheKey );
+
+ // Also delete cached sidebar... just in case it is affected
+ $codes = array( $code );
+ if ( $code === 'en' ) {
+ // Delete all sidebars, like for example on action=purge on the
+ // sidebar messages
+ $codes = array_keys( Language::getLanguageNames() );
+ }
+
+ global $parserMemc;
+ foreach ( $codes as $code ) {
+ $sidebarKey = wfMemcKey( 'sidebar', $code );
+ $parserMemc->delete( $sidebarKey );
+ }
+
+ // Update the message in the message blob store
+ global $wgContLang;
+ MessageBlobStore::updateMessage( $wgContLang->lcfirst( $msg ) );
+
+ wfRunHooks( "MessageCacheReplace", array( $title, $text ) );
+
+ wfProfileOut( __METHOD__ );
+ }
+
+ /**
+ * Shortcut to update caches.
+ *
+ * @param $cache Array: cached messages with a version.
+ * @param $memc Bool: Wether to update or not memcache.
+ * @param $code String: Language code.
+ * @return False on somekind of error.
+ */
+ protected function saveToCaches( $cache, $memc = true, $code = false ) {