From b3bdc1ec020ef594402fb051b6a146143750bd54 Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Mon, 7 Apr 2008 13:01:57 +0000 Subject: [PATCH] (bug 13618) Added rcprop=redirect and rcshow=redirect to list=recentchanges --- RELEASE-NOTES | 1 + includes/api/ApiQueryRecentChanges.php | 25 +++++++++++++++++++++---- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 4be4671631..642172ac7d 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 === diff --git a/includes/api/ApiQueryRecentChanges.php b/includes/api/ApiQueryRecentChanges.php index eb0c23a078..fa8d9fa520 100644 --- a/includes/api/ApiQueryRecentChanges.php +++ b/includes/api/ApiQueryRecentChanges.php @@ -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 ( -- 2.20.1