+ # Invalidate all local caches
+ $this->mMemc->delete( "{$this->mMemcKey}-hash" );
+ }
+ }
+
+ function loadAllMessages() {
+ global $wgExtensionMessagesFiles;
+ if ( $this->mAllMessagesLoaded ) {
+ return;
+ }
+ $this->mAllMessagesLoaded = true;
+
+ # Some extensions will load their messages when you load their class file
+ wfLoadAllExtensions();
+ # Others will respond to this hook
+ wfRunHooks( 'LoadAllMessages' );
+ # Some register their messages in $wgExtensionMessagesFiles
+ foreach ( $wgExtensionMessagesFiles as $name => $file ) {
+ wfLoadExtensionMessages( $name );
+ }
+ # Still others will respond to neither, they are EVIL. We sometimes need to know!
+ }
+
+ /**
+ * Load messages from a given file
+ *
+ * @param string $filename Filename of file to load.
+ * @param string $langcode Language to load messages for, or false for
+ * default behvaiour (en, content language and user
+ * language).
+ */
+ function loadMessagesFile( $filename, $langcode = false ) {
+ global $wgLang, $wgContLang;
+ $messages = $magicWords = false;
+ require( $filename );
+
+ $validCodes = Language::getLanguageNames();
+ if( is_string( $langcode ) && array_key_exists( $langcode, $validCodes ) ) {
+ # Load messages for given language code.
+ $this->processMessagesArray( $messages, $langcode );
+ } elseif( is_string( $langcode ) && !array_key_exists( $langcode, $validCodes ) ) {
+ wfDebug( "Invalid language '$langcode' code passed to MessageCache::loadMessagesFile()" );
+ } else {
+ # Load only languages that are usually used, and merge all
+ # fallbacks, except English.
+ $langs = array_unique( array( 'en', $wgContLang->getCode(), $wgLang->getCode() ) );
+ foreach( $langs as $code ) {
+ $this->processMessagesArray( $messages, $code );
+ }
+ }
+
+ if ( $magicWords !== false ) {
+ global $wgContLang;
+ $wgContLang->addMagicWordsByLang( $magicWords );