Use the proper Title methods in ApiQueryBase::titleToKey() and keyToTitle(). This...
authorRoan Kattouw <catrope@users.mediawiki.org>
Thu, 26 Jun 2008 15:48:44 +0000 (15:48 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Thu, 26 Jun 2008 15:48:44 +0000 (15:48 +0000)
RELEASE-NOTES
includes/api/ApiQueryBase.php

index 7fec797..953d72f 100644 (file)
@@ -469,6 +469,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * Added nocreate parameter to action=edit
 * (bug 14402) Added maxage and smaxage parameters to api.php
 * Added bkip parameter to list=blocks
+* (bug 14651) apprefix and similar parameters are now canonicalized
 
 === Languages updated in 1.13 ===
 
index e1d9fc3..b17cfab 100644 (file)
@@ -319,14 +319,13 @@ abstract class ApiQueryBase extends ApiBase {
        }
 
        /**
-        * This is a very simplistic utility function
-        * to convert a non-namespaced title string to a db key.
-        * It will replace all ' ' with '_'
+        * Convert a title to a DB key
         * @param string $title Page title with spaces
         * @return string Page title with underscores
         */
        public static function titleToKey($title) {
-               return str_replace(' ', '_', $title);
+               $t = Title::newFromText($title);
+               return $t->getDbKey();
        }
 
        /**
@@ -335,7 +334,8 @@ abstract class ApiQueryBase extends ApiBase {
         * @return string Page title with spaces
         */
        public static function keyToTitle($key) {
-               return str_replace('_', ' ', $key);
+               $t = Title::newFromDbKey($key);
+               return $t->getPrefixedText();
        }
 
        /**