* @file
*/
-if ( !defined( 'MEDIAWIKI' ) ) {
- // Eclipse helper - will be ignored in production
- require_once( 'ApiQueryBase.php' );
-}
-
/**
* This query action adds a list of a specified user's contributions to the output.
*
// We're after the revision table, and the corresponding page
// row for anything we retrieve. We may also need the
// recentchanges row and/or tag summary row.
- global $wgUser;
+ $user = $this->getUser();
$tables = array( 'page', 'revision' ); // Order may change
$this->addWhere( 'page_id=rev_page' );
);
}
- if ( !$wgUser->isAllowed( 'hideuser' ) ) {
+ if ( !$user->isAllowed( 'hideuser' ) ) {
$this->addWhere( $this->getDB()->bitAnd( 'rev_deleted', Revision::DELETED_USER ) . ' = 0' );
}
// We only want pages by the specified users.
if ( $this->multiUserMode ) {
$this->addWhereRange( 'rev_user_text', $this->params['dir'], null, null );
}
- $this->addWhereRange( 'rev_timestamp',
+ $this->addTimestampWhereRange( 'rev_timestamp',
$this->params['dir'], $this->params['start'], $this->params['end'] );
$this->addWhereFld( 'page_namespace', $this->params['namespace'] );
if ( !is_null( $show ) ) {
$show = array_flip( $show );
if ( ( isset( $show['minor'] ) && isset( $show['!minor'] ) )
- || ( isset( $show['patrolled'] ) && isset( $show['!patrolled'] ) ) ) {
+ || ( isset( $show['patrolled'] ) && isset( $show['!patrolled'] ) ) ) {
$this->dieUsageMsg( 'show' );
}
if ( isset( $show['patrolled'] ) || isset( $show['!patrolled'] ) ||
$this->fld_patrolled ) {
- if ( !$wgUser->useRCPatrol() && !$wgUser->useNPPatrol() ) {
+ if ( !$user->useRCPatrol() && !$user->useNPPatrol() ) {
$this->dieUsage( 'You need the patrol right to request the patrolled flag', 'permissiondenied' );
}
// $this->addFieldsIf( 'rev_text_id', $this->fld_ids ); // Should this field be exposed?
$this->addFieldsIf( 'rev_comment', $this->fld_comment || $this->fld_parsedcomment );
$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( array( 'rev_minor_edit', 'rev_parent_id' ), $this->fld_flags );
$this->addFieldsIf( 'rc_patrolled', $this->fld_patrolled );
if ( $this->fld_tags ) {
/**
* Extract fields from the database row and append them to a result array
+ *
+ * @param $row
+ * @return array
*/
private function extractRowInfo( $row ) {
$vals = array();
}
if ( $this->fld_parsedcomment ) {
- global $wgUser;
- $vals['parsedcomment'] = $wgUser->getSkin()->formatComment( $row->rev_comment, $title );
+ $vals['parsedcomment'] = Linker::formatComment( $row->rev_comment, $title );
}
}
}
' tags - Lists tags for the edit',
),
'show' => array( "Show only items that meet this criteria, e.g. non minor edits only: {$p}show=!minor",
- "NOTE: if {$p}show=patrolled or {$p}show=!patrolled is set, revisions older than $wgRCMaxAge won\'t be shown", ),
+ "NOTE: if {$p}show=patrolled or {$p}show=!patrolled is set, revisions older than \$wgRCMaxAge ($wgRCMaxAge) won't be shown", ),
'tag' => 'Only list revisions tagged with this tag',
'toponly' => 'Only list changes which are the latest revision',
);
) );
}
- protected function getExamples() {
+ public function getExamples() {
return array(
'api.php?action=query&list=usercontribs&ucuser=YurikBot',
'api.php?action=query&list=usercontribs&ucuserprefix=217.121.114.',
);
}
+ public function getHelpUrls() {
+ return 'https://www.mediawiki.org/wiki/API:Usercontribs';
+ }
+
public function getVersion() {
return __CLASS__ . ': $Id$';
}