* API: (bug 17832) action=delete returns 'unknownerror' instead of 'permissiondenied...
authorRoan Kattouw <catrope@users.mediawiki.org>
Sat, 7 Mar 2009 12:58:41 +0000 (12:58 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Sat, 7 Mar 2009 12:58:41 +0000 (12:58 +0000)
* Fix this by changing all calls to current() to reset()

RELEASE-NOTES
includes/api/ApiDelete.php
includes/api/ApiPatrol.php
includes/api/ApiProtect.php
includes/api/ApiRollback.php

index 970fbb5..1aec44b 100644 (file)
@@ -305,6 +305,8 @@ changes to languages because of MediaZilla reports.
 * (bug 17288) Messages improved for default language (English)
 * (bug 12937) Update native name for Afar
 * (bug 16909) 'histlegend' now reuses messages instead of copying them
+* (bug 17832) action=delete returns 'unknownerror' instead of 'permissiondenied' when
+  the user is blocked
 
 == Compatibility ==
 
index a923021..49cb5ad 100644 (file)
@@ -75,7 +75,7 @@ class ApiDelete extends ApiBase {
                        $retval = self::deleteFile($params['token'], $titleObj, $params['oldimage'], $reason, false);
                        if(count($retval))
                                // We don't care about multiple errors, just report one of them
-                               $this->dieUsageMsg(current($retval));
+                               $this->dieUsageMsg(reset($retval));
                } else {
                        $articleObj = new Article($titleObj);
                        if($articleObj->isBigDeletion() && !$wgUser->isAllowed('bigdelete')) {
@@ -86,7 +86,7 @@ class ApiDelete extends ApiBase {
                        
                        if(count($retval))
                                // We don't care about multiple errors, just report one of them
-                               $this->dieUsageMsg(current($retval));
+                               $this->dieUsageMsg(reset($retval));
                        
                        if($params['watch'] || $wgUser->getOption('watchdeletion'))
                                $articleObj->doWatch();
index 5b3dafe..19f3f1b 100644 (file)
@@ -57,7 +57,7 @@ class ApiPatrol extends ApiBase {
                $retval = RecentChange::markPatrolled($params['rcid']);
                        
                if($retval)
-                       $this->dieUsageMsg(current($retval));
+                       $this->dieUsageMsg(reset($retval));
                
                $result = array('rcid' => intval($rc->getAttribute('rc_id')));
                ApiQueryBase::addTitleInfo($result, $rc->getTitle());
index 66b284e..ceadccf 100644 (file)
@@ -58,7 +58,7 @@ class ApiProtect extends ApiBase {
                $errors = $titleObj->getUserPermissionsErrors('protect', $wgUser);
                if($errors)
                        // We don't care about multiple errors, just report one of them
-                       $this->dieUsageMsg(current($errors));
+                       $this->dieUsageMsg(reset($errors));
 
                $expiry = (array)$params['expiry'];
                if(count($expiry) != count($params['protections']))
index 0ff602d..7df5acb 100644 (file)
@@ -67,7 +67,7 @@ class ApiRollback extends ApiBase {
 
                if($retval)
                        // We don't care about multiple errors, just report one of them
-                       $this->dieUsageMsg(current($retval));
+                       $this->dieUsageMsg(reset($retval));
 
                $info = array(
                        'title' => $titleObj->getPrefixedText(),