Index: trunk/phase3/includes/api/ApiParse.php |
— | — | @@ -55,6 +55,7 @@ |
56 | 56 | global $wgParser, $wgUser, $wgTitle, $wgEnableParserCache, $wgLang; |
57 | 57 | |
58 | 58 | //Current unncessary, code to act as a safeguard against any change in current behaviour of uselang breaks |
| 59 | + $oldLang = null; |
59 | 60 | if ( isset( $params['uselang'] ) && $params['uselang'] != $wgLang->getCode() ) { |
60 | 61 | $oldLang = $wgLang; //Backup wgLang |
61 | 62 | $wgLang = Language::factory( $params['uselang'] ); |
— | — | @@ -212,7 +213,7 @@ |
213 | 214 | $this->setIndexedTagNames( $result_array, $result_mapping ); |
214 | 215 | $result->addValue( null, $this->getModuleName(), $result_array ); |
215 | 216 | |
216 | | - if ( isset( $params['uselang'] ) ) { |
| 217 | + if ( !is_null( $oldLang ) ) { |
217 | 218 | $wgLang = $oldLang; //Reset $wgLang to $oldLang |
218 | 219 | } |
219 | 220 | } |
Index: trunk/phase3/includes/api/ApiQueryAllmessages.php |
— | — | @@ -44,7 +44,8 @@ |
45 | 45 | |
46 | 46 | global $wgLang; |
47 | 47 | |
48 | | - if ( !is_null( $params['lang'] ) ) { |
| 48 | + $oldLang = null; |
| 49 | + if ( !is_null( $params['lang'] ) && $params['lang'] != $wgLang->getCode() ) { |
49 | 50 | $oldLang = $wgLang; //Keep $wgLang for restore later |
50 | 51 | $wgLang = Language::factory( $params['lang'] ); |
51 | 52 | } |
— | — | @@ -123,7 +124,7 @@ |
124 | 125 | } |
125 | 126 | $result->setIndexedTagName_internal( array( 'query', $this->getModuleName() ), 'message' ); |
126 | 127 | |
127 | | - if ( !is_null( $params['lang'] ) ) { |
| 128 | + if ( !is_null( $oldLang ) ) { |
128 | 129 | $wgLang = $oldLang; //Restore $oldLang |
129 | 130 | } |
130 | 131 | } |