Merge "Test only against protection for deleting"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Tue, 19 Aug 2014 17:22:57 +0000 (17:22 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 19 Aug 2014 17:22:57 +0000 (17:22 +0000)
includes/Title.php
includes/api/ApiBase.php
languages/i18n/en.json
languages/i18n/qqq.json

index 1676a1b..15ff216 100644 (file)
@@ -2261,11 +2261,15 @@ class Title {
                                $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()
index db62be0..c05a833 100644 (file)
@@ -1411,9 +1411,9 @@ abstract class ApiBase extends ContextSource {
                        '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',
index 6b1ed8c..f9e3e46 100644 (file)
        "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",
index c7abc08..1825962 100644 (file)
        "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}}",