From 011d13084e287adf8d4803dc09da0bf4a3c6f2eb Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Wed, 27 Feb 2008 10:28:03 +0000 Subject: [PATCH] (bug 12394) Adding rctitles parameter to list=recentchanges to facilitate easier retrieval of rcid. Also changing RELEASE-NOTES entries to be more consistent with each other --- RELEASE-NOTES | 7 ++++--- includes/api/ApiQueryRecentChanges.php | 26 +++++++++++++++++++++++++- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 3f153b44f1..47b193de50 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -56,10 +56,11 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN === API changes in 1.13 === * Fixing main page display in meta=siteinfo -* (bug 13128) Add patrolled flag to list=recentchanges +* (bug 13128) Added patrolled flag to list=recentchanges * Implemented {bl,ei,iu}redirect (lists links through redirects as well) -* (bug 13154) Introducing subpages flag to meta=siteinfo&siprop=namespaces -* (bug 13157) Adding ucuserprefix parameter to list=usercontibs +* (bug 13154) Introduced subpages flag to meta=siteinfo&siprop=namespaces +* (bug 13157) Added ucuserprefix parameter to list=usercontibs +* (bug 12394) Added rctitles parameter to list=recentchanges, making rcid retrieval easier === Languages updated in 1.13 === diff --git a/includes/api/ApiQueryRecentChanges.php b/includes/api/ApiQueryRecentChanges.php index 511276aa97..d5d76c41e0 100644 --- a/includes/api/ApiQueryRecentChanges.php +++ b/includes/api/ApiQueryRecentChanges.php @@ -49,7 +49,7 @@ class ApiQueryRecentChanges extends ApiQueryBase { */ public function execute() { /* Initialize vars */ - $limit = $prop = $namespace = $show = $type = $dir = $start = $end = null; + $limit = $prop = $namespace = $titles = $show = $type = $dir = $start = $end = null; /* Get the parameters of the request. */ extract($this->extractRequestParams()); @@ -63,6 +63,26 @@ class ApiQueryRecentChanges extends ApiQueryBase { $this->addWhereRange('rc_timestamp', $dir, $start, $end); $this->addWhereFld('rc_namespace', $namespace); $this->addWhereFld('rc_deleted', 0); + if(!empty($titles)) + { + $lb = new LinkBatch; + foreach($titles as $t) + { + $obj = Title::newFromText($t); + $lb->addObj($obj); + if($obj->getNamespace() < 0) + { + // LinkBatch refuses these, but we need them anyway + if(!array_key_exists($obj->getNamespace(), $lb->data)) + $lb->data[$obj->getNamespace()] = array(); + $lb->data[$obj->getNamespace()][$obj->getDbKey()] = 1; + } + } + $where = $lb->constructSet('rc', $this->getDb()); + if($where != '') + $this->addWhere($where); + } + if(!is_null($type)) $this->addWhereFld('rc_type', $this->parseRCType($type)); @@ -289,6 +309,9 @@ class ApiQueryRecentChanges extends ApiQueryBase { ApiBase :: PARAM_ISMULTI => true, ApiBase :: PARAM_TYPE => 'namespace' ), + 'titles' => array( + ApiBase :: PARAM_ISMULTI => true + ), 'prop' => array ( ApiBase :: PARAM_ISMULTI => true, ApiBase :: PARAM_DFLT => 'title|timestamp|ids', @@ -338,6 +361,7 @@ class ApiQueryRecentChanges extends ApiQueryBase { 'end' => 'The timestamp to end enumerating.', 'dir' => 'In which direction to enumerate.', 'namespace' => 'Filter log entries to only this namespace(s)', + 'titles' => 'Filter log entries to only these page titles', 'prop' => 'Include additional pieces of information', 'show' => array ( 'Show only items that meet this criteria.', -- 2.20.1