From: Roan Kattouw Date: Thu, 26 Jun 2008 15:48:44 +0000 (+0000) Subject: Use the proper Title methods in ApiQueryBase::titleToKey() and keyToTitle(). This... X-Git-Tag: 1.31.0-rc.0~46881 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/fiche.php?a=commitdiff_plain;h=ff1354373cb33806ee49fe92b31ddf69b2811d68;p=lhc%2Fweb%2Fwiklou.git Use the proper Title methods in ApiQueryBase::titleToKey() and keyToTitle(). This fixes bug 14651 for much more than just apprefix. --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 7fec797712..953d72f62e 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 === diff --git a/includes/api/ApiQueryBase.php b/includes/api/ApiQueryBase.php index e1d9fc3cdf..b17cfabe47 100644 --- a/includes/api/ApiQueryBase.php +++ b/includes/api/ApiQueryBase.php @@ -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(); } /**