r101389 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r101388‎ | r101389 | r101390 >
Date:19:27, 31 October 2011
Author:preilly
Status:ok (Comments)
Tags:
Comment:
Modified paths:
  • /branches/wmf/1.18wmf1/extensions/MobileFrontend/MobileFrontend.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.18wmf1/extensions/MobileFrontend/MobileFrontend.php
@@ -344,31 +344,30 @@
345345 'lang' => $wgLanguageCode,
346346 );
347347
348 - foreach( $wgOut->getLanguageLinks() as $l ) {
349 - if ( preg_match( '!^(\w[-\w]*\w):(.+)$!', $l, $m ) ) {
350 - $lang = $m[1];
351 - $linkText = $m[2];
352 - } else {
353 - continue; //NOTE: shouldn't happen
354 - }
355 -
 348+ foreach( $wgOut->getLanguageLinks() as $l ) {
 349+ $tmp = explode( ':', $l, 2 );
 350+ $class = 'interwiki-' . $tmp[0];
 351+ $lang = $tmp[0];
 352+ unset( $tmp );
356353 $nt = Title::newFromText( $l );
357 - $parsedUrl = wfParseUrl( $nt->getFullURL() );
358 - if ( stristr( $parsedUrl['host'], $wgMobileDomain ) === false ) {
359 - $hostParts = explode( '.', $parsedUrl['host'] );
360 - $parsedUrl['host'] = $hostParts[0] . $wgMobileDomain . $hostParts[1] . '.' . $hostParts[2];
361 - }
362 - $fragmentDelimiter = ( !empty( $parsedUrl['fragment'] ) ) ? '#' : '';
363 - $queryDelimiter = ( !empty( $parsedUrl['query'] ) ) ? '?' : '';
364 - $languageUrl = $parsedUrl['scheme'] . $parsedUrl['delimiter'] . $parsedUrl['host'] . $parsedUrl['path'] . $queryDelimiter . $parsedUrl['query'] . $fragmentDelimiter . $parsedUrl['fragment'];
 354+ if ( $nt ) {
 355+ $parsedUrl = wfParseUrl( $nt->getFullURL() );
 356+ if ( stristr( $parsedUrl['host'], $wgMobileDomain ) === false ) {
 357+ $hostParts = explode( '.', $parsedUrl['host'] );
 358+ $parsedUrl['host'] = $hostParts[0] . $wgMobileDomain . $hostParts[1] . '.' . $hostParts[2];
 359+ }
 360+ $fragmentDelimiter = ( !empty( $parsedUrl['fragment'] ) ) ? '#' : '';
 361+ $queryDelimiter = ( !empty( $parsedUrl['query'] ) ) ? '?' : '';
 362+ $languageUrl = $parsedUrl['scheme'] . $parsedUrl['delimiter'] . $parsedUrl['host'] . $parsedUrl['path'] . $queryDelimiter . $parsedUrl['query'] . $fragmentDelimiter . $parsedUrl['fragment'];
365363
366 - $languageUrls[] = array(
367 - 'href' => $languageUrl,
368 - 'text' => $linkText,
369 - 'language' => $wgContLang->getLanguageName( $lang ),
370 - 'class' => 'interwiki-' . $lang,
371 - 'lang' => $lang,
372 - );
 364+ $languageUrls[] = array(
 365+ 'href' => $languageUrl,
 366+ 'text' => ( $wgContLang->getLanguageName( $nt->getInterwiki() ) != '' ? $wgContLang->getLanguageName( $nt->getInterwiki() ) : $l ),
 367+ 'language' => $wgContLang->getLanguageName( $lang ),
 368+ 'class' => $class,
 369+ 'lang' => $lang,
 370+ );
 371+ }
373372 }
374373
375374 self::$languageUrls = $languageUrls;

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r101388fix main page interwiki linkspreilly19:26, 31 October 2011

Comments

#Comment by Krinkle (talk | contribs)   19:31, 31 October 2011

Please make note of the target branch in the commit message for easier follow-up reading

#Comment by Preilly (talk | contribs)   19:52, 31 October 2011

So, will something like this work, "mft r101388 to the 1.18wmf1 branch"?

#Comment by Krinkle (talk | contribs)   20:39, 31 October 2011

yes, or simply "1.18wmf1: MFT r1, r1"

#Comment by 😂 (talk | contribs)   22:31, 7 November 2011

Why is a deployment merge tagged for 1.18?

#Comment by Preilly (talk | contribs)   22:33, 7 November 2011

It isn't now — that was a mistake.

Status & tagging log