From: Roan Kattouw Date: Sat, 7 Mar 2009 12:58:41 +0000 (+0000) Subject: * API: (bug 17832) action=delete returns 'unknownerror' instead of 'permissiondenied... X-Git-Tag: 1.31.0-rc.0~42581 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/password.php?a=commitdiff_plain;h=2f1af4d476edf1058cf98e47ee65d172cacc6338;p=lhc%2Fweb%2Fwiklou.git * API: (bug 17832) action=delete returns 'unknownerror' instead of 'permissiondenied' when the current user is blocked * Fix this by changing all calls to current() to reset() --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 970fbb5ac5..1aec44bf5f 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 == diff --git a/includes/api/ApiDelete.php b/includes/api/ApiDelete.php index a9230210c7..49cb5ad67e 100644 --- a/includes/api/ApiDelete.php +++ b/includes/api/ApiDelete.php @@ -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(); diff --git a/includes/api/ApiPatrol.php b/includes/api/ApiPatrol.php index 5b3dafec2a..19f3f1b0f3 100644 --- a/includes/api/ApiPatrol.php +++ b/includes/api/ApiPatrol.php @@ -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()); diff --git a/includes/api/ApiProtect.php b/includes/api/ApiProtect.php index 66b284e92b..ceadccfe08 100644 --- a/includes/api/ApiProtect.php +++ b/includes/api/ApiProtect.php @@ -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'])) diff --git a/includes/api/ApiRollback.php b/includes/api/ApiRollback.php index 0ff602dc0e..7df5acb6e9 100644 --- a/includes/api/ApiRollback.php +++ b/includes/api/ApiRollback.php @@ -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(),