From: James D. Forrester Date: Mon, 11 Jun 2018 23:50:41 +0000 (-0700) Subject: Drop the LanguageGetSpecialPageAliases and LanguageGetMagic hooks X-Git-Tag: 1.34.0-rc.0~3607^2 X-Git-Url: https://git.cyclocoop.org/admin/Duna?a=commitdiff_plain;h=77ddd5faf036f918d94825c1c6624a4c4e604685;p=lhc%2Fweb%2Fwiklou.git Drop the LanguageGetSpecialPageAliases and LanguageGetMagic hooks Deprecated since 1.16 and unused in known git. Bug: T199291 Change-Id: Idcaf1b2c24c64653f700be4fe810ed124ba4ab7c --- diff --git a/RELEASE-NOTES-1.33 b/RELEASE-NOTES-1.33 index ddccef5d31..3e7e49684a 100644 --- a/RELEASE-NOTES-1.33 +++ b/RELEASE-NOTES-1.33 @@ -97,6 +97,9 @@ because of Phabricator reports. that LoginSignupSpecialPage->getBCFieldDefinitions() is removed. * The 'jquery.localize' module, deprecated in 1.32, has been removed. Instead, use 'jquery.i18n'. +* The hooks LanguageGetSpecialPageAliases and LanguageGetMagic, deprecated since + 1.16, have now been removed. Instead, use $specialPageAliases or $magicWords + respectively in a $wgExtensionMessagesFiles file. * … === Deprecations in 1.33 === diff --git a/docs/hooks.txt b/docs/hooks.txt index 66967e0b37..14656fa7f6 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -1962,23 +1962,11 @@ $user: User the password is being validated for $code: The language code or the language we're looking for a messages file for &$file: The messages file path, you can override this to change the location. -'LanguageGetMagic': DEPRECATED since 1.16! Use $magicWords in a file listed in -$wgExtensionMessagesFiles instead. -Use this to define synonyms of magic words depending of the language -&$magicExtensions: associative array of magic words synonyms -$lang: language code (string) - 'LanguageGetNamespaces': Provide custom ordering for namespaces or remove namespaces. Do not use this hook to add namespaces. Use CanonicalNamespaces for that. &$namespaces: Array of namespaces indexed by their numbers -'LanguageGetSpecialPageAliases': DEPRECATED! Use $specialPageAliases in a file -listed in $wgExtensionMessagesFiles instead. -Use to define aliases of special pages names depending of the language -&$specialPageAliases: associative array of magic words synonyms -$lang: language code (string) - 'LanguageGetTranslatedLanguageNames': Provide translated language names. &$names: array of language code => language name $code: language of the preferred translations diff --git a/languages/Language.php b/languages/Language.php index 86f4505cc4..aa287e926a 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -58,7 +58,7 @@ class Language { public $mConverter; public $mVariants, $mCode, $mLoaded = false; - public $mMagicExtensions = [], $mMagicHookDone = false; + public $mMagicExtensions = []; private $mHtmlCode = null, $mParentLanguage = false; public $dateFormatStrings = []; @@ -3205,28 +3205,12 @@ class Language { return self::$dataCache->getItem( $this->mCode, 'magicWords' ); } - /** - * Run the LanguageGetMagic hook once. - */ - protected function doMagicHook() { - if ( $this->mMagicHookDone ) { - return; - } - $this->mMagicHookDone = true; - Hooks::run( 'LanguageGetMagic', [ &$this->mMagicExtensions, $this->getCode() ], '1.16' ); - } - /** * Fill a MagicWord object with data from here * * @param MagicWord $mw */ function getMagic( $mw ) { - // Saves a function call - if ( !$this->mMagicHookDone ) { - $this->doMagicHook(); - } - $rawEntry = $this->mMagicExtensions[$mw->mId] ?? self::$dataCache->getSubitem( $this->mCode, 'magicWords', $mw->mId ); @@ -3264,8 +3248,6 @@ class Language { // Initialise array $this->mExtendedSpecialPageAliases = self::$dataCache->getItem( $this->mCode, 'specialPageAliases' ); - Hooks::run( 'LanguageGetSpecialPageAliases', - [ &$this->mExtendedSpecialPageAliases, $this->getCode() ], '1.16' ); } return $this->mExtendedSpecialPageAliases; diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index 4c078a61d6..587f6ea4ad 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -207,8 +207,6 @@ $bookstoreList = [ * used aliases. The aliases SHOULD be sorted by the following convention: * 1. Local first, English last, then * 2. Most common first, least common last. - * - * This array can be modified at runtime with the LanguageGetMagic hook */ $magicWords = [ # ID CASE SYNONYMS @@ -388,9 +386,6 @@ $magicWords = [ * Alternate names of special pages. All names are case-insensitive. The first * listed alias will be used as the default. Aliases from the fallback * localisation (usually English) will be included by default. - * - * This array may be altered at runtime using the LanguageGetSpecialPageAliases - * hook. */ $specialPageAliases = [ 'Activeusers' => [ 'ActiveUsers' ], diff --git a/languages/messages/MessagesKk_arab.php b/languages/messages/MessagesKk_arab.php index 2ff8c61f74..d7154e9031 100644 --- a/languages/messages/MessagesKk_arab.php +++ b/languages/messages/MessagesKk_arab.php @@ -162,8 +162,6 @@ $dateFormats = [ * Please include the English words as synonyms. This allows people * from other wikis to contribute more easily. * Please don't remove deprecated values, them should be keeped for backward compatibility. - * - * This array can be modified at runtime with the LanguageGetMagic hook */ $magicWords = [ 'redirect' => [ '0', '#ايداۋ', '#АЙДАУ', '#REDIRECT' ],