private $params, $username;
private $fld_ids = false, $fld_title = false, $fld_timestamp = false,
$fld_comment = false, $fld_flags = false,
- $fld_patrolled = false;
+ $fld_patrolled = false, $fld_tags = false;
public function execute() {
$this->fld_flags = isset($prop['flags']);
$this->fld_timestamp = isset($prop['timestamp']);
$this->fld_patrolled = isset($prop['patrolled']);
+ $this->fld_tags = isset($prop['tags']);
// TODO: if the query is going only against the revision table, should this be done?
$this->selectNamedDB('contributions', DB_SLAVE, 'contributions');
private function prepareQuery() {
// We're after the revision table, and the corresponding page
// row for anything we retrieve. We may also need the
- // recentchanges row.
+ // recentchanges row and/or tag summary row.
global $wgUser;
$tables = array('page', 'revision'); // Order may change
$this->addWhere('page_id=rev_page');
}
if(!$wgUser->isAllowed('hideuser'))
- $this->addWhere('rev_deleted & ' . Revision::DELETED_USER . ' = 0');
+ $this->addWhere($this->getDB()->bitAnd('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) . "%'");
$this->addFieldsIf('rev_minor_edit', $this->fld_flags);
$this->addFieldsIf('rev_parent_id', $this->fld_flags);
$this->addFieldsIf('rc_patrolled', $this->fld_patrolled);
+
+ if($this->fld_tags || !is_null($this->params['tag'])) {
+ $this->addTables('tag_summary');
+ $this->addJoinConds(array('tag_summary' => array('LEFT JOIN', array('rev_id=ts_rev_id'))));
+ $this->addFields('ts_tags');
+ }
+
+ if( !is_null($this->params['tag']) ) {
+ $this->addWhereFld('ts_tags', $this->params['tag']);
+ }
}
/**
$vals['timestamp'] = wfTimestamp(TS_ISO_8601, $row->rev_timestamp);
if ($this->fld_flags) {
- if ($row->rev_parent_id == 0)
+ if ($row->rev_parent_id == 0 && !is_null($row->rev_parent_id))
$vals['new'] = '';
if ($row->rev_minor_edit)
$vals['minor'] = '';
if ($this->fld_patrolled && $row->rc_patrolled)
$vals['patrolled'] = '';
- if ( $this->fld_size && !is_null( $this->fld_size ) )
+ if ($this->fld_size && !is_null($row->rev_len))
$vals['size'] = intval($row->rev_len);
+ if ($this->fld_tags && $row->ts_tags)
+ $vals['tags'] = $row->ts_tags;
+
return $vals;
}
'size',
'flags',
'patrolled',
+ 'tags',
)
),
'show' => array (
'!patrolled',
)
),
+ 'tag' => null,
);
}
'prop' => 'Include additional pieces of information',
'show' => array('Show only items that meet this criteria, e.g. non minor edits only: show=!minor',
'NOTE: if show=patrolled or show=!patrolled is set, revisions older than $wgRCMaxAge won\'t be shown',),
+ 'tag' => 'Only list contributions with this tag',
);
}
public function getVersion() {
return __CLASS__ . ': $Id$';
}
-}
\ No newline at end of file
+}