/**
* This query action adds a list of a specified user's contributions to the output.
- *
+ *
* @addtogroup API
*/
class ApiQueryContributions extends ApiQueryBase {
// Parse some parameters
$this->params = $this->extractRequestParams();
- $prop = array_flip($this->params['prop']);
+ $prop = array_flip($this->params['prop']);
$this->fld_ids = isset($prop['ids']);
$this->fld_title = isset($prop['title']);
$this->fld_comment = isset($prop['comment']);
$this->dieUsage( 'User parameter may not be empty', 'param_user' );
}
}
-
+
/**
* Prepares the query and returns the limit of rows requested
*/
//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->addWhereFld('rev_deleted', 0);
// We only want pages by the specified users.
if($this->prefixMode)
$this->addWhere("rev_user_text LIKE '" . $this->getDb()->escapeLike($this->userprefix) . "%'");
- else
+ else
$this->addWhereFld( 'rev_user_text', $this->usernames );
// ... and in the specified timeframe.
// Ensure the same sort order for rev_user_text and rev_timestamp
// so our query is indexed
$this->addWhereRange('rev_user_text', $this->params['dir'], null, null);
- $this->addWhereRange('rev_timestamp',
+ $this->addWhereRange('rev_timestamp',
$this->params['dir'], $this->params['start'], $this->params['end'] );
$this->addWhereFld('page_namespace', $this->params['namespace']);
// Mandatory fields: timestamp allows request continuation
// ns+title checks if the user has access rights for this page
- // user_text is necessary if multiple users were specified
+ // user_text is necessary if multiple users were specified
$this->addFields(array(
'rev_timestamp',
'page_namespace',
'page_title',
'rev_user_text',
));
-
+
$this->addFieldsIf('rev_page', $this->fld_ids);
$this->addFieldsIf('rev_id', $this->fld_ids);
// $this->addFieldsIf('rev_text_id', $this->fld_ids); // Should this field be exposed?
$this->addFieldsIf('rev_minor_edit', $this->fld_flags);
$this->addFieldsIf('page_is_new', $this->fld_flags);
}
-
+
/**
* Extract fields from the database row and append them to a result array
*/
$vals['user'] = $row->rev_user_text;
if ($this->fld_ids) {
$vals['pageid'] = intval($row->rev_page);
- $vals['revid'] = intval($row->rev_id);
+ $vals['revid'] = intval($row->rev_id);
// $vals['textid'] = intval($row->rev_text_id); // todo: Should this field be exposed?
}
-
+
if ($this->fld_title)
- ApiQueryBase :: addTitleInfo($vals,
+ ApiQueryBase :: addTitleInfo($vals,
Title :: makeTitle($row->page_namespace, $row->page_title));
if ($this->fld_timestamp)
return __CLASS__ . ': $Id$';
}
}
-