(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).
This commit is contained in:
Nick Jenkins 2007-05-03 06:08:12 +00:00
parent 84c10464d1
commit 1a60bd4c84
4 changed files with 15 additions and 13 deletions

View 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

View 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;
}
}

View 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 */

View 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 ) {