Jackmcbarn has uploaded a new change for review.
https://gerrit.wikimedia.org/r/153619
Change subject: Test only against protection for deleting
......................................................................
Test only against protection for deleting
When deleting a page, only check that the user can edit through
protection, rather than running all of the other checks. This is Tim
Starling's option 3 from bug 69380.
Bug: 69380
Bug: 69398
Change-Id: I5a7c4147bd241dc086fda6c16827f9554d78599b
---
M includes/Title.php
M includes/api/ApiBase.php
M languages/i18n/en.json
M languages/i18n/qqq.json
4 files changed, 13 insertions(+), 9 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/19/153619/1
diff --git a/includes/Title.php b/includes/Title.php
index a1b2352..c73550f 100644
--- a/includes/Title.php
+++ b/includes/Title.php
@@ -2258,11 +2258,15 @@
$errors[] = array( 'immobile-target-page' );
}
} elseif ( $action == 'delete' ) {
- if ( count( $this->getUserPermissionsErrorsInternal(
'edit',
- $user, $doExpensiveQueries, true ) )
- ) {
- // If they can't edit, they shouldn't delete.
- $errors[] = array( 'delete-cantedit' );
+ $tempErrors = $this->checkPageRestrictions( 'edit',
+ $user, array(), $doExpensiveQueries, true );
+ if( !$tempErrors ) {
+ $tempErrors =
$this->checkCascadingSourcesRestrictions( 'edit',
+ $user, $tempErrors,
$doExpensiveQueries, true );
+ }
+ if ( $tempErrors ) {
+ // If protection keeps them from editing, they
shouldn't be able to delete.
+ $errors[] = array( 'deleteprotected' );
}
if ( $doExpensiveQueries && $wgDeleteRevisionsLimit
&& !$this->userCan( 'bigdelete', $user ) &&
$this->isBigDeletion()
diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php
index a280ddf..05b69bc 100644
--- a/includes/api/ApiBase.php
+++ b/includes/api/ApiBase.php
@@ -1411,9 +1411,9 @@
'code' => 'cantedit',
'info' => "You can't protect this page because you
can't edit it"
),
- 'delete-cantedit' => array(
+ 'deleteprotected' => array(
'code' => 'cantedit',
- 'info' => "You can't delete this page because you can't
edit it"
+ 'info' => "You can't delete this page because it has
been protected"
),
'badaccess-group0' => array(
'code' => 'permissiondenied',
diff --git a/languages/i18n/en.json b/languages/i18n/en.json
index a43a742..bbd8f7b 100644
--- a/languages/i18n/en.json
+++ b/languages/i18n/en.json
@@ -1876,7 +1876,7 @@
"delete-edit-reasonlist": "Edit deletion reasons",
"delete-toobig": "This page has a large edit history, over $1
{{PLURAL:$1|revision|revisions}}.\nDeletion of such pages has been restricted
to prevent accidental disruption of {{SITENAME}}.",
"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.",
- "delete-cantedit": "You cannot delete this page because you do not have
permission to edit it.",
+ "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.",
"rollback": "Roll back edits",
"rollback_short": "Rollback",
diff --git a/languages/i18n/qqq.json b/languages/i18n/qqq.json
index e135277..573bd34 100644
--- a/languages/i18n/qqq.json
+++ b/languages/i18n/qqq.json
@@ -2038,7 +2038,7 @@
"delete-edit-reasonlist": "Shown beneath the page deletion form on the
right side. It is a link to {{msg-mw|Deletereason-dropdown|notext=1}}.\n\nSee
also:\n* {{msg-mw|Ipb-edit-dropdown}}\n*
{{msg-mw|Protect-edit-reasonlist}}.\n{{Identical|Edit delete reasons}}",
"delete-toobig": "Parameters:\n* $1 - the upper limit of number of
revisions\nSee also:\n* {{msg-mw|Delete-warning-toobig}}",
"delete-warning-toobig": "Parameters:\n* $1 - the upper limit of number
of revisions\nSee also:\n* {{msg-mw|Delete-toobig}}",
- "delete-cantedit": "Used as error message when deleting the page.",
+ "deleteprotected": "Used as error message when deleting the page.",
"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.",
"rollback": "{{Identical|Rollback}}",
"rollback_short": "{{Identical|Rollback}}",
--
To view, visit https://gerrit.wikimedia.org/r/153619
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I5a7c4147bd241dc086fda6c16827f9554d78599b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Jackmcbarn <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits