From 815e545e4b44ad1d121853af5dea4dfe25564ec2 Mon Sep 17 00:00:00 2001 From: Yuri Astrakhan Date: Sun, 22 Oct 2006 19:52:22 +0000 Subject: [PATCH] API * Extra profiling for allpages * better help output --- includes/api/ApiBase.php | 7 ++++--- includes/api/ApiQueryAllpages.php | 16 ++++++++++++++-- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php index 53deef3e97..d524f54621 100644 --- a/includes/api/ApiBase.php +++ b/includes/api/ApiBase.php @@ -172,11 +172,12 @@ abstract class ApiBase { $desc = implode($paramPrefix, $desc); if (isset ($paramSettings[self :: PARAM_TYPE])) { $type = $paramSettings[self :: PARAM_TYPE]; - if (is_array($type)) { + if (is_array($type)) $desc .= $paramPrefix . 'Allowed values: ' . implode(', ', $type); - } } - + if (isset ($paramSettings[self :: PARAM_ISMULTI])) + $desc .= $paramPrefix . 'Allows multiple values separated with "|"'; + $default = is_array($paramSettings) ? (isset ($paramSettings[self :: PARAM_DFLT]) ? $paramSettings[self :: PARAM_DFLT] : null) : $paramSettings; if (!is_null($default) && $default !== false) $desc .= $paramPrefix . "Default: $default"; diff --git a/includes/api/ApiQueryAllpages.php b/includes/api/ApiQueryAllpages.php index 9835f0be68..bf51e1dae3 100644 --- a/includes/api/ApiQueryAllpages.php +++ b/includes/api/ApiQueryAllpages.php @@ -47,10 +47,14 @@ class ApiQueryAllpages extends ApiQueryGeneratorBase { } private function run($resultPageSet = null) { - $limit = $from = $namespace = $filterredir = null; - extract($this->extractRequestParams()); + wfProfileIn($this->getModuleProfileName() . '-getDB'); $db = $this->getDB(); + wfProfileOut($this->getModuleProfileName() . '-getDB'); + + wfProfileIn($this->getModuleProfileName() . '-parseParams'); + $limit = $from = $namespace = $filterredir = null; + extract($this->extractRequestParams()); $this->addTables('page'); if( !$this->addWhereIf('page_is_redirect = 1', $filterredir === 'redirects')) @@ -77,7 +81,13 @@ class ApiQueryAllpages extends ApiQueryGeneratorBase { $data = array (); $count = 0; + + wfProfileOut($this->getModuleProfileName() . '-parseParams'); + $res = $this->select(__METHOD__); + + wfProfileIn($this->getModuleProfileName() . '-saveResults'); + while ($row = $db->fetchObject($res)) { if (++ $count > $limit) { // We've reached the one extra which shows that there are additional pages to be had. Stop here... @@ -104,6 +114,8 @@ class ApiQueryAllpages extends ApiQueryGeneratorBase { $result->setIndexedTagName($data, 'p'); $result->addValue('query', $this->getModuleName(), $data); } + + wfProfileOut($this->getModuleProfileName() . '-saveResults'); } protected function getAllowedParams() { -- 2.20.1