From 1a60bd4c8434f9838c8eaf17d3f3218a916982a1 Mon Sep 17 00:00:00 2001 From: Nick Jenkins Date: Thu, 3 May 2007 06:08:12 +0000 Subject: [PATCH] (bug 7958) Special:Cite of older version of an article should use old version id. Applying Brion's patch, with one-line tweak: - uses the existing Skin/$wgOut-based revision ID record, rather than oldid value from WebRequest. - additionally sets it to the current revision for parser cache hits (where it was not previously needed, since it was only used to feed to parser objects to fill the {{REVISIONID}} variable). - Explicit declaration of the existing $mRevisionId data member in Skin. - "Permanent link" should now work too when paging through historical versions (previously it would be greyed out when paging backwards or forwards through old revisions). --- RELEASE-NOTES | 6 +++++- includes/Article.php | 3 +++ includes/Skin.php | 1 + includes/SkinTemplate.php | 18 ++++++------------ 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index b3a0d183a4..ef530ec0ba 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -373,7 +373,11 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 7629) Fix $wgBrowserBlackList to avoid false positive on MSIE when certain plugins are present which alter the user agent * (bug 9712) Use Arabic comma in date/time formats for Arabic and Farsi -* (bug 9670) Follow redirects when render edit section links to transcluded templates. +* (bug 9670) Follow redirects when render edit section links to transcluded + templates. +* (bug 7958) Special:Cite of older version of an article should use old + version id. + == Maintenance == * New script maintenance/language/checkExtensioni18n.php used to check i18n diff --git a/includes/Article.php b/includes/Article.php index 0130cebabc..a2f8b3b005 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -721,6 +721,9 @@ class Article { wfRunHooks( 'ArticleViewHeader', array( &$this ) ); if ( $pcache ) { if ( $wgOut->tryParserCache( $this, $wgUser ) ) { + // Ensure that UI elements requiring revision ID have + // the correct version information. + $wgOut->setRevisionId( $this->mLatest ); $outputDone = true; } } diff --git a/includes/Skin.php b/includes/Skin.php index 0ca95f7ecc..0e3e4aa2c1 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -22,6 +22,7 @@ class Skin extends Linker { var $rcMoveIndex; var $mWatchLinkNum = 0; // Appended to end of watch link id's /**#@-*/ + protected $mRevisionId; // The revision ID we're looking at, null if not applicable. protected $skinname = 'standard' ; /** Constructor, call parent constructor */ diff --git a/includes/SkinTemplate.php b/includes/SkinTemplate.php index cddd219546..1929ff85ba 100644 --- a/includes/SkinTemplate.php +++ b/includes/SkinTemplate.php @@ -822,7 +822,6 @@ class SkinTemplate extends Skin { global $wgEnableUploads, $wgUploadNavigationUrl; $action = $wgRequest->getText( 'action' ); - $oldid = $wgRequest->getVal( 'oldid' ); $nav_urls = array(); $nav_urls['mainpage'] = array( 'href' => self::makeMainPageUrl() ); @@ -852,21 +851,16 @@ class SkinTemplate extends Skin { ); // Also add a "permalink" while we're at it - if ( (int)$oldid ) { + if ( $this->mRevisionId ) { $nav_urls['permalink'] = array( 'text' => wfMsg( 'permalink' ), - 'href' => '' + 'href' => $wgTitle->getLocalURL( "oldid=$this->mRevisionId" ) ); - } else { - $revid = $wgArticle ? $wgArticle->getLatest() : 0; - if ( !( $revid == 0 ) ) - $nav_urls['permalink'] = array( - 'text' => wfMsg( 'permalink' ), - 'href' => $wgTitle->getLocalURL( "oldid=$revid" ) - ); } - - wfRunHooks( 'SkinTemplateBuildNavUrlsNav_urlsAfterPermalink', array( &$this, &$nav_urls, &$oldid, &$revid ) ); + + // Copy in case this undocumented, shady hook tries to mess with internals + $revid = $this->mRevisionId; + wfRunHooks( 'SkinTemplateBuildNavUrlsNav_urlsAfterPermalink', array( &$this, &$nav_urls, &$revid, &$revid ) ); } if( $this->mTitle->getNamespace() != NS_SPECIAL ) { -- 2.20.1