Make API action=delete respect $wgDeleteRevisionsLimit
authorAlex Z <mrzman@users.mediawiki.org>
Tue, 20 Jan 2009 23:37:39 +0000 (23:37 +0000)
committerAlex Z <mrzman@users.mediawiki.org>
Tue, 20 Jan 2009 23:37:39 +0000 (23:37 +0000)
RELEASE-NOTES
includes/api/ApiBase.php
includes/api/ApiDelete.php

index 34ba8cd..cf427dd 100644 (file)
@@ -66,6 +66,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 17048) Show the 'new' flag in list=usercontribs for the revision that created the
   page, even if it's not the top revision
 * (bug 17069) Added ucshow=patrolled|!patrolled to list=usercontribs
+* action=delete respects $wgDeleteRevisionsLimit and the bigdelete user right
 
 === Languages updated in 1.15 ===
 
index a94464c..06abc3c 100644 (file)
@@ -698,6 +698,7 @@ abstract class ApiBase {
                'noemail' => array('code' => 'noemail', 'info' => "The user has not specified a valid e-mail address, or has chosen not to receive e-mail from other users"),
                'rcpatroldisabled' => array('code' => 'patroldisabled', 'info' => "Patrolling is disabled on this wiki"),
                'markedaspatrollederror-noautopatrol' => array('code' => 'noautopatrol', 'info' => "You don't have permission to patrol your own changes"),
+               'delete-toobig' => array('code' => 'bigdelete', 'info' => "You can't delete this page because it has more than \$1 revisions"),
 
                // API-specific messages
                'missingparam' => array('code' => 'no$1', 'info' => "The \$1 parameter must be set"),
index 575a259..8b44709 100644 (file)
@@ -79,6 +79,11 @@ class ApiDelete extends ApiBase {
                                $this->dieUsageMsg(current($retval));
                } else {
                        $articleObj = new Article($titleObj);
+                               $bigHistory = $articleObj->isBigDeletion();
+                               if( $bigHistory && !$wgUser->isAllowed( 'bigdelete' ) ) {
+                                       global $wgDeleteRevisionsLimit;
+                                       $this->dieUsageMsg(array('delete-toobig', $wgDeleteRevisionsLimit));
+                               }
                        $retval = self::delete($articleObj, $params['token'], $reason);
                        
                        if(count($retval))