/**
* 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'] );
|| ( isset( $show['patrolled'] ) && isset( $show['!patrolled'] ) )
|| ( isset( $show['patrolled'] ) && isset( $show['unpatrolled'] ) )
|| ( isset( $show['!patrolled'] ) && isset( $show['unpatrolled'] ) )
+ || ( isset( $show['autopatrolled'] ) && isset( $show['!autopatrolled'] ) )
+ || ( isset( $show['autopatrolled'] ) && isset( $show['unpatrolled'] ) )
+ || ( isset( $show['autopatrolled'] ) && isset( $show['!patrolled'] ) )
) {
$this->dieWithError( 'apierror-show' );
}
if ( isset( $show['patrolled'] )
|| isset( $show['!patrolled'] )
|| isset( $show['unpatrolled'] )
+ || isset( $show['autopatrolled'] )
+ || isset( $show['!autopatrolled'] )
) {
if ( !$user->useRCPatrol() && !$user->useNPPatrol() ) {
$this->dieWithError( 'apierror-permissiondenied-patrolflag', 'permissiondenied' );
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 != ' . 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(
'page_is_redirect = 0 OR page_is_redirect IS NULL',
/* Add the patrolled flag */
if ( $this->fld_patrolled ) {
- $vals['patrolled'] = $row->rc_patrolled == 1;
+ $vals['patrolled'] = $row->rc_patrolled != RecentChange::PRC_UNPATROLLED;
$vals['unpatrolled'] = ChangesList::isUnpatrolled( $row, $user );
+ $vals['autopatrolled'] = $row->rc_patrolled == RecentChange::PRC_AUTOPATROLLED;
}
if ( $this->fld_loginfo && $row->rc_type == RC_LOG ) {
'!redirect',
'patrolled',
'!patrolled',
- 'unpatrolled'
+ 'unpatrolled',
+ 'autopatrolled',
+ '!autopatrolled',
]
],
'limit' => [
ApiBase::PARAM_TYPE => RecentChange::getChangeTypes()
],
'toponly' => false,
+ 'title' => null,
'continue' => [
ApiBase::PARAM_HELP_MSG => 'api-help-param-continue',
],