r25511 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r25510‎ | r25511 | r25512 >
Date:20:19, 4 September 2007
Author:catrope
Status:old
Tags:
Comment:
apiedit: Cleaning up error codes
Modified paths:
  • /branches/apiedit/phase3/includes/api/ApiDelete.php (modified) (history)
  • /branches/apiedit/phase3/includes/api/ApiProtect.php (modified) (history)
  • /branches/apiedit/phase3/includes/api/ApiRollback.php (modified) (history)
  • /branches/apiedit/phase3/includes/api/ApiUndelete.php (modified) (history)

Diff [purge]

Index: branches/apiedit/phase3/includes/api/ApiProtect.php
@@ -42,7 +42,7 @@
4343
4444 $titleObj = NULL;
4545 if(!isset($params['title']))
46 - $this->dieUsage('The title parameter must be set', 'notarget');
 46+ $this->dieUsage('The title parameter must be set', 'notitle');
4747 if(!isset($params['token']))
4848 $this->dieUsage('The token parameter must be set', 'notoken');
4949 if(!isset($params['protections']) || empty($params['protections']))
@@ -59,7 +59,7 @@
6060
6161 $titleObj = Title::newFromText($params['title']);
6262 if(!$titleObj)
63 - $this->dieUsage("bad title {$params['title']}", 'invalidtitle');
 63+ $this->dieUsage("Bad title {$params['title']}", 'invalidtitle');
6464 if(!$titleObj->exists())
6565 $this->dieUsage("{$params['title']} doesn't exist", 'missingtitle');
6666 $articleObj = new Article($titleObj);
Index: branches/apiedit/phase3/includes/api/ApiRollback.php
@@ -42,7 +42,7 @@
4343
4444 $titleObj = NULL;
4545 if(!isset($params['title']))
46 - $this->dieUsage('The title parameter must be set', 'notarget');
 46+ $this->dieUsage('The title parameter must be set', 'notitle');
4747 if(!isset($params['user']))
4848 $this->dieUsage('The user parameter must be set', 'nouser');
4949 if(!isset($params['token']))
@@ -58,12 +58,12 @@
5959
6060 $titleObj = Title::newFromText($params['title']);
6161 if(!$titleObj)
62 - $this->dieUsage("bad title {$params['title']}", 'invalidtitle');
 62+ $this->dieUsage("Bad title {$params['title']}", 'invalidtitle');
6363
6464 $articleObj = new Article($titleObj);
6565 $summary = (isset($params['summary']) ? $params['summary'] : "");
6666 $details = NULL;
67 - $retval = $articleObj->doRollback($params['user'], $summary, $params['token'], isset($params['markbot']), &$details);
 67+ $retval = $articleObj->doRollback($params['user'], $summary, $params['token'], $params['markbot'], &$details);
6868
6969 switch($retval)
7070 {
@@ -78,7 +78,7 @@
7979 case Article::BAD_TOKEN:
8080 $this->dieUsage('Invalid token', 'badtoken');
8181 case Article::BAD_TITLE:
82 - $this->dieUsage("The article ``{$params['title']}'' doesn't exist", 'missingtitle');
 82+ $this->dieUsage("{$params['title']} doesn't exist", 'missingtitle');
8383 case Article::ALREADYROLLED:
8484 $current = $details['current'];
8585 $currentID = $current->getId();
@@ -114,7 +114,7 @@
115115 'user' => null,
116116 'token' => null,
117117 'summary' => null,
118 - 'markbot' => null
 118+ 'markbot' => false
119119 );
120120 }
121121
Index: branches/apiedit/phase3/includes/api/ApiDelete.php
@@ -102,7 +102,7 @@
103103
104104 $titleObj = Title::newFromText($params['title']);
105105 if(!$titleObj)
106 - $this->dieUsage("bad title {$params['title']}", 'invalidtitle');
 106+ $this->dieUsage("Bad title {$params['title']}", 'invalidtitle');
107107 if(!$titleObj->exists())
108108 $this->dieUsage("{$params['title']} doesn't exist", 'missingtitle');
109109
Index: branches/apiedit/phase3/includes/api/ApiUndelete.php
@@ -57,7 +57,7 @@
5858
5959 $titleObj = Title::newFromText($params['title']);
6060 if(!$titleObj)
61 - $this->dieUsage("bad title {$params['title']}", 'invalidtitle');
 61+ $this->dieUsage("Bad title {$params['title']}", 'invalidtitle');
6262 $pa = new PageArchive($titleObj);
6363 $retval = $pa->undelete((isset($params['timestamps']) ? $params['timestamps'] : array()), $params['reason']);
6464 if(!is_array($retval))

Status & tagging log