jenkins-bot has submitted this change and it was merged.

Change subject: Move 'main page as default title' further down to unbreak diff 
urls
......................................................................


Move 'main page as default title' further down to unbreak diff urls

The feature that oldid and diff parameters override the title was
not working if wiki's main page is a special page, because that
behaviour was excluded for special pages. Hence moved the main
page as default title code further down, so that we will hit the
no title provided condition for the oldid and diff parameter only
links.

Bug: 54452
Change-Id: I62cc6e2568a4db988fcf113955ba02710e42a1d2
---
M includes/Wiki.php
1 file changed, 11 insertions(+), 4 deletions(-)

Approvals:
  Aaron Schulz: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/Wiki.php b/includes/Wiki.php
index 0683d7c..32c51db 100644
--- a/includes/Wiki.php
+++ b/includes/Wiki.php
@@ -85,8 +85,6 @@
                } elseif ( $curid ) {
                        // URLs like this are generated by RC, because rc_title 
isn't always accurate
                        $ret = Title::newFromID( $curid );
-               } elseif ( $title == '' && $action != 'delete' ) {
-                       $ret = Title::newMainPage();
                } else {
                        $ret = Title::newFromURL( $title );
                        // Alias NS_MEDIA page URLs to NS_FILE...we only use 
NS_MEDIA
@@ -102,8 +100,12 @@
                                $wgContLang->findVariantLink( $title, $ret );
                        }
                }
-               // For non-special titles, check for implicit titles
-               if ( is_null( $ret ) || !$ret->isSpecialPage() ) {
+
+               // If title is not provided, always allow oldid and diff to set 
the title.
+               // If title is provided, allow oldid and diff to override the 
title, unless
+               // we are talking about a special page which might use these 
parameters for
+               // other purposes.
+               if ( $ret === null || !$ret->isSpecialPage() ) {
                        // We can have urls with just ?diff=,?oldid= or even 
just ?diff=
                        $oldid = $request->getInt( 'oldid' );
                        $oldid = $oldid ? $oldid : $request->getInt( 'diff' );
@@ -114,6 +116,11 @@
                        }
                }
 
+               // Use the main page as default title if nothing else has been 
provided
+               if ( $ret === null && strval( $title ) === '' && $action !== 
'delete' ) {
+                       $ret = Title::newMainPage();
+               }
+
                if ( $ret === null || ( $ret->getDBkey() == '' && 
$ret->getInterwiki() == '' ) ) {
                        $ret = SpecialPage::getTitleFor( 'Badtitle' );
                }

-- 
To view, visit https://gerrit.wikimedia.org/r/86381
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I62cc6e2568a4db988fcf113955ba02710e42a1d2
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Nikerabbit <[email protected]>
Gerrit-Reviewer: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Amire80 <[email protected]>
Gerrit-Reviewer: Nikerabbit <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to