Commit 06675ec8 authored by Luke081515's avatar Luke081515

Change return values for rollback and patrol

* Changed return values for patrol and rollback
* These were added in the current master, so this is no breaking change
* Used more simple values which are easier to compare
* Fixes #80
parent ef4cf144
Pipeline #1323 passed with stages
in 2 minutes and 34 seconds
......@@ -634,8 +634,8 @@ class Core extends Password {
* @param $summary - [optional: Defined summary of mediawiki] custom summary
* @param $markbot - [optional: 0] - if true, the rollbacked edit and the rollback will be marked as bot
* @return true - if rollback was successful
* @return fail - if the rollback failed
* @return conflict - if there was a conflict when doing a rollback
* @return false - if the rollback failed
* @return null - if there was a conflict when doing a rollback
*/
public function rollback($title, $user, $summary = "", $markbot = 0) {
while (true) {
......@@ -654,11 +654,11 @@ class Core extends Password {
if (array_key_exists("error", $res)) {
$code = $this->checkResult($res["error"]["code"]);
if ($code === "fail") {
return "fail";
return false;
} else if ($code === "retry") {
sleep(5);
} else if ($code === "conflict") {
return "conflict";
return null;
}
} else {
return true;
......@@ -717,7 +717,7 @@ class Core extends Password {
* @author Luke081515
* @param $id - the revid or rcid to patrol
* @param $revid [optional: true] - if true, you use a revid, otherwise a rcid
* @return string - success if successful, otherwise the API error-code
* @return string / bool - true if successful, otherwise the API error-code
*/
public function patrol($id, $revid = true) {
$token = $this->requireToken("patrol");
......@@ -737,7 +737,7 @@ class Core extends Password {
return $this->checkResult($result["error"]["code"]);
}
} else {
return "success";
return true;
}
}
/** review
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment