From 9c55278c40d48f757b4beaa20a426631734a88e5 Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Sun, 10 May 2009 09:25:46 +0000 Subject: [PATCH] API: (bug 18743) Add ucprop=size (enabled by default) to list=usercontribs. Also fix warning from r49732 --- RELEASE-NOTES | 1 + includes/api/ApiQueryUserContributions.php | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 4b27bd1690..24c5bfd337 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -137,6 +137,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN output * (bug 18731) Show correct SVN links for extension modules in api.php?version * (bug 18730) Add version information to action=paraminfo output +* (bug 18743) Add ucprop=size to list=usercontribs === Languages updated in 1.16 === diff --git a/includes/api/ApiQueryUserContributions.php b/includes/api/ApiQueryUserContributions.php index 701169b606..76d0b4578e 100644 --- a/includes/api/ApiQueryUserContributions.php +++ b/includes/api/ApiQueryUserContributions.php @@ -53,6 +53,7 @@ class ApiQueryContributions extends ApiQueryBase { $this->fld_ids = isset($prop['ids']); $this->fld_title = isset($prop['title']); $this->fld_comment = isset($prop['comment']); + $this->fld_size = isset($prop['size']); $this->fld_flags = isset($prop['flags']); $this->fld_timestamp = isset($prop['timestamp']); $this->fld_patrolled = isset($prop['patrolled']); @@ -161,7 +162,7 @@ class ApiQueryContributions extends ApiQueryBase { } if(!$wgUser->isAllowed('hideuser')) - $this->addWhereFld('rev_deleted & ' . Revision::DELETED_USER . ' = 0'); + $this->addWhere('rev_deleted & ' . Revision::DELETED_USER . ' = 0'); // We only want pages by the specified users. if($this->prefixMode) $this->addWhere("rev_user_text LIKE '" . $this->getDB()->escapeLike($this->userprefix) . "%'"); @@ -240,6 +241,7 @@ class ApiQueryContributions extends ApiQueryBase { $this->addFieldsIf('page_latest', $this->fld_flags); // $this->addFieldsIf('rev_text_id', $this->fld_ids); // Should this field be exposed? $this->addFieldsIf('rev_comment', $this->fld_comment); + $this->addFieldsIf('rev_len', $this->fld_size); $this->addFieldsIf('rev_minor_edit', $this->fld_flags); $this->addFieldsIf('rev_parent_id', $this->fld_flags); $this->addFieldsIf('rc_patrolled', $this->fld_patrolled); @@ -286,6 +288,9 @@ class ApiQueryContributions extends ApiQueryBase { if ($this->fld_patrolled && $row->rc_patrolled) $vals['patrolled'] = ''; + + if ($this->fld_size ) + $vals['size'] = intval($row->rev_len); return $vals; } @@ -329,12 +334,13 @@ class ApiQueryContributions extends ApiQueryBase { ), 'prop' => array ( ApiBase :: PARAM_ISMULTI => true, - ApiBase :: PARAM_DFLT => 'ids|title|timestamp|flags|comment', + ApiBase :: PARAM_DFLT => 'ids|title|timestamp|comment|size|flags', ApiBase :: PARAM_TYPE => array ( 'ids', 'title', 'timestamp', 'comment', + 'size', 'flags', 'patrolled', ) -- 2.20.1