From e84e1c416821a9fa90edf390d6769febd0769ee9 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Wed, 7 Jan 2009 13:23:12 +0000 Subject: [PATCH] Redo simple ?diff check code for setting the right title (bug 15233) --- includes/Wiki.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/includes/Wiki.php b/includes/Wiki.php index ce4ce67ec2..c34c6f821f 100644 --- a/includes/Wiki.php +++ b/includes/Wiki.php @@ -115,12 +115,15 @@ class MediaWiki { if( count( $wgContLang->getVariants() ) > 1 && !is_null( $ret ) && $ret->getArticleID() == 0 ) $wgContLang->findVariantLink( $title, $ret ); } - if( ( $oldid = $wgRequest->getInt( 'oldid' ) ) - && ( is_null( $ret ) || $ret->getNamespace() != NS_SPECIAL ) ) { - // Allow oldid to override a changed or missing title. - $rev = Revision::newFromId( $oldid ); - if( $rev ) { - $ret = $rev->getTitle(); + # For non-special titles, check for implicit titles + if( is_null( $ret ) || $ret->getNamespace() != NS_SPECIAL ) { + // We can have urls with just ?diff=,?oldid= or even just ?diff= + $oldid = $wgRequest->getInt( 'oldid' ); + $oldid = $oldid ? $oldid : $wgRequest->getInt( 'diff' ); + // Allow oldid to override a changed or missing title + if( $oldid ) { + $rev = Revision::newFromId( $oldid ); + $ret = $rev ? $rev->getTitle() : $ret; } } return $ret; -- 2.20.1