From ad4dadc8ec7063f67ca6992ec1842e20aaf5336a Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Mon, 7 Jul 2008 14:48:40 +0000 Subject: [PATCH] API list=alllinks: * Make paging actually work by ordering by namespace too * Make paging in generator mode work by always requesting pl_title --- includes/api/ApiQueryAllLinks.php | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/includes/api/ApiQueryAllLinks.php b/includes/api/ApiQueryAllLinks.php index d1d5dedff4..32ef16d76a 100644 --- a/includes/api/ApiQueryAllLinks.php +++ b/includes/api/ApiQueryAllLinks.php @@ -84,21 +84,20 @@ class ApiQueryAllLinks extends ApiQueryGeneratorBase { if (isset ($params['prefix'])) $this->addWhere("pl_title LIKE '" . $db->escapeLike($this->titleToKey($params['prefix'])) . "%'"); - if (is_null($resultPageSet)) { - $this->addFields(array ( - 'pl_namespace', - 'pl_title', - 'pl_from' - )); - } else { - $this->addFields('pl_from'); - $pageids = array(); - } + $this->addFields(array ( + 'pl_namespace', + 'pl_title', + 'pl_from' + )); $this->addOption('USE INDEX', 'pl_namespace'); $limit = $params['limit']; $this->addOption('LIMIT', $limit+1); - $this->addOption('ORDER BY', 'pl_title'); + # Only order by pl_namespace if it isn't constant in the WHERE clause + if(count($params['namespace']) != 1) + $this->addOption('ORDER BY', 'pl_namespace, pl_title'); + else + $this->addOption('ORDER BY', 'pl_title'); $res = $this->select(__METHOD__); -- 2.20.1