Index: trunk/extensions/UploadWizard/includes/specials/SpecialUploadWizard.php |
— | — | @@ -49,12 +49,25 @@ |
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
| 53 | + * Shortcut to get user's language. |
| 54 | + * This overrides the getLang method of Specialpage added in MediaWiki 1.18, |
| 55 | + * and returns $wgLang for older versions. |
| 56 | + * |
| 57 | + * @since 0.1 |
| 58 | + * |
| 59 | + * @return Language |
| 60 | + */ |
| 61 | + public function getLang() { |
| 62 | + return version_compare( $GLOBALS['wgVersion'], '1.18', '>=' ) ? parent::getLang() : $GLOBALS['wgLang']; |
| 63 | + } |
| 64 | + |
| 65 | + /** |
53 | 66 | * Replaces default execute method |
54 | 67 | * Checks whether uploading enabled, user permissions okay, |
55 | 68 | * @param $subPage, e.g. the "foo" in Special:UploadWizard/foo. |
56 | 69 | */ |
57 | 70 | public function execute( $subPage ) { |
58 | | - global $wgRequest, $wgLang, $wgUser; |
| 71 | + global $wgRequest, $wgUser; |
59 | 72 | |
60 | 73 | // side effects: if we can't upload, will print error page to wgOut |
61 | 74 | // and return false |
— | — | @@ -185,8 +198,7 @@ |
186 | 199 | |
187 | 200 | if ( trim( $pageName ) != '' ) { |
188 | 201 | if ( is_null( $langCode ) ) { |
189 | | - global $wgLang; |
190 | | - $langCode = $wgLang->getCode(); |
| 202 | + $langCode = $this->getLang()->getCode(); |
191 | 203 | } |
192 | 204 | |
193 | 205 | $page = Title::newFromText( str_replace( '$1', $langCode, $pageName ) ); |