From 05b21233ff5d9f1ccafc8560eaea942ba7203ed4 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 27 Jun 2007 15:30:43 +0000 Subject: [PATCH] * (bug 7071) Properly handle an 'oldid' passed to view or edit that doesn't match the given title. Fixes inconsistencies with talk, history, edit links. This reverts r23445 and moves the check upstream into the title setup at MediaWiki::checkInitialQueries(). As the most specific identifier which can be passed, the revision title listed for the oldid (if any) trumps both 'title' and 'curid' parameters. --- RELEASE-NOTES | 3 +++ includes/Article.php | 5 +---- includes/Wiki.php | 7 +++++++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 3baf3b913b..c450bf5a0e 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -218,6 +218,9 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * namespaceDupes.php should work better for initial-lowercase wikis * (bug 10377) "Permanent links" to revisions still work if the page is moved and the redirect deleted +* (bug 7071) Properly handle an 'oldid' passed to view or edit that doesn't + match the given title. Fixes inconsistencies with talk, history, edit links. + == API changes since 1.10 == diff --git a/includes/Article.php b/includes/Article.php index 50fca0b90e..5c325c5234 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -141,10 +141,7 @@ class Article { wfProfileIn( __METHOD__ ); - // We want to show the content even if the page doesn't exist, as long - // as the revision does (perhaps it's been moved and the redirect - // deleted: bug 10377) - if ( 0 == $this->getID() and !$this->mOldId ) { + if ( 0 == $this->getID() ) { wfProfileOut( __METHOD__ ); $wgOut->setRobotpolicy( 'noindex,nofollow' ); diff --git a/includes/Wiki.php b/includes/Wiki.php index 601a7227d3..a9537a744e 100644 --- a/includes/Wiki.php +++ b/includes/Wiki.php @@ -98,6 +98,13 @@ class MediaWiki { $lang->findVariantLink( $title, $ret ); } + if ( $oldid = $request->getInt( 'oldid' ) ) { + // Allow oldid to override a changed or missing title. + $rev = Revision::newFromId( $oldid ); + if( $rev ) { + $ret = $rev->getTitle(); + } + } return $ret ; } -- 2.20.1