From: Platonides Date: Thu, 10 Feb 2011 18:15:58 +0000 (+0000) Subject: Move LanguageGetMagic hook to its own function X-Git-Tag: 1.31.0-rc.0~32061 X-Git-Url: http://git.cyclocoop.org/%24self?a=commitdiff_plain;h=834899a9cfeace376d91867021fbe04fa249b280;p=lhc%2Fweb%2Fwiklou.git Move LanguageGetMagic hook to its own function --- diff --git a/languages/Language.php b/languages/Language.php index 9631ce2fa7..07e3619213 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -2095,14 +2095,20 @@ class Language { return self::$dataCache->getItem( $this->mCode, 'magicWords' ); } + protected function doMagicHook() { + if ( $this->mMagicHookDone ) { + return; + } + $this->mMagicHookDone = true; + wfProfileIn( 'LanguageGetMagic' ); + wfRunHooks( 'LanguageGetMagic', array( &$this->mMagicExtensions, $this->getCode() ) ); + wfProfileOut( 'LanguageGetMagic' ); + } + # Fill a MagicWord object with data from here function getMagic( $mw ) { - if ( !$this->mMagicHookDone ) { - $this->mMagicHookDone = true; - wfProfileIn( 'LanguageGetMagic' ); - wfRunHooks( 'LanguageGetMagic', array( &$this->mMagicExtensions, $this->getCode() ) ); - wfProfileOut( 'LanguageGetMagic' ); - } + $this->doMagicHook(); + if ( isset( $this->mMagicExtensions[$mw->mId] ) ) { $rawEntry = $this->mMagicExtensions[$mw->mId]; } else {