From 7ecf21c873e33eb972cfc12b170003745503623a Mon Sep 17 00:00:00 2001 From: =?utf8?q?E=CC=81tienne=20Beaule=CC=81?= Date: Thu, 31 Jul 2014 22:56:27 -0400 Subject: [PATCH] Add link to Special:PrefixIndex in delete dialog This change adds a warning to ?action=delete with a link to a Special:PrefixIndex of the page being deleted if the page being deleted has subpages. If there are less than 50 subpages, the exact count will be mentioned in the message. Bug: T32666 Change-Id: Ibd705ed77452a55f782ed855c676d7ee23e9ad61 --- includes/page/Article.php | 9 +++++++++ languages/i18n/en.json | 1 + languages/i18n/qqq.json | 1 + 3 files changed, 11 insertions(+) diff --git a/includes/page/Article.php b/includes/page/Article.php index 16328bcead..d13fb3c11e 100644 --- a/includes/page/Article.php +++ b/includes/page/Article.php @@ -1673,11 +1673,20 @@ class Article implements Page { $outputPage->setPageTitle( wfMessage( 'delete-confirm', $title->getPrefixedText() ) ); $outputPage->addBacklinkSubtitle( $title ); $outputPage->setRobotPolicy( 'noindex,nofollow' ); + $backlinkCache = $title->getBacklinkCache(); if ( $backlinkCache->hasLinks( 'pagelinks' ) || $backlinkCache->hasLinks( 'templatelinks' ) ) { $outputPage->wrapWikiMsg( "\n", 'deleting-backlinks-warning' ); } + + $subpageQueryLimit = 51; + $subpages = $title->getSubpages( $subpageQueryLimit ); + $subpageCount = count( $subpages ); + if ( $subpageCount > 0 ) { + $outputPage->wrapWikiMsg( "\n", + [ 'deleting-subpages-warning', Message::numParam( $subpageCount ) ] ); + } $outputPage->addWikiMsg( 'confirmdeletetext' ); Hooks::run( 'ArticleConfirmDelete', [ $this, $outputPage, &$reason ] ); diff --git a/languages/i18n/en.json b/languages/i18n/en.json index e0ac82960d..52645cb055 100644 --- a/languages/i18n/en.json +++ b/languages/i18n/en.json @@ -2262,6 +2262,7 @@ "delete-warning-toobig": "This page has a large edit history, over $1 {{PLURAL:$1|revision|revisions}}.\nDeleting it may disrupt database operations of {{SITENAME}};\nproceed with caution.", "deleteprotected": "You cannot delete this page because it has been protected.", "deleting-backlinks-warning": "Warning: [[Special:WhatLinksHere/{{FULLPAGENAME}}|Other pages]] link to or transclude the page you are about to delete.", + "deleting-subpages-warning": "Warning: The page you are about to delete has [[Special:PrefixIndex/{{FULLPAGENAME}}/|{{PLURAL:$1|a subpage|$1 subpages|51=over 50 subpages}}]].", "rollback": "Roll back edits", "rollbacklink": "rollback", "rollbacklinkcount": "rollback $1 {{PLURAL:$1|edit|edits}}", diff --git a/languages/i18n/qqq.json b/languages/i18n/qqq.json index 33b2f8f2b7..92010ab96c 100644 --- a/languages/i18n/qqq.json +++ b/languages/i18n/qqq.json @@ -2452,6 +2452,7 @@ "delete-warning-toobig": "Parameters:\n* $1 - the upper limit of number of revisions\nSee also:\n* {{msg-mw|Delete-toobig}}", "deleteprotected": "Used as error message when deleting the page.\n\n\"If protection keeps them from editing, they shouldn't be able to delete.\"", "deleting-backlinks-warning": "A warning shown when a page that is being deleted has at least one link to it or is transcluded in at least one page.", + "deleting-subpages-warning": "A warning shown when a page that is being deleted has at least one subpage. $1 is the number of subpages of the page. For any number of subpages over 50, $1 will be 51.\nSee also:\n* {{msg-mw|Deleting-backlinks-warning}}", "rollback": "{{Identical|Rollback}}", "rollbacklink": "{{Doc-actionlink}}\nThis link text appears on the recent changes page to users who have the \"rollback\" right.\nThis message has a tooltip {{msg-mw|tooltip-rollback}}\n{{Identical|Rollback}}", "rollbacklinkcount": "{{doc-actionlink}}\nText of the rollback link showing the number of edits to be rolled back. See also {{msg-mw|rollbacklink}}.\n\nParameters:\n* $1 - the number of edits that will be rolled back. If $1 is over the value of $wgShowRollbackEditCount (default: 10) {{msg-mw|rollbacklinkcount-morethan}} is used.\n\nThe rollback link is displayed with a tooltip {{msg-mw|Tooltip-rollback}}", -- 2.20.1