r95876 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r95875‎ | r95876 | r95877 >
Date:15:26, 31 August 2011
Author:jeroendedauw
Status:ok
Tags:
Comment:
fallback to en when current lang not available
Modified paths:
  • /trunk/extensions/UploadWizard/includes/specials/SpecialUploadWizard.php (modified) (history)

Diff [purge]

Index: trunk/extensions/UploadWizard/includes/specials/SpecialUploadWizard.php
@@ -176,16 +176,21 @@
177177 *
178178 * @param string $pageName
179179 * @param boolean $parse
 180+ * @param string $langCode
180181 *
181182 * @return string|false
182183 */
183 - protected function getPageContent( $pageName, $parse = false ) {
 184+ protected function getPageContent( $pageName, $parse = false, $langCode = null ) {
184185 $content = false;
185186
186187 if ( trim( $pageName ) != '' ) {
187 - global $wgLang;
188 - $page = Title::newFromText( str_replace( '$1', $wgLang->getCode(), $pageName ) );
 188+ if ( is_null( $langCode ) ) {
 189+ global $wgLang;
 190+ $langCode = $wgLang->getCode();
 191+ }
189192
 193+ $page = Title::newFromText( str_replace( '$1', $langCode, $pageName ) );
 194+
190195 if ( !is_null( $page ) && $page->exists() ) {
191196 $article = new Article( $page, 0 );
192197 $content = $article->getContent();
@@ -196,6 +201,11 @@
197202 }
198203 }
199204
 205+ // If no page was found, and the lang is not en, then see if there in an en version.
 206+ if ( $content === false && $langCode != 'en' ) {
 207+ $content = $this->getPageContent( $pageName, $parse, 'en' );
 208+ }
 209+
200210 return $content;
201211 }
202212

Follow-up revisions

RevisionCommit summaryAuthorDate
r958871.17wmf1: MFT UploadWizard fixes r95691, r95726, r95727, r95793, r95815, r958...catrope17:10, 31 August 2011

Status & tagging log