From: Sam Reed Date: Mon, 8 Mar 2010 22:26:59 +0000 (+0000) Subject: Restore $wgLang in ApiQueryAllmessages if changed during execution X-Git-Tag: 1.31.0-rc.0~37510 X-Git-Url: http://git.cyclocoop.org/%40spipnet%40?a=commitdiff_plain;h=7dc022fd1febabd988524a046eb83cfaeafdbc65;p=lhc%2Fweb%2Fwiklou.git Restore $wgLang in ApiQueryAllmessages if changed during execution --- diff --git a/includes/api/ApiQueryAllmessages.php b/includes/api/ApiQueryAllmessages.php index da5db4fc27..114bf7f742 100644 --- a/includes/api/ApiQueryAllmessages.php +++ b/includes/api/ApiQueryAllmessages.php @@ -42,8 +42,10 @@ class ApiQueryAllmessages extends ApiQueryBase { public function execute() { $params = $this->extractRequestParams(); + global $wgLang; + if ( !is_null( $params['lang'] ) ) { - global $wgLang; + $oldLang = $wgLang; //Keep $wgLang for restore later $wgLang = Language::factory( $params['lang'] ); } @@ -120,6 +122,10 @@ class ApiQueryAllmessages extends ApiQueryBase { } } $result->setIndexedTagName_internal( array( 'query', $this->getModuleName() ), 'message' ); + + if ( !is_null( $params['lang'] ) ) { + $wgLang = $oldLang; //Restore $oldLang + } } public function getAllowedParams() {