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 ) {
$this->addWhereIf( 'rev_minor_edit = 0', isset( $show['!minor'] ) );
$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( 'rc_patrolled != 2', isset( $show['!autopatrolled'] ) );
- $this->addWhereIf( 'rc_patrolled = 2', isset( $show['autopatrolled'] ) );
+ $this->addWhereIf(
+ 'rc_patrolled = ' . RecentChange::PRC_UNPATROLLED,
+ isset( $show['!patrolled'] )
+ );
+ $this->addWhereIf(
+ 'rc_patrolled != ' . RecentChange::PRC_UNPATROLLED,
+ isset( $show['patrolled'] )
+ );
+ $this->addWhereIf(
+ 'rc_patrolled != ' . RecentChange::PRC_AUTOPATROLLED,
+ isset( $show['!autopatrolled'] )
+ );
+ $this->addWhereIf(
+ 'rc_patrolled = ' . RecentChange::PRC_AUTOPATROLLED,
+ isset( $show['autopatrolled'] )
+ );
$this->addWhereIf( $idField . ' != page_latest', isset( $show['!top'] ) );
$this->addWhereIf( $idField . ' = page_latest', isset( $show['top'] ) );
$this->addWhereIf( 'rev_parent_id != 0', isset( $show['!new'] ) );
/* Add the patrolled flag */
if ( $this->fld_patrol ) {
- $vals['patrolled'] = $recentChangeInfo['rc_patrolled'] != 0;
+ $vals['patrolled'] = $recentChangeInfo['rc_patrolled'] != RecentChange::PRC_UNPATROLLED;
$vals['unpatrolled'] = ChangesList::isUnpatrolled( (object)$recentChangeInfo, $user );
- $vals['autopatrolled'] = $recentChangeInfo['rc_patrolled'] == 2;
+ $vals['autopatrolled'] = $recentChangeInfo['rc_patrolled'] == RecentChange::PRC_AUTOPATROLLED;
}
if ( $this->fld_loginfo && $recentChangeInfo['rc_type'] == RC_LOG ) {
$dbw->update(
'recentchanges',
[
- 'rc_patrolled' => 1
+ 'rc_patrolled' => self::PRC_PATROLLED
],
[
'rc_id' => $this->getAttribute( 'rc_id' )
'rc_last_oldid' => 0,
'rc_bot' => $user->isAllowed( 'bot' ) ? (int)$wgRequest->getBool( 'bot', true ) : 0,
'rc_ip' => self::checkIPAddress( $ip ),
- 'rc_patrolled' => $markPatrolled ? 1 : 0,
+ 'rc_patrolled' => $markPatrolled ? self::PRC_PATROLLED : self::PRC_UNPATROLLED,
'rc_new' => 0, # obsolete
'rc_old_len' => null,
'rc_new_len' => null,
'rc_last_oldid' => $oldRevId,
'rc_bot' => $bot ? 1 : 0,
'rc_ip' => self::checkIPAddress( $ip ),
- 'rc_patrolled' => 1, // Always patrolled, just like log entries
+ 'rc_patrolled' => self::PRC_PATROLLED, // Always patrolled, just like log entries
'rc_new' => 0, # obsolete
'rc_old_len' => null,
'rc_new_len' => null,
[
'rc_timestamp' => $db->timestamp( $this->mNewRev->getTimestamp() ),
'rc_this_oldid' => $this->mNewid,
- 'rc_patrolled' => 0
+ 'rc_patrolled' => RecentChange::PRC_UNPATROLLED
],
__METHOD__
);
// Log the autopatrol if the log entry is patrollable
if ( $this->getIsPatrollable() &&
- $rc->getAttribute( 'rc_patrolled' ) === 2
+ $rc->getAttribute( 'rc_patrolled' ) === RecentChange::PRC_AUTOPATROLLED
) {
PatrolLog::record( $rc, true, $this->getPerformer() );
}
if ( $wgUseRCPatrol ) {
// Mark all reverted edits as patrolled
- $set['rc_patrolled'] = 1;
+ $set['rc_patrolled'] = RecentChange::PRC_PATROLLED;
}
if ( count( $set ) ) {