API: (bug 18743) Add ucprop=size (enabled by default) to list=usercontribs. Also...
authorRoan Kattouw <catrope@users.mediawiki.org>
Sun, 10 May 2009 09:25:46 +0000 (09:25 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Sun, 10 May 2009 09:25:46 +0000 (09:25 +0000)
RELEASE-NOTES
includes/api/ApiQueryUserContributions.php

index 4b27bd1..24c5bfd 100644 (file)
@@ -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 ===
 
index 701169b..76d0b45 100644 (file)
@@ -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',
                                )