(bug 7958) Special:Cite of older version of an article should use old version id.
authorNick Jenkins <nickj@users.mediawiki.org>
Thu, 3 May 2007 06:08:12 +0000 (06:08 +0000)
committerNick Jenkins <nickj@users.mediawiki.org>
Thu, 3 May 2007 06:08:12 +0000 (06:08 +0000)
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
includes/Article.php
includes/Skin.php
includes/SkinTemplate.php

index b3a0d18..ef530ec 100644 (file)
@@ -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
index 0130ceb..a2f8b3b 100644 (file)
@@ -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;
                        }
                }
index 0ca95f7..0e3e4aa 100644 (file)
@@ -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 */
index cddd219..1929ff8 100644 (file)
@@ -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 ) {