From: Roan Kattouw Date: Mon, 3 Sep 2007 20:37:42 +0000 (+0000) Subject: * (bug 10890) API: Timestamp support for categorymembers query X-Git-Tag: 1.31.0-rc.0~51535 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/?a=commitdiff_plain;h=4a61358db9d4db87e9ebab178ae856804da3476d;p=lhc%2Fweb%2Fwiklou.git * (bug 10890) API: Timestamp support for categorymembers query * Removed some stray whitespace --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 0b44ba7752..f36366f464 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -497,6 +497,7 @@ Full API documentation is available at http://www.mediawiki.org/wiki/API * (bug 11072) Fix regression in API image history query * (bug 11115) Adding SHA1 hash to imageinfo query * (bug 10898) API does not return an edit token for non-existent pages +* (bug 10890) Timestamp support for categorymembers query == Maintenance script changes since 1.10 == diff --git a/includes/api/ApiQueryCategoryMembers.php b/includes/api/ApiQueryCategoryMembers.php index cbb1ddf706..d46e8450f1 100644 --- a/includes/api/ApiQueryCategoryMembers.php +++ b/includes/api/ApiQueryCategoryMembers.php @@ -58,10 +58,11 @@ class ApiQueryCategoryMembers extends ApiQueryGeneratorBase { if ( is_null( $categoryTitle ) ) $this->dieUsage("Category name $category is not valid", 'param_category'); - $prop = array_flip($params['prop']); + $prop = array_flip($params['prop']); $fld_ids = isset($prop['ids']); $fld_title = isset($prop['title']); $fld_sortkey = isset($prop['sortkey']); + $fld_timestamp = isset($prop['timestamp']); if (is_null($resultPageSet)) { $this->addFields(array('cl_from', 'cl_sortkey', 'page_namespace', 'page_title')); @@ -70,7 +71,8 @@ class ApiQueryCategoryMembers extends ApiQueryGeneratorBase { $this->addFields($resultPageSet->getPageTableFields()); // will include page_ id, ns, title $this->addFields(array('cl_from', 'cl_sortkey')); } - + + $this->addFieldsIf('cl_timestamp', $fld_timestamp); $this->addTables(array('page','categorylinks')); // must be in this order for 'USE INDEX' $this->addOption('USE INDEX', 'cl_sortkey'); // Not needed after bug 10280 is applied to servers @@ -79,7 +81,7 @@ class ApiQueryCategoryMembers extends ApiQueryGeneratorBase { $this->addWhereFld('cl_to', $categoryTitle->getDBkey()); $this->addWhereFld('page_namespace', $params['namespace']); $this->addOption('ORDER BY', "cl_to, cl_sortkey, cl_from"); - + $limit = $params['limit']; $this->addOption('LIMIT', $limit +1); @@ -110,6 +112,8 @@ class ApiQueryCategoryMembers extends ApiQueryGeneratorBase { } if ($fld_sortkey) $vals['sortkey'] = $row->cl_sortkey; + if ($fld_timestamp) + $vals['timestamp'] = wfTimestamp(TS_ISO_8601, $row->cl_timestamp); $data[] = $vals; } else { $resultPageSet->processDbRow($row); @@ -152,9 +156,9 @@ class ApiQueryCategoryMembers extends ApiQueryGeneratorBase { if ($from != 0) { // Duplicate sort key continue - $this->addWhere( "cl_sortkey>$sortKey OR (cl_sortkey=$sortKey AND cl_from>=$from)" ); + $this->addWhere( "cl_sortkey>$sortKey OR (cl_sortkey=$sortKey AND cl_from>=$from)" ); } else { - $this->addWhere( "cl_sortkey>=$sortKey" ); + $this->addWhere( "cl_sortkey>=$sortKey" ); } } @@ -163,15 +167,16 @@ class ApiQueryCategoryMembers extends ApiQueryGeneratorBase { 'category' => null, 'prop' => array ( ApiBase :: PARAM_DFLT => 'ids|title', - ApiBase :: PARAM_ISMULTI => true, + ApiBase :: PARAM_ISMULTI => true, ApiBase :: PARAM_TYPE => array ( 'ids', 'title', 'sortkey', + 'timestamp', ) ), 'namespace' => array ( - ApiBase :: PARAM_ISMULTI => true, + ApiBase :: PARAM_ISMULTI => true, ApiBase :: PARAM_TYPE => 'namespace', ), 'continue' => null,