$this->fld_patrolled = isset( $prop['patrolled'] );
$this->fld_tags = isset( $prop['tags'] );
+ // Most of this code will use the 'contributions' group DB, which can map to slaves
+ // with extra user based indexes or partioning by user. The additional metadata
+ // queries should use a regular slave since the lookup pattern is not all by user.
+ $dbSecondary = $this->getDB(); // any random slave
+
// TODO: if the query is going only against the revision table, should this be done?
$this->selectNamedDB( 'contributions', DB_SLAVE, 'contributions' );
$revIds[] = $row->rev_parent_id;
}
}
- $this->parentLens = Revision::getParentLengths( $this->getDB(), $revIds );
+ $this->parentLens = Revision::getParentLengths( $dbSecondary, $revIds );
$res->rewind(); // reset
}
$this->addWhereFld( 'page_namespace', $this->params['namespace'] );
$show = $this->params['show'];
+ if ( $this->params['toponly'] ) { // deprecated/old param
+ $show[] = 'top';
+ }
if ( !is_null( $show ) ) {
$show = array_flip( $show );
+
if ( ( isset( $show['minor'] ) && isset( $show['!minor'] ) )
|| ( isset( $show['patrolled'] ) && isset( $show['!patrolled'] ) )
+ || ( isset( $show['top'] ) && isset( $show['!top'] ) )
+ || ( isset( $show['new'] ) && isset( $show['!new'] ) )
) {
$this->dieUsageMsg( 'show' );
}
$this->addWhereIf( 'rev_minor_edit != 0', isset( $show['minor'] ) );
$this->addWhereIf( 'rc_patrolled = 0', isset( $show['!patrolled'] ) );
$this->addWhereIf( 'rc_patrolled != 0', isset( $show['patrolled'] ) );
+ $this->addWhereIf( 'rev_id != page_latest', isset( $show['!top'] ) );
+ $this->addWhereIf( 'rev_id = page_latest', isset( $show['top'] ) );
+ $this->addWhereIf( 'rev_parent_id != 0', isset( $show['!new'] ) );
+ $this->addWhereIf( 'rev_parent_id = 0', isset( $show['new'] ) );
}
$this->addOption( 'LIMIT', $this->params['limit'] + 1 );
$index = array( 'revision' => 'usertext_timestamp' );
$this->addWhereFld( 'ct_tag', $this->params['tag'] );
}
- if ( $this->params['toponly'] ) {
- $this->addWhere( 'rev_id = page_latest' );
- }
-
$this->addOption( 'USE INDEX', $index );
}
$vals['commenthidden'] = '';
$anyHidden = true;
}
- if ( Revision::userCanBitfield( $row->rev_deleted, Revision::DELETED_COMMENT, $this->getUser() ) ) {
+
+ $userCanView = Revision::userCanBitfield(
+ $row->rev_deleted,
+ Revision::DELETED_COMMENT, $this->getUser()
+ );
+
+ if ( $userCanView ) {
if ( $this->fld_comment ) {
$vals['comment'] = $row->rev_comment;
}
'!minor',
'patrolled',
'!patrolled',
+ 'top',
+ '!top',
+ 'new',
+ '!new',
)
),
'tag' => null,
- 'toponly' => false,
+ 'toponly' => array(
+ ApiBase::PARAM_DFLT => false,
+ ApiBase::PARAM_DEPRECATED => true,
+ ),
);
}
}
public function getDescription() {
- return 'Get all edits by a user';
+ return 'Get all edits by a user.';
}
public function getPossibleErrors() {