* @file
* @ingroup Watchlist
*
- * @license GNU GPL v2+
+ * @license GPL-2.0-or-later
*/
class WatchedItemQueryService {
$joinConds
);
- $limit = isset( $dbOptions['LIMIT'] ) ? $dbOptions['LIMIT'] : INF;
+ $limit = $dbOptions['LIMIT'] ?? INF;
$items = [];
$startFrom = null;
foreach ( $res as $row ) {
}
private function getRecentChangeFieldsFromRow( stdClass $row ) {
- // This can be simplified to single array_filter call filtering by key value,
- // once we stop supporting PHP 5.5
+ // FIXME: This can be simplified to single array_filter call filtering by key value,
+ // now we have stopped supporting PHP 5.5
$allFields = get_object_vars( $row );
$rcKeys = array_filter(
array_keys( $allFields ),
// TODO: not sure if this should simply ignore patrolled filters if user does not have the patrol
// right, or maybe rather fail loud at this point, same as e.g. ApiQueryWatchlist does?
if ( in_array( self::FILTER_PATROLLED, $options['filters'] ) ) {
- $conds[] = 'rc_patrolled != 0';
+ $conds[] = 'rc_patrolled != ' . RecentChange::PRC_UNPATROLLED;
} elseif ( in_array( self::FILTER_NOT_PATROLLED, $options['filters'] ) ) {
- $conds[] = 'rc_patrolled = 0';
+ $conds['rc_patrolled'] = RecentChange::PRC_UNPATROLLED;
}
if ( in_array( self::FILTER_AUTOPATROLLED, $options['filters'] ) ) {
- $conds[] = 'rc_patrolled = 2';
+ $conds['rc_patrolled'] = RecentChange::PRC_AUTOPATROLLED;
} elseif ( in_array( self::FILTER_NOT_AUTOPATROLLED, $options['filters'] ) ) {
- $conds[] = 'rc_patrolled != 2';
+ $conds[] = 'rc_patrolled != ' . RecentChange::PRC_AUTOPATROLLED;
}
}