r102116 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r102115‎ | r102116 | r102117 >
Date:20:25, 5 November 2011
Author:ialex
Status:resolved (Comments)
Tags:
Comment:
* Only call Title::getPageLanguage() when necessary, i.e. after "!$wgDisableLangConversion && $wgCanonicalLanguageLinks" check passed
* Removed creation of Special:Recentchanges' Title object and use Title::isSpecial() instead
Modified paths:
  • /trunk/phase3/includes/OutputPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/OutputPage.php
@@ -2895,28 +2895,29 @@
28962896 ) );
28972897 }
28982898
2899 - $lang = $this->getTitle()->getPageLanguage();
29002899
29012900 # Language variants
2902 - if ( !$wgDisableLangConversion && $wgCanonicalLanguageLinks
2903 - && $lang->hasVariants() ) {
 2901+ if ( !$wgDisableLangConversion && $wgCanonicalLanguageLinks ) {
 2902+ $lang = $this->getTitle()->getPageLanguage();
 2903+ if ( $lang->hasVariants() ) {
29042904
2905 - $urlvar = $lang->getURLVariant();
 2905+ $urlvar = $lang->getURLVariant();
29062906
2907 - if ( !$urlvar ) {
2908 - $variants = $lang->getVariants();
2909 - foreach ( $variants as $_v ) {
 2907+ if ( !$urlvar ) {
 2908+ $variants = $lang->getVariants();
 2909+ foreach ( $variants as $_v ) {
 2910+ $tags[] = Html::element( 'link', array(
 2911+ 'rel' => 'alternate',
 2912+ 'hreflang' => $_v,
 2913+ 'href' => $this->getTitle()->getLocalURL( '', $_v ) )
 2914+ );
 2915+ }
 2916+ } else {
29102917 $tags[] = Html::element( 'link', array(
2911 - 'rel' => 'alternate',
2912 - 'hreflang' => $_v,
2913 - 'href' => $this->getTitle()->getLocalURL( '', $_v ) )
2914 - );
 2918+ 'rel' => 'canonical',
 2919+ 'href' => $this->getTitle()->getCanonicalUrl()
 2920+ ) );
29152921 }
2916 - } else {
2917 - $tags[] = Html::element( 'link', array(
2918 - 'rel' => 'canonical',
2919 - 'href' => $this->getTitle()->getCanonicalUrl()
2920 - ) );
29212922 }
29222923 }
29232924
@@ -2964,9 +2965,6 @@
29652966 # like to promote instead of the RC feed (maybe like a "Recent New Articles"
29662967 # or "Breaking news" one). For this, we see if $wgOverrideSiteFeed is defined.
29672968 # If so, use it instead.
2968 -
2969 - $rctitle = SpecialPage::getTitleFor( 'Recentchanges' );
2970 -
29712969 if ( $wgOverrideSiteFeed ) {
29722970 foreach ( $wgOverrideSiteFeed as $type => $feedUrl ) {
29732971 // Note, this->feedLink escapes the url.
@@ -2976,11 +2974,11 @@
29772975 $this->msg( "site-{$type}-feed", $wgSitename )->text()
29782976 );
29792977 }
2980 - } elseif ( $this->getTitle()->getPrefixedText() != $rctitle->getPrefixedText() ) {
 2978+ } elseif ( !$this->getTitle()->isSpecial( 'Recentchanges' ) ) {
29812979 foreach ( $wgAdvertisedFeedTypes as $format ) {
29822980 $tags[] = $this->feedLink(
29832981 $format,
2984 - $rctitle->getLocalURL( "feed={$format}" ),
 2982+ $this->getTitle()->getLocalURL( "feed={$format}" ),
29852983 $this->msg( "site-{$format}-feed", $wgSitename )->text() # For grep: 'site-rss-feed', 'site-atom-feed'.
29862984 );
29872985 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r106773Fix for r102116: link feed to Special:Recentchanges, not current pageialex09:12, 20 December 2011

Comments

#Comment by MaxSem (talk | contribs)   09:09, 20 December 2011

This revision broke RecentChanges feed link:

  • Previously, it was /w/index.php?title=Special:RecentChanges&feed=atom
  • Now, it is /w/index.php?title=<current page name>&feed=atom which doesn't work.
#Comment by IAlex (talk | contribs)   09:12, 20 December 2011

Fixed in r106773.

Status & tagging log