From 9663eda28f614bd7662204acdf63d4c920b0cb75 Mon Sep 17 00:00:00 2001 From: DannyS712 Date: Mon, 8 Jul 2019 03:28:45 +0000 Subject: [PATCH] Make Special:MovePage note about redirects dependent on content model Some content models don't support redirects; when moving a page with a content model that doesn't support redirects, the note that "The old title will become a redirect page to the new title." should not be shown. Bug: T216900 Change-Id: I70b33859a3da881d411929cf829edd2981854cbb --- includes/specials/SpecialMovepage.php | 18 +++++++++++------- languages/i18n/en.json | 1 + languages/i18n/qqq.json | 1 + 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/includes/specials/SpecialMovepage.php b/includes/specials/SpecialMovepage.php index ecbbc25bca..161b41ad0a 100644 --- a/includes/specials/SpecialMovepage.php +++ b/includes/specials/SpecialMovepage.php @@ -150,10 +150,16 @@ class MovePageForm extends UnlistedSpecialPage { $out->addModules( 'mediawiki.misc-authed-ooui' ); $this->addHelpLink( 'Help:Moving a page' ); - $out->addWikiMsg( $this->getConfig()->get( 'FixDoubleRedirects' ) ? - 'movepagetext' : - 'movepagetext-noredirectfixer' - ); + $handlerSupportsRedirects = ContentHandler::getForTitle( $this->oldTitle ) + ->supportsRedirects(); + + if ( $this->getConfig()->get( 'FixDoubleRedirects' ) ) { + $out->addWikiMsg( 'movepagetext' ); + } else { + $out->addWikiMsg( $handlerSupportsRedirects ? + 'movepagetext-noredirectfixer' : + 'movepagetext-noredirectsupport' ); + } if ( $this->oldTitle->getNamespace() == NS_USER && !$this->oldTitle->isSubpage() ) { $out->wrapWikiMsg( @@ -306,8 +312,6 @@ class MovePageForm extends UnlistedSpecialPage { } } - $handler = ContentHandler::getForTitle( $this->oldTitle ); - $out->enableOOUI(); $fields = []; @@ -371,7 +375,7 @@ class MovePageForm extends UnlistedSpecialPage { } if ( $user->isAllowed( 'suppressredirect' ) ) { - if ( $handler->supportsRedirects() ) { + if ( $handlerSupportsRedirects ) { $isChecked = $this->leaveRedirect; $isDisabled = false; } else { diff --git a/languages/i18n/en.json b/languages/i18n/en.json index 0da5c5fc45..2ec5308844 100644 --- a/languages/i18n/en.json +++ b/languages/i18n/en.json @@ -2780,6 +2780,7 @@ "move-page-legend": "Move page", "movepagetext": "Using the form below will rename a page, moving all of its history to the new name.\nThe old title will become a redirect page to the new title.\nYou can update redirects that point to the original title automatically.\nIf you choose not to, be sure to check for [[Special:DoubleRedirects|double]] or [[Special:BrokenRedirects|broken redirects]].\nYou are responsible for making sure that links continue to point where they are supposed to go.\n\nNote that the page will not be moved if there is already a page at the new title, unless the latter is a redirect and has no past edit history.\nThis means that you can rename a page back to where it was renamed from if you make a mistake, and you cannot overwrite an existing page.\n\nNote:\nThis can be a drastic and unexpected change for a popular page;\nplease be sure you understand the consequences of this before proceeding.", "movepagetext-noredirectfixer": "Using the form below will rename a page, moving all of its history to the new name.\nThe old title will become a redirect page to the new title.\nBe sure to check for [[Special:DoubleRedirects|double]] or [[Special:BrokenRedirects|broken redirects]].\nYou are responsible for making sure that links continue to point where they are supposed to go.\n\nNote that the page will not be moved if there is already a page at the new title, unless it is a redirect and has no past edit history.\nThis means that you can rename a page back to where it was renamed from if you make a mistake, and you cannot overwrite an existing page.\n\nNote:\nThis can be a drastic and unexpected change for a popular page;\nplease be sure you understand the consequences of this before proceeding.", + "movepagetext-noredirectsupport": "Using the form below will rename a page, moving all of its history to the new name.\nYou are responsible for making sure that links continue to point where they are supposed to go.\n\nNote that the page will not be moved if there is already a page at the new title.\nThis means that you can rename a page back to where it was renamed from if you make a mistake, and you cannot overwrite an existing page.\n\nNote:\nThis can be a drastic and unexpected change for a popular page;\nplease be sure you understand the consequences of this before proceeding.", "movepagetalktext": "If you check this box, the associated talk page will be automatically moved to new title, unless a non-empty talk page already exists there.\n\nIn this case, you will have to move or merge the page manually if desired.", "moveuserpage-warning": "Warning: You are about to move a user page. Please note that only the page will be moved and the user will not be renamed.", "movecategorypage-warning": "Warning: You are about to move a category page. Please note that only the page will be moved and any pages in the old category will not be recategorized into the new one.", diff --git a/languages/i18n/qqq.json b/languages/i18n/qqq.json index 39b462ab08..0e71d06168 100644 --- a/languages/i18n/qqq.json +++ b/languages/i18n/qqq.json @@ -2989,6 +2989,7 @@ "move-page-legend": "Legend of the fieldset around the input form of [[Special:MovePage/testpage]].\n\nSee also:\n* {{msg-mw|newtitle|label for new title}}\n* {{msg-mw|movereason|label for textarea}}\n* {{msg-mw|movetalk|label for checkbox}}\n* {{msg-mw|move-leave-redirect|label for checkbox}}\n* {{msg-mw|fix-double-redirects|label for checkbox}}\n* {{msg-mw|move-subpages|label for checkbox}}\n* {{msg-mw|move-talk-subpages|label for checkbox}}\n* {{msg-mw|move-watch|label for checkbox}}\n{{Identical|Move page}}", "movepagetext": "Introduction shown when moving a page ([[Special:MovePage]]).\n\nSpecial pages mentioned: {{msg-mw|Doubleredirects}}, {{msg-mw|Brokenredirects}}\n\nSee also:\n* {{msg-mw|Movepagetext-noredirectfixer}}", "movepagetext-noredirectfixer": "A variant of the following message ''Movepagetext'' displayed when the automatic redirect fixer is not enabled.\n\nSpecial pages mentioned: {{msg-mw|Doubleredirects}}, {{msg-mw|Brokenredirects}}\n\nSee also:\n* {{msg-mw|Movepagetext}}", + "movepagetext-noredirectsupport": "A variant of the following message ''Movepagetext'' displayed when the content model of the page being moved does not support redirects.\n\nSee also:\n* {{msg-mw|Movepagetext}}", "movepagetalktext": "Text on the special 'Move page'. This text only appears if the talk page is not empty.", "moveuserpage-warning": "Used as warning in [[Special:MovePage]], when moving a user page.", "movecategorypage-warning": "Used as warning in [[Special:MovePage]], when moving a category page.", -- 2.20.1