From: Kevin Israel Date: Fri, 12 Dec 2014 07:49:46 +0000 (-0500) Subject: EditPage: Don't warn if the page already redirects to itself X-Git-Tag: 1.31.0-rc.0~12954 X-Git-Url: http://git.cyclocoop.org/fichier?a=commitdiff_plain;h=9c2fb8b722e8036898abbc3dfd5e919383d201cd;p=lhc%2Fweb%2Fwiklou.git EditPage: Don't warn if the page already redirects to itself Follows-up 02660685708747d5. Also improved the wording of the "selfredirect" message. Change-Id: I89a4647c03ccc31db4812dedac107869b2721833 --- diff --git a/includes/EditPage.php b/includes/EditPage.php index 2155c1b237..d05b996388 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -1928,11 +1928,15 @@ class EditPage { && $content->isRedirect() && $content->getRedirectTarget()->equals( $this->getTitle() ) ) { - $this->selfRedirect = true; - $status->fatal( 'selfredirect' ); - $status->value = self::AS_SELF_REDIRECT; - wfProfileOut( __METHOD__ ); - return $status; + // If the page already redirects to itself, don't warn. + $currentTarget = $this->getCurrentContent()->getRedirectTarget(); + if ( !$currentTarget || !$currentTarget->equals( $this->getTitle() ) ) { + $this->selfRedirect = true; + $status->fatal( 'selfredirect' ); + $status->value = self::AS_SELF_REDIRECT; + wfProfileOut( __METHOD__ ); + return $status; + } } // Check for length errors again now that the section is merged in diff --git a/languages/i18n/en.json b/languages/i18n/en.json index 583fc5d328..631872a893 100644 --- a/languages/i18n/en.json +++ b/languages/i18n/en.json @@ -590,7 +590,7 @@ "anoneditwarning": "Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you [$1 log in] or [$2 create an account], your edits will be attributed to your username, along with other benefits.", "anonpreviewwarning": "You are not logged in. Saving will record your IP address in this page's edit history.", "missingsummary": "Reminder: You have not provided an edit summary.\nIf you click \"{{int:savearticle}}\" again, your edit will be saved without one.", - "selfredirect": "Warning: You are creating redirect to the same article.\nIf you click \"{{int:savearticle}}\" again, the redirect will be created.", + "selfredirect": "Warning: You are redirecting this page to itself.\nYou may have specified the wrong target for the redirect, or you may be editing the wrong page.\nIf you click \"{{int:savearticle}}\" again, the redirect will be created anyway.", "missingcommenttext": "Please enter a comment below.", "missingcommentheader": "Reminder: You have not provided a subject/headline for this comment.\nIf you click \"{{int:savearticle}}\" again, your edit will be saved without one.", "summary-preview": "Summary preview:",