/**
* Generates and outputs the result of this query based upon the provided parameters.
*
- * @param ApiPageSet $resultPageSet
+ * @param ApiPageSet|null $resultPageSet
*/
public function run( $resultPageSet = null ) {
$user = $this->getUser();
}
}
+ $title = $params['title'];
+ if ( !is_null( $title ) ) {
+ $titleObj = Title::newFromText( $title );
+ if ( is_null( $titleObj ) ) {
+ $this->dieWithError( [ 'apierror-invalidtitle', wfEscapeWikiText( $title ) ] );
+ }
+ $this->addWhereFld( 'rc_namespace', $titleObj->getNamespace() );
+ $this->addWhereFld( 'rc_title', $titleObj->getDBkey() );
+ }
+
if ( !is_null( $params['show'] ) ) {
$show = array_flip( $params['show'] );
if ( isset( $show['unpatrolled'] ) ) {
// See ChangesList::isUnpatrolled
if ( $user->useRCPatrol() ) {
- $this->addWhere( 'rc_patrolled = 0' );
+ $this->addWhere( 'rc_patrolled = ' . RecentChange::PRC_UNPATROLLED );
} elseif ( $user->useNPPatrol() ) {
- $this->addWhere( 'rc_patrolled = 0' );
+ $this->addWhere( 'rc_patrolled = ' . RecentChange::PRC_UNPATROLLED );
$this->addWhereFld( 'rc_type', RC_NEW );
}
}
- $this->addWhereIf( 'rc_patrolled != 2', isset( $show['!autopatrolled'] ) );
- $this->addWhereIf( 'rc_patrolled = 2', isset( $show['autopatrolled'] ) );
+ $this->addWhereIf(
+ 'rc_patrolled != ' . RecentChange::PRC_AUTOPATROLLED,
+ isset( $show['!autopatrolled'] )
+ );
+ $this->addWhereIf(
+ 'rc_patrolled = ' . RecentChange::PRC_AUTOPATROLLED,
+ isset( $show['autopatrolled'] )
+ );
// Don't throw log entries out the window here
$this->addWhereIf(
/* Add the patrolled flag */
if ( $this->fld_patrolled ) {
- $vals['patrolled'] = $row->rc_patrolled != 0;
+ $vals['patrolled'] = $row->rc_patrolled != RecentChange::PRC_UNPATROLLED;
$vals['unpatrolled'] = ChangesList::isUnpatrolled( $row, $user );
- $vals['autopatrolled'] = $row->rc_patrolled == 2;
+ $vals['autopatrolled'] = $row->rc_patrolled == RecentChange::PRC_AUTOPATROLLED;
}
if ( $this->fld_loginfo && $row->rc_type == RC_LOG ) {
ApiBase::PARAM_TYPE => RecentChange::getChangeTypes()
],
'toponly' => false,
+ 'title' => null,
'continue' => [
ApiBase::PARAM_HELP_MSG => 'api-help-param-continue',
],