API:
authorRoan Kattouw <catrope@users.mediawiki.org>
Tue, 19 Aug 2008 15:05:29 +0000 (15:05 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Tue, 19 Aug 2008 15:05:29 +0000 (15:05 +0000)
* 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.

RELEASE-NOTES
includes/api/ApiQueryBacklinks.php
includes/api/ApiQueryBase.php

index 3a87809..bc8d005 100644 (file)
@@ -160,6 +160,9 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
   non-hidden categories
 * (bug 15228) Combining revids= and redirects now throws a warning instead of an
   error, and still resolves redirects generated by the generator.
+* list={backlinks,embeddedin,imageusage} now return arrays with keys 0, 1, 2,
+  etc. (AKA lists) instead of arrays with pageIDs as keys (AKA hash tables)
+  for consistency with other list modules.
 
 === Languages updated in 1.14 ===
 
index 825d5f4..a953451 100644 (file)
@@ -229,7 +229,7 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase {
                        $resultData = array();
                        foreach($this->data as $ns => $a)
                                foreach($a as $title => $arr)
-                                       $resultData[$arr['pageid']] = $arr;
+                                       $resultData[] = $arr;
                        $result = $this->getResult();
                        $result->setIndexedTagName($resultData, $this->bl_code);
                        $result->addValue('query', $this->getModuleName(), $resultData);
index 31658b1..b1e6752 100644 (file)
@@ -326,7 +326,12 @@ abstract class ApiQueryBase extends ApiBase {
        public function titleToKey($title) {
                $t = Title::newFromText($title);
                if(!$t)
+               {
+                       # Don't throw an error if we got an empty string
+                       if($title == '')
+                               return '';
                        $this->dieUsageMsg(array('invalidtitle', $title));
+               }
                return $t->getDbKey();
        }
 
@@ -339,7 +344,12 @@ abstract class ApiQueryBase extends ApiBase {
                $t = Title::newFromDbKey($key);
                # This really shouldn't happen but we gotta check anyway
                if(!$t)
+               {
+                       # Don't throw an error if we got an empty string
+                       if($key == '')
+                               return '';
                        $this->dieUsageMsg(array('invalidtitle', $key));
+               }
                return $t->getPrefixedText();
        }