Cleanup from r37839: just put ipb_auto in the relevant arrays. We have those arrays...
[lhc/web/wiklou.git] / includes / api / ApiQueryUserContributions.php
index 21ceb27..966a047 100644 (file)
@@ -31,7 +31,7 @@ if (!defined('MEDIAWIKI')) {
 /**
  * This query action adds a list of a specified user's contributions to the output.
  *
- * @addtogroup API
+ * @ingroup API
  */
 class ApiQueryContributions extends ApiQueryBase {
 
@@ -59,7 +59,6 @@ class ApiQueryContributions extends ApiQueryBase {
                $this->selectNamedDB('contributions', DB_SLAVE, 'contributions');
                $db = $this->getDB();
 
-
                if(isset($this->params['userprefix']))
                {
                        $this->prefixMode = true;
@@ -131,8 +130,8 @@ class ApiQueryContributions extends ApiQueryBase {
 
                //We're after the revision table, and the corresponding page row for
                //anything we retrieve.
-               list ($tbl_page, $tbl_revision) = $this->getDB()->tableNamesN('page', 'revision');
-               $this->addTables("$tbl_revision LEFT OUTER JOIN $tbl_page ON page_id=rev_page");
+               $this->addTables(array('revision', 'page'));
+               $this->addWhere('page_id=rev_page');
 
                $this->addWhereFld('rev_deleted', 0);
                // We only want pages by the specified users.
@@ -170,7 +169,8 @@ class ApiQueryContributions extends ApiQueryBase {
                        ));
 
                $this->addFieldsIf('rev_page', $this->fld_ids);
-               $this->addFieldsIf('rev_id', $this->fld_ids);
+               $this->addFieldsIf('rev_id', $this->fld_ids || $this->fld_flags);
+               $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_minor_edit', $this->fld_flags);
@@ -203,6 +203,8 @@ class ApiQueryContributions extends ApiQueryBase {
                                $vals['new'] = '';
                        if ($row->rev_minor_edit)
                                $vals['minor'] = '';
+                       if ($row->page_latest == $row->rev_id)
+                               $vals['top'] = '';
                }
 
                if ($this->fld_comment && !empty ($row->rev_comment))