From c7040e32857bee672fd56f7cd76625441ade2304 Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Sun, 24 Feb 2008 20:23:33 +0000 Subject: [PATCH] (bug 13128) Add patrolled flag to list=recentchanges --- RELEASE-NOTES | 1 + includes/api/ApiQueryRecentChanges.php | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index ce50a80506..d23a305a8d 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -40,6 +40,7 @@ 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 === Languages updated in 1.13 === diff --git a/includes/api/ApiQueryRecentChanges.php b/includes/api/ApiQueryRecentChanges.php index d01b7a55f9..511276aa97 100644 --- a/includes/api/ApiQueryRecentChanges.php +++ b/includes/api/ApiQueryRecentChanges.php @@ -108,6 +108,11 @@ class ApiQueryRecentChanges extends ApiQueryBase { $this->fld_title = isset ($prop['title']); $this->fld_ids = isset ($prop['ids']); $this->fld_sizes = isset ($prop['sizes']); + $this->fld_patrolled = isset($prop['patrolled']); + + global $wgUser; + if($this->fld_patrolled && !$wgUser->isAllowed('patrol')) + $this->dieUsage("You need the patrol right to request the patrolled flag"); /* Add fields to our query if they are specified as a needed parameter. */ $this->addFieldsIf('rc_id', $this->fld_ids); @@ -122,6 +127,7 @@ class ApiQueryRecentChanges extends ApiQueryBase { $this->addFieldsIf('rc_new', $this->fld_flags); $this->addFieldsIf('rc_old_len', $this->fld_sizes); $this->addFieldsIf('rc_new_len', $this->fld_sizes); + $this->addFieldsIf('rc_patrolled', $this->fld_patrolled); } /* Specify the limit for our query. It's $limit+1 because we (possibly) need to @@ -239,6 +245,10 @@ class ApiQueryRecentChanges extends ApiQueryBase { if ($this->fld_comment && !empty ($row->rc_comment)) { $vals['comment'] = $row->rc_comment; } + + /* Add the patrolled flag */ + if ($this->fld_patrolled && $row->rc_patrolled == 1) + $vals['patrolled'] = ''; return $vals; } @@ -289,7 +299,8 @@ class ApiQueryRecentChanges extends ApiQueryBase { 'timestamp', 'title', 'ids', - 'sizes' + 'sizes', + 'patrolled' ) ), 'show' => array ( -- 2.20.1