Fix regression from r36678: we can't use $this->dieUsageMsg() in a static method...
authorRoan Kattouw <catrope@users.mediawiki.org>
Sun, 29 Jun 2008 22:26:23 +0000 (22:26 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Sun, 29 Jun 2008 22:26:23 +0000 (22:26 +0000)
includes/api/ApiQueryAllCategories.php
includes/api/ApiQueryAllLinks.php
includes/api/ApiQueryAllUsers.php
includes/api/ApiQueryAllimages.php
includes/api/ApiQueryAllpages.php
includes/api/ApiQueryBase.php

index 4e675b0..fe33eae 100644 (file)
@@ -57,9 +57,9 @@ class ApiQueryAllCategories extends ApiQueryGeneratorBase {
                $this->addFields('cat_title');
 
                if (!is_null($params['from']))
-                       $this->addWhere('cat_title>=' . $db->addQuotes(ApiQueryBase :: titleToKey($params['from'])));
+                       $this->addWhere('cat_title>=' . $db->addQuotes($this->titleToKey($params['from'])));
                if (isset ($params['prefix']))
-                       $this->addWhere("cat_title LIKE '" . $db->escapeLike(ApiQueryBase :: titleToKey($params['prefix'])) . "%'");
+                       $this->addWhere("cat_title LIKE '" . $db->escapeLike($this->titleToKey($params['prefix'])) . "%'");
 
                $this->addOption('LIMIT', $params['limit']+1);
                $this->addOption('ORDER BY', 'cat_title' . ($params['dir'] == 'descending' ? ' DESC' : ''));
@@ -78,7 +78,7 @@ class ApiQueryAllCategories extends ApiQueryGeneratorBase {
                        if (++ $count > $params['limit']) {
                                // We've reached the one extra which shows that there are additional cats to be had. Stop here...
                                // TODO: Security issue - if the user has no right to view next title, it will still be shown
-                               $this->setContinueEnumParameter('from', ApiQueryBase :: keyToTitle($row->cat_title));
+                               $this->setContinueEnumParameter('from', $this->keyToTitle($row->cat_title));
                                break;
                        }
 
index 6a77778..452b9ec 100644 (file)
@@ -80,9 +80,9 @@ class ApiQueryAllLinks extends ApiQueryGeneratorBase {
                }               
 
                if (!is_null($params['from']))
-                       $this->addWhere('pl_title>=' . $db->addQuotes(ApiQueryBase :: titleToKey($params['from'])));
+                       $this->addWhere('pl_title>=' . $db->addQuotes($this->titleToKey($params['from'])));
                if (isset ($params['prefix']))
-                       $this->addWhere("pl_title LIKE '" . $db->escapeLike(ApiQueryBase :: titleToKey($params['prefix'])) . "%'");
+                       $this->addWhere("pl_title LIKE '" . $db->escapeLike($this->titleToKey($params['prefix'])) . "%'");
 
                if (is_null($resultPageSet)) {
                        $this->addFields(array (
@@ -108,7 +108,7 @@ class ApiQueryAllLinks extends ApiQueryGeneratorBase {
                        if (++ $count > $limit) {
                                // We've reached the one extra which shows that there are additional pages to be had. Stop here...
                                // TODO: Security issue - if the user has no right to view next title, it will still be shown
-                               $this->setContinueEnumParameter('continue', ApiQueryBase :: keyToTitle($row->pl_title) . "|" . $row->pl_from);
+                               $this->setContinueEnumParameter('continue', $this->keyToTitle($row->pl_title) . "|" . $row->pl_from);
                                break;
                        }
 
index 6f1fe0c..220327d 100644 (file)
@@ -58,10 +58,10 @@ class ApiQueryAllUsers extends ApiQueryBase {
                $this->addTables('user', 'u1');
 
                if( !is_null( $params['from'] ) )
-                       $this->addWhere( 'u1.user_name >= ' . $db->addQuotes( self::keyToTitle( $params['from'] ) ) );
+                       $this->addWhere( 'u1.user_name >= ' . $db->addQuotes( $this->keyToTitle( $params['from'] ) ) );
 
                if( isset( $params['prefix'] ) )
-                       $this->addWhere( 'u1.user_name LIKE "' . $db->escapeLike( self::keyToTitle( $params['prefix'] ) ) . '%"' );
+                       $this->addWhere( 'u1.user_name LIKE "' . $db->escapeLike( $this->keyToTitle( $params['prefix'] ) ) . '%"' );
 
                if (!is_null($params['group'])) {
                        // Filter only users that belong to a given group
@@ -132,7 +132,7 @@ class ApiQueryAllUsers extends ApiQueryBase {
 
                                if ($count > $limit) {
                                        // We've reached the one extra which shows that there are additional pages to be had. Stop here...
-                                       $this->setContinueEnumParameter('from', ApiQueryBase :: keyToTitle($row->user_name));
+                                       $this->setContinueEnumParameter('from', $this->keyToTitle($row->user_name));
                                        break;
                                }
 
index 8ccd93e..11430ae 100644 (file)
@@ -62,9 +62,9 @@ class ApiQueryAllimages extends ApiQueryGeneratorBase {
 
                // Image filters
                if (!is_null($params['from']))
-                       $this->addWhere('img_name>=' . $db->addQuotes(ApiQueryBase :: titleToKey($params['from'])));
+                       $this->addWhere('img_name>=' . $db->addQuotes($this->titleToKey($params['from'])));
                if (isset ($params['prefix']))
-                       $this->addWhere("img_name LIKE '" . $db->escapeLike(ApiQueryBase :: titleToKey($params['prefix'])) . "%'");
+                       $this->addWhere("img_name LIKE '" . $db->escapeLike($this->titleToKey($params['prefix'])) . "%'");
 
                if (isset ($params['minsize'])) {
                        $this->addWhere('img_size>=' . intval($params['minsize']));
@@ -103,7 +103,7 @@ class ApiQueryAllimages extends ApiQueryGeneratorBase {
                        if (++ $count > $limit) {
                                // We've reached the one extra which shows that there are additional pages to be had. Stop here...
                                // TODO: Security issue - if the user has no right to view next title, it will still be shown
-                               $this->setContinueEnumParameter('from', ApiQueryBase :: keyToTitle($row->img_name));
+                               $this->setContinueEnumParameter('from', $this->keyToTitle($row->img_name));
                                break;
                        }
 
index b1e46bf..c4ac486 100644 (file)
@@ -62,10 +62,10 @@ class ApiQueryAllpages extends ApiQueryGeneratorBase {
                        $this->addWhereIf('page_is_redirect = 0', $params['filterredir'] === 'nonredirects');
                $this->addWhereFld('page_namespace', $params['namespace']);
                $dir = ($params['dir'] == 'descending' ? 'older' : 'newer');
-               $from = (is_null($params['from']) ? null : ApiQueryBase::titleToKey($params['from']));
+               $from = (is_null($params['from']) ? null : $this->titleToKey($params['from']));
                $this->addWhereRange('page_title', $dir, $from, null);
                if (isset ($params['prefix']))
-                       $this->addWhere("page_title LIKE '" . $db->escapeLike(ApiQueryBase :: titleToKey($params['prefix'])) . "%'");
+                       $this->addWhere("page_title LIKE '" . $db->escapeLike($this->titleToKey($params['prefix'])) . "%'");
 
                $forceNameTitleIndex = true;
                if (isset ($params['minsize'])) {
@@ -130,7 +130,7 @@ class ApiQueryAllpages extends ApiQueryGeneratorBase {
                        if (++ $count > $limit) {
                                // We've reached the one extra which shows that there are additional pages to be had. Stop here...
                                // TODO: Security issue - if the user has no right to view next title, it will still be shown
-                               $this->setContinueEnumParameter('from', ApiQueryBase :: keyToTitle($row->page_title));
+                               $this->setContinueEnumParameter('from', $this->keyToTitle($row->page_title));
                                break;
                        }
 
index fe68e6f..9094070 100644 (file)
@@ -323,7 +323,7 @@ abstract class ApiQueryBase extends ApiBase {
         * @param string $title Page title with spaces
         * @return string Page title with underscores
         */
-       public static function titleToKey($title) {
+       public function titleToKey($title) {
                $t = Title::newFromText($title);
                if(!$t)
                        $this->dieUsageMsg('invalidtitle', $title);
@@ -335,7 +335,7 @@ abstract class ApiQueryBase extends ApiBase {
         * @param string $key Page title with underscores
         * @return string Page title with spaces
         */
-       public static function keyToTitle($key) {
+       public function keyToTitle($key) {
                $t = Title::newFromDbKey($key);
                # This really shouldn't happen but we gotta check anyway
                if(!$t)