From 834899a9cfeace376d91867021fbe04fa249b280 Mon Sep 17 00:00:00 2001 From: Platonides Date: Thu, 10 Feb 2011 18:15:58 +0000 Subject: [PATCH] Move LanguageGetMagic hook to its own function --- languages/Language.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) 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 { -- 2.20.1