(bug 12394) Adding rctitles parameter to list=recentchanges to facilitate easier...
authorRoan Kattouw <catrope@users.mediawiki.org>
Wed, 27 Feb 2008 10:28:03 +0000 (10:28 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Wed, 27 Feb 2008 10:28:03 +0000 (10:28 +0000)
RELEASE-NOTES
includes/api/ApiQueryRecentChanges.php

index 3f153b4..47b193d 100644 (file)
@@ -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 ===
 
index 511276a..d5d76c4 100644 (file)
@@ -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.',