r39645 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r39644‎ | r39645 | r39646 >
Date:15:05, 19 August 2008
Author:catrope
Status:old
Tags:
Comment:
API:
* BREAKING CHANGE: list={backlinks,embeddedin,imageusage} now return an array with keys 0, 1, 2, ... (list) rather than an array with pageIDs as keys (hash table/associative array) for consistency with other list= modules.
* Attempting to fix an error about "Invalid title ``''" (i.e. empty string as title) I encountered at Wikipedia.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryBacklinks.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryBase.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiQueryBacklinks.php
@@ -229,7 +229,7 @@
230230 $resultData = array();
231231 foreach($this->data as $ns => $a)
232232 foreach($a as $title => $arr)
233 - $resultData[$arr['pageid']] = $arr;
 233+ $resultData[] = $arr;
234234 $result = $this->getResult();
235235 $result->setIndexedTagName($resultData, $this->bl_code);
236236 $result->addValue('query', $this->getModuleName(), $resultData);
Index: trunk/phase3/includes/api/ApiQueryBase.php
@@ -326,7 +326,12 @@
327327 public function titleToKey($title) {
328328 $t = Title::newFromText($title);
329329 if(!$t)
 330+ {
 331+ # Don't throw an error if we got an empty string
 332+ if($title == '')
 333+ return '';
330334 $this->dieUsageMsg(array('invalidtitle', $title));
 335+ }
331336 return $t->getDbKey();
332337 }
333338
@@ -339,7 +344,12 @@
340345 $t = Title::newFromDbKey($key);
341346 # This really shouldn't happen but we gotta check anyway
342347 if(!$t)
 348+ {
 349+ # Don't throw an error if we got an empty string
 350+ if($key == '')
 351+ return '';
343352 $this->dieUsageMsg(array('invalidtitle', $key));
 353+ }
344354 return $t->getPrefixedText();
345355 }
346356
Index: trunk/phase3/RELEASE-NOTES
@@ -160,6 +160,9 @@
161161 non-hidden categories
162162 * (bug 15228) Combining revids= and redirects now throws a warning instead of an
163163 error, and still resolves redirects generated by the generator.
 164+* list={backlinks,embeddedin,imageusage} now return arrays with keys 0, 1, 2,
 165+ etc. (AKA lists) instead of arrays with pageIDs as keys (AKA hash tables)
 166+ for consistency with other list modules.
164167
165168 === Languages updated in 1.14 ===
166169

Status & tagging log