r25459 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r25458‎ | r25459 | r25460 >
Date:20:37, 3 September 2007
Author:catrope
Status:old
Tags:
Comment:
* (bug 10890) API: Timestamp support for categorymembers query
* Removed some stray whitespace
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryCategoryMembers.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiQueryCategoryMembers.php
@@ -58,10 +58,11 @@
5959 if ( is_null( $categoryTitle ) )
6060 $this->dieUsage("Category name $category is not valid", 'param_category');
6161
62 - $prop = array_flip($params['prop']);
 62+ $prop = array_flip($params['prop']);
6363 $fld_ids = isset($prop['ids']);
6464 $fld_title = isset($prop['title']);
6565 $fld_sortkey = isset($prop['sortkey']);
 66+ $fld_timestamp = isset($prop['timestamp']);
6667
6768 if (is_null($resultPageSet)) {
6869 $this->addFields(array('cl_from', 'cl_sortkey', 'page_namespace', 'page_title'));
@@ -70,7 +71,8 @@
7172 $this->addFields($resultPageSet->getPageTableFields()); // will include page_ id, ns, title
7273 $this->addFields(array('cl_from', 'cl_sortkey'));
7374 }
74 -
 75+
 76+ $this->addFieldsIf('cl_timestamp', $fld_timestamp);
7577 $this->addTables(array('page','categorylinks')); // must be in this order for 'USE INDEX'
7678 $this->addOption('USE INDEX', 'cl_sortkey'); // Not needed after bug 10280 is applied to servers
7779
@@ -79,7 +81,7 @@
8082 $this->addWhereFld('cl_to', $categoryTitle->getDBkey());
8183 $this->addWhereFld('page_namespace', $params['namespace']);
8284 $this->addOption('ORDER BY', "cl_to, cl_sortkey, cl_from");
83 -
 85+
8486 $limit = $params['limit'];
8587 $this->addOption('LIMIT', $limit +1);
8688
@@ -110,6 +112,8 @@
111113 }
112114 if ($fld_sortkey)
113115 $vals['sortkey'] = $row->cl_sortkey;
 116+ if ($fld_timestamp)
 117+ $vals['timestamp'] = wfTimestamp(TS_ISO_8601, $row->cl_timestamp);
114118 $data[] = $vals;
115119 } else {
116120 $resultPageSet->processDbRow($row);
@@ -152,9 +156,9 @@
153157
154158 if ($from != 0) {
155159 // Duplicate sort key continue
156 - $this->addWhere( "cl_sortkey>$sortKey OR (cl_sortkey=$sortKey AND cl_from>=$from)" );
 160+ $this->addWhere( "cl_sortkey>$sortKey OR (cl_sortkey=$sortKey AND cl_from>=$from)" );
157161 } else {
158 - $this->addWhere( "cl_sortkey>=$sortKey" );
 162+ $this->addWhere( "cl_sortkey>=$sortKey" );
159163 }
160164 }
161165
@@ -163,15 +167,16 @@
164168 'category' => null,
165169 'prop' => array (
166170 ApiBase :: PARAM_DFLT => 'ids|title',
167 - ApiBase :: PARAM_ISMULTI => true,
 171+ ApiBase :: PARAM_ISMULTI => true,
168172 ApiBase :: PARAM_TYPE => array (
169173 'ids',
170174 'title',
171175 'sortkey',
 176+ 'timestamp',
172177 )
173178 ),
174179 'namespace' => array (
175 - ApiBase :: PARAM_ISMULTI => true,
 180+ ApiBase :: PARAM_ISMULTI => true,
176181 ApiBase :: PARAM_TYPE => 'namespace',
177182 ),
178183 'continue' => null,
Index: trunk/phase3/RELEASE-NOTES
@@ -497,6 +497,7 @@
498498 * (bug 11072) Fix regression in API image history query
499499 * (bug 11115) Adding SHA1 hash to imageinfo query
500500 * (bug 10898) API does not return an edit token for non-existent pages
 501+* (bug 10890) Timestamp support for categorymembers query
501502
502503 == Maintenance script changes since 1.10 ==
503504

Follow-up revisions

RevisionCommit summaryAuthorDate
r25474Additional fix of bug 10890catrope14:30, 4 September 2007
r25530Merged revisions 25454-25529 via svnmerge from...david08:28, 5 September 2007

Status & tagging log