From: daniel Date: Mon, 29 Oct 2012 17:08:04 +0000 (+0100) Subject: (Bug 41493) Move PageContentLanguage hook to Content class X-Git-Tag: 1.31.0-rc.0~21763^2 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=d879e4227a59f740e1a73ec3315d580b54335402;p=lhc%2Fweb%2Fwiklou.git (Bug 41493) Move PageContentLanguage hook to Content class This change moves the PageContentLanguage hook from Title::getPageLanguage to Content::getPageLanguage, so the hook is no longer bypassed by Content::getPageViewLanguage and consequently Title::getPageViewLanguage. Change-Id: I51dabe9aee9d544483e7416a8fdf7721638d21bf --- diff --git a/includes/Title.php b/includes/Title.php index 00fdc3a469..9ec6ec935f 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -4701,8 +4701,6 @@ class Title { $contentHandler = ContentHandler::getForTitle( $this ); $pageLang = $contentHandler->getPageLanguage( $this ); - // Hook at the end because we don't want to override the above stuff - wfRunHooks( 'PageContentLanguage', array( $this, &$pageLang, $wgLang ) ); return wfGetLangObj( $pageLang ); } diff --git a/includes/content/ContentHandler.php b/includes/content/ContentHandler.php index 8e8de4b1ec..ee2f2eda51 100644 --- a/includes/content/ContentHandler.php +++ b/includes/content/ContentHandler.php @@ -607,15 +607,17 @@ abstract class ContentHandler { * @return Language the page's language */ public function getPageLanguage( Title $title, Content $content = null ) { - global $wgContLang; + global $wgContLang, $wgLang; + $pageLang = $wgContLang; if ( $title->getNamespace() == NS_MEDIAWIKI ) { // Parse mediawiki messages with correct target language list( /* $unused */, $lang ) = MessageCache::singleton()->figureMessage( $title->getText() ); - return wfGetLangObj( $lang ); + $pageLang = wfGetLangObj( $lang ); } - return $wgContLang; + wfRunHooks( 'PageContentLanguage', array( $title, &$pageLang, $wgLang ) ); + return wfGetLangObj( $pageLang ); } /**