Index: trunk/phase3/includes/api/ApiQueryRevisions.php |
— | — | @@ -224,12 +224,14 @@ |
225 | 225 | } |
226 | 226 | $db->freeResult($res); |
227 | 227 | |
228 | | - // Ensure that all revisions are shown as '<r>' elements |
| 228 | + // Ensure that all revisions are shown as '<rev>' elements |
229 | 229 | $result = $this->getResult(); |
230 | | - $data = & $result->getData(); |
231 | | - foreach ($data['query']['pages'] as & $page) { |
232 | | - if (is_array($page) && array_key_exists('revisions', $page)) { |
233 | | - $result->setIndexedTagName($page['revisions'], 'rev'); |
| 230 | + if( $result->getIsRawMode()) { |
| 231 | + $data = & $result->getData(); |
| 232 | + foreach ($data['query']['pages'] as & $page) { |
| 233 | + if (is_array($page) && array_key_exists('revisions', $page)) { |
| 234 | + $result->setIndexedTagName($page['revisions'], 'rev'); |
| 235 | + } |
234 | 236 | } |
235 | 237 | } |
236 | 238 | } |
Index: trunk/phase3/includes/api/ApiResult.php |
— | — | @@ -31,14 +31,14 @@ |
32 | 32 | |
33 | 33 | class ApiResult extends ApiBase { |
34 | 34 | |
35 | | - private $mData, $mNeedsRaw; |
| 35 | + private $mData, $mIsRawMode; |
36 | 36 | |
37 | 37 | /** |
38 | 38 | * Constructor |
39 | 39 | */ |
40 | 40 | public function __construct($main) { |
41 | 41 | parent :: __construct($main, 'result'); |
42 | | - $this->mNeedsRaw = false; |
| 42 | + $this->mIsRawMode = false; |
43 | 43 | $this->reset(); |
44 | 44 | } |
45 | 45 | |
— | — | @@ -51,10 +51,14 @@ |
52 | 52 | * are needed by the formatter, for example in XML printing. |
53 | 53 | */ |
54 | 54 | public function setRawMode() { |
55 | | - $this->mNeedsRaw = true; |
| 55 | + $this->mIsRawMode = true; |
56 | 56 | } |
| 57 | + |
| 58 | + public function getIsRawMode() { |
| 59 | + return $this->mIsRawMode; |
| 60 | + } |
57 | 61 | |
58 | | - function & getData() { |
| 62 | + public function & getData() { |
59 | 63 | return $this->mData; |
60 | 64 | } |
61 | 65 | |
— | — | @@ -108,7 +112,7 @@ |
109 | 113 | */ |
110 | 114 | public function setIndexedTagName(& $arr, $tag) { |
111 | 115 | // In raw mode, add the '_element', otherwise just ignore |
112 | | - if (!$this->mNeedsRaw) |
| 116 | + if (!$this->getIsRawMode()) |
113 | 117 | return; |
114 | 118 | if ($arr === null || $tag === null || !is_array($arr) || is_array($tag)) |
115 | 119 | ApiBase :: dieDebug(__METHOD__, 'Bad parameter'); |