(bug 13618) Added rcprop=redirect and rcshow=redirect to list=recentchanges
authorRoan Kattouw <catrope@users.mediawiki.org>
Mon, 7 Apr 2008 13:01:57 +0000 (13:01 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Mon, 7 Apr 2008 13:01:57 +0000 (13:01 +0000)
RELEASE-NOTES
includes/api/ApiQueryRecentChanges.php

index 4be4671..642172a 100644 (file)
@@ -202,6 +202,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
   very weak typing on array keys.
 * (bug 12136) Extend allowed characters in JSON callback to ][.'"_A-Za-z0-9
 * (bug 11673) Return error 'unknown_action' in specified format
+* (bug 13618) Added rcprop=redirect and rcshow=redirect to list=recentchanges
 
 === Languages updated in 1.13 ===
 
index eb0c23a..fa8d9fa 100644 (file)
@@ -59,7 +59,6 @@ class ApiQueryRecentChanges extends ApiQueryBase {
                 *              AND rc_timestamp < $end AND rc_namespace = $namespace 
                 *              AND rc_deleted = '0'
                 */
-               $this->addTables('recentchanges');
                $this->addWhereRange('rc_timestamp', $dir, $start, $end);
                $this->addWhereFld('rc_namespace', $namespace);
                $this->addWhereFld('rc_deleted', 0);
@@ -92,7 +91,8 @@ class ApiQueryRecentChanges extends ApiQueryBase {
                        /* Check for conflicting parameters. */
                        if ((isset ($show['minor']) && isset ($show['!minor'])) 
                                        || (isset ($show['bot']) && isset ($show['!bot'])) 
-                                       || (isset ($show['anon']) && isset ($show['!anon']))) {
+                                       || (isset ($show['anon']) && isset ($show['!anon']))
+                                       || (isset ($show['redirect']) && isset ($show['!redirect']))) {
                                                
                                $this->dieUsage("Incorrect parameter - mutually exclusive values may not be supplied", 'show');
                        }
@@ -104,6 +104,8 @@ class ApiQueryRecentChanges extends ApiQueryBase {
                        $this->addWhereIf('rc_bot != 0', isset ($show['bot']));
                        $this->addWhereIf('rc_user = 0', isset ($show['anon']));
                        $this->addWhereIf('rc_user != 0', isset ($show['!anon']));
+                       $this->addWhereIf('page_is_redirect = 1', isset ($show['redirect']));
+                       $this->addWhereIf('page_is_redirect = 0', isset ($show['!redirect']));
                }
 
                /* Add the fields we're concerned with to out query. */
@@ -128,6 +130,7 @@ class ApiQueryRecentChanges extends ApiQueryBase {
                        $this->fld_title = isset ($prop['title']);
                        $this->fld_ids = isset ($prop['ids']);
                        $this->fld_sizes = isset ($prop['sizes']);
+                       $this->fld_redirect = isset($prop['redirect']);
                        $this->fld_patrolled = isset($prop['patrolled']);
                        
                        global $wgUser;
@@ -148,8 +151,15 @@ class ApiQueryRecentChanges extends ApiQueryBase {
                        $this->addFieldsIf('rc_old_len', $this->fld_sizes);
                        $this->addFieldsIf('rc_new_len', $this->fld_sizes);
                        $this->addFieldsIf('rc_patrolled', $this->fld_patrolled);
+                       if($this->fld_redirect || isset($show['redirect']) || isset($show['!redirect']))
+                       {
+                               $this->addTables('page');
+                               $this->addWhere('page_namespace=rc_namespace');
+                               $this->addWhere('page_title=rc_title');
+                               $this->addFields('page_is_redirect');
+                       }
                }
-
+               $this->addTables('recentchanges');
                /* Specify the limit for our query. It's $limit+1 because we (possibly) need to 
                 * generate a "continue" parameter, to allow paging. */
                $this->addOption('LIMIT', $limit +1);
@@ -266,6 +276,10 @@ class ApiQueryRecentChanges extends ApiQueryBase {
                        $vals['comment'] = $row->rc_comment;
                }
                
+               if ($this->fld_redirect)
+                       if($row->page_is_redirect)
+                               $vals['redirect'] = '';
+
                /* Add the patrolled flag */
                if ($this->fld_patrolled && $row->rc_patrolled == 1)
                        $vals['patrolled'] = '';
@@ -323,6 +337,7 @@ class ApiQueryRecentChanges extends ApiQueryBase {
                                        'title',
                                        'ids',
                                        'sizes',
+                                       'redirect',
                                        'patrolled'
                                )
                        ),
@@ -334,7 +349,9 @@ class ApiQueryRecentChanges extends ApiQueryBase {
                                        'bot',
                                        '!bot',
                                        'anon',
-                                       '!anon'
+                                       '!anon',
+                                       'redirect',
+                                       '!redirect'
                                )
                        ),
                        'limit' => array (