r48122 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r48121‎ | r48122 | r48123 >
Date:12:58, 7 March 2009
Author:catrope
Status:ok
Tags:
Comment:
* 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()
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/api/ApiDelete.php (modified) (history)
  • /trunk/phase3/includes/api/ApiPatrol.php (modified) (history)
  • /trunk/phase3/includes/api/ApiProtect.php (modified) (history)
  • /trunk/phase3/includes/api/ApiRollback.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiProtect.php
@@ -58,7 +58,7 @@
5959 $errors = $titleObj->getUserPermissionsErrors('protect', $wgUser);
6060 if($errors)
6161 // We don't care about multiple errors, just report one of them
62 - $this->dieUsageMsg(current($errors));
 62+ $this->dieUsageMsg(reset($errors));
6363
6464 $expiry = (array)$params['expiry'];
6565 if(count($expiry) != count($params['protections']))
Index: trunk/phase3/includes/api/ApiRollback.php
@@ -67,7 +67,7 @@
6868
6969 if($retval)
7070 // We don't care about multiple errors, just report one of them
71 - $this->dieUsageMsg(current($retval));
 71+ $this->dieUsageMsg(reset($retval));
7272
7373 $info = array(
7474 'title' => $titleObj->getPrefixedText(),
Index: trunk/phase3/includes/api/ApiDelete.php
@@ -75,7 +75,7 @@
7676 $retval = self::deleteFile($params['token'], $titleObj, $params['oldimage'], $reason, false);
7777 if(count($retval))
7878 // We don't care about multiple errors, just report one of them
79 - $this->dieUsageMsg(current($retval));
 79+ $this->dieUsageMsg(reset($retval));
8080 } else {
8181 $articleObj = new Article($titleObj);
8282 if($articleObj->isBigDeletion() && !$wgUser->isAllowed('bigdelete')) {
@@ -86,7 +86,7 @@
8787
8888 if(count($retval))
8989 // We don't care about multiple errors, just report one of them
90 - $this->dieUsageMsg(current($retval));
 90+ $this->dieUsageMsg(reset($retval));
9191
9292 if($params['watch'] || $wgUser->getOption('watchdeletion'))
9393 $articleObj->doWatch();
Index: trunk/phase3/includes/api/ApiPatrol.php
@@ -57,7 +57,7 @@
5858 $retval = RecentChange::markPatrolled($params['rcid']);
5959
6060 if($retval)
61 - $this->dieUsageMsg(current($retval));
 61+ $this->dieUsageMsg(reset($retval));
6262
6363 $result = array('rcid' => intval($rc->getAttribute('rc_id')));
6464 ApiQueryBase::addTitleInfo($result, $rc->getTitle());
Index: trunk/phase3/RELEASE-NOTES
@@ -305,6 +305,8 @@
306306 * (bug 17288) Messages improved for default language (English)
307307 * (bug 12937) Update native name for Afar
308308 * (bug 16909) 'histlegend' now reuses messages instead of copying them
 309+* (bug 17832) action=delete returns 'unknownerror' instead of 'permissiondenied' when
 310+ the user is blocked
309311
310312 == Compatibility ==
311313

Follow-up revisions

RevisionCommit summaryAuthorDate
r48123Backporting r48122 to 1.14 branchcatrope13:02, 7 March 2009
r48124Backporting r48122 to 1.13 branchcatrope13:05, 7 March 2009
r48125Followup to r48122: missed onecatrope13:13, 7 March 2009
r48128Backport r48122 and r48125 to 1.12 branch and kill another current() that was...catrope13:15, 7 March 2009

Status & tagging log