Index: trunk/phase3/includes/api/ApiQueryBacklinks.php |
— | — | @@ -240,53 +240,53 @@ |
241 | 241 | } |
242 | 242 | $db->freeResult($res); |
243 | 243 | } |
244 | | - // Try to add the result data in one go and pray that it fits |
245 | | - $fit = $this->getResult()->addValue('query', $this->getModuleName(), $this->resultArr); |
246 | | - if(!$fit) |
247 | | - { |
248 | | - // It didn't fit. Add elements one by one until the |
249 | | - // result is full. |
250 | | - foreach($this->resultArr as $pageID => $arr) |
| 244 | + if (is_null($resultPageSet)) { |
| 245 | + // Try to add the result data in one go and pray that it fits |
| 246 | + $fit = $this->getResult()->addValue('query', $this->getModuleName(), array_values($this->resultArr)); |
| 247 | + if(!$fit) |
251 | 248 | { |
252 | | - // Add the basic entry without redirlinks first |
253 | | - $fit = $this->getResult()->addValue( |
254 | | - array('query', $this->getModuleName()), |
255 | | - $pageID, array_diff_key($arr, array('redirlinks' => ''))); |
256 | | - if(!$fit) |
| 249 | + // It didn't fit. Add elements one by one until the |
| 250 | + // result is full. |
| 251 | + foreach($this->resultArr as $pageID => $arr) |
257 | 252 | { |
258 | | - $this->continueStr = $this->getContinueStr($pageID); |
259 | | - break; |
260 | | - } |
261 | | - |
262 | | - $hasRedirs = false; |
263 | | - foreach((array)@$arr['redirlinks'] as $key => $redir) |
264 | | - { |
| 253 | + // Add the basic entry without redirlinks first |
265 | 254 | $fit = $this->getResult()->addValue( |
266 | | - array('query', $this->getModuleName(), $pageID, 'redirlinks'), |
267 | | - $key, $redir); |
| 255 | + array('query', $this->getModuleName()), |
| 256 | + null, array_diff_key($arr, array('redirlinks' => ''))); |
268 | 257 | if(!$fit) |
269 | 258 | { |
270 | | - $this->continueStr = $this->getContinueRedirStr($pageID, $redir['pageid']); |
| 259 | + $this->continueStr = $this->getContinueStr($pageID); |
271 | 260 | break; |
272 | 261 | } |
273 | | - $hasRedirs = true; |
| 262 | + |
| 263 | + $hasRedirs = false; |
| 264 | + foreach((array)@$arr['redirlinks'] as $key => $redir) |
| 265 | + { |
| 266 | + $fit = $this->getResult()->addValue( |
| 267 | + array('query', $this->getModuleName(), $pageID, 'redirlinks'), |
| 268 | + $key, $redir); |
| 269 | + if(!$fit) |
| 270 | + { |
| 271 | + $this->continueStr = $this->getContinueRedirStr($pageID, $redir['pageid']); |
| 272 | + break; |
| 273 | + } |
| 274 | + $hasRedirs = true; |
| 275 | + } |
| 276 | + if($hasRedirs) |
| 277 | + $this->getResult()->setIndexedTagName_internal( |
| 278 | + array('query', $this->getModuleName(), $pageID, 'redirlinks'), |
| 279 | + $this->bl_code); |
| 280 | + if(!$fit) |
| 281 | + break; |
274 | 282 | } |
275 | | - if($hasRedirs) |
276 | | - $this->getResult()->setIndexedTagName_internal( |
277 | | - array('query', $this->getModuleName(), $pageID, 'redirlinks'), |
278 | | - $this->bl_code); |
279 | | - if(!$fit) |
280 | | - break; |
281 | | - } |
282 | | - } |
283 | | - if(!is_null($this->continueStr)) |
284 | | - $this->setContinueEnumParameter('continue', $this->continueStr); |
| 283 | + } |
285 | 284 | |
286 | | - if (is_null($resultPageSet)) { |
287 | 285 | $this->getResult()->setIndexedTagName_internal( |
288 | 286 | array('query', $this->getModuleName()), |
289 | 287 | $this->bl_code); |
290 | 288 | } |
| 289 | + if(!is_null($this->continueStr)) |
| 290 | + $this->setContinueEnumParameter('continue', $this->continueStr); |
291 | 291 | } |
292 | 292 | |
293 | 293 | private function extractRowInfo($row) { |