r65958 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r65957‎ | r65958 | r65959 >
Date:19:00, 5 May 2010
Author:kipcool
Status:deferred
Tags:
Comment:
Automatically find a page in the user language when it exists.
Modified paths:
  • /trunk/extensions/Wikidata/App.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Wikidata/App.php
@@ -252,7 +252,25 @@
253253 }
254254
255255 function efWikidataOverrideArticle( &$title, &$article ) {
256 - if ( wdIsWikidataNs() ) $article = new WikidataArticle( $title );
 256+ global $wgLang, $wgRequest, $wgOut ;
 257+ if ( wdIsWikidataNs() ) {
 258+ $article = new WikidataArticle( $title );
 259+ return true ;
 260+ }
 261+
 262+ if ($wgRequest->getVal( 'redirect' ) == 'no') {
 263+ return true;
 264+ }
 265+
 266+ // finds if there is a translation of the page in the user language
 267+ $lang = $wgLang->getCode();
 268+ $n = $title->getDBkey();
 269+ $ns = $title->getNamespace();
 270+ $t = Title::makeTitle( $ns, $n . '/' . $lang );
 271+
 272+ if ( $t->exists() ) {
 273+ $title = $t ;
 274+ }
257275 return true;
258276 }
259277

Status & tagging log