Index: branches/apiedit/phase3/includes/api/ApiRollback.php |
— | — | @@ -62,8 +62,8 @@ |
63 | 63 | |
64 | 64 | $articleObj = new Article($titleObj); |
65 | 65 | $summary = (isset($params['summary']) ? $params['summary'] : ""); |
66 | | - $info = array(); |
67 | | - $retval = $articleObj->doRollback($params['user'], $params['token'], isset($params['markbot']), $summary, &$info); |
| 66 | + $details = NULL; |
| 67 | + $retval = $articleObj->doRollback($params['user'], $summary, $params['token'], isset($params['markbot']), &$details); |
68 | 68 | |
69 | 69 | switch($retval) |
70 | 70 | { |
— | — | @@ -80,7 +80,10 @@ |
81 | 81 | case Article::BAD_TITLE: |
82 | 82 | $this->dieUsage("The article ``{$params['title']}'' doesn't exist", 'missingtitle'); |
83 | 83 | case Article::ALREADYROLLED: |
84 | | - $this->dieUsage('The edit(s) you tried to rollback is/are already rolled back', 'alreadyrolled'); |
| 84 | + $current = $details['current']; |
| 85 | + $currentID = $current->getId(); |
| 86 | + $this->dieUsage("The edit(s) you tried to rollback is/are already rolled back." . |
| 87 | + "The current revision ID is $currentID", 'alreadyrolled'); |
85 | 88 | case Article::ONLY_AUTHOR: |
86 | 89 | $this->dieUsage("{$params['user']} is the only author of the page", 'onlyauthor'); |
87 | 90 | case Article::EDIT_FAILED: |
— | — | @@ -90,6 +93,18 @@ |
91 | 94 | $this->dieDebug(__METHOD__, "rollback() returned an unknown error ($retval)"); |
92 | 95 | } |
93 | 96 | // $retval has to be Article::SUCCESS if we get here |
| 97 | + $current = $target = $summary = NULL; |
| 98 | + extract($details); |
| 99 | + |
| 100 | + $info = array( |
| 101 | + 'title' => $titleObj->getPrefixedText(), |
| 102 | + 'pageid' => $current->getPage(), |
| 103 | + 'summary' => $summary, |
| 104 | + 'revid' => $titleObj->getLatestRevID(), |
| 105 | + 'old_revid' => $current->getID(), |
| 106 | + 'last_revid' => $target->getID() |
| 107 | + ); |
| 108 | + |
94 | 109 | $this->getResult()->addValue(null, $this->getModuleName(), $info); |
95 | 110 | } |
96 | 111 | |