diff --git a/includes/EmailBatch.php b/includes/EmailBatch.php index a7110aedc..b72b15e76 100644 --- a/includes/EmailBatch.php +++ b/includes/EmailBatch.php @@ -290,7 +290,7 @@ class EmailBatch { $iterator->addConditions( [ 'eeb_user_id' => $this->mUser->getId() ] ); if ( $this->lastEvent ) { // There is a processed cutoff point - $iterator->addConditions( [ 'eeb_event_id <= ' . (int)$this->lastEvent ] ); + $iterator->addConditions( [ $dbr->expr( 'eeb_event_id', '<=', (int)$this->lastEvent ) ] ); } $iterator->setCaller( __METHOD__ ); diff --git a/includes/Mapper/NotificationMapper.php b/includes/Mapper/NotificationMapper.php index 75732853b..804e3bc9a 100644 --- a/includes/Mapper/NotificationMapper.php +++ b/includes/Mapper/NotificationMapper.php @@ -135,7 +135,8 @@ class NotificationMapper extends AbstractMapper { array $titles = null, $dbSource = DB_REPLICA ) { - $conds = [ 'notification_read_timestamp IS NOT NULL' ]; + $dbr = $this->dbFactory->getEchoDb( $dbSource ); + $conds = [ $dbr->expr( 'notification_read_timestamp', '!=', null ) ]; if ( $titles ) { $conds['event_page_id'] = $this->getIdsForTitles( $titles ); if ( !$conds['event_page_id'] ) { @@ -366,7 +367,7 @@ class NotificationMapper extends AbstractMapper { ); $iterator->addConditions( [ 'notification_user' => $userId, - 'notification_event < ' . (int)$eventId + $dbw->expr( 'notification_event', '<', (int)$eventId ), ] ); $iterator->setCaller( __METHOD__ ); diff --git a/maintenance/removeOrphanedEvents.php b/maintenance/removeOrphanedEvents.php index 58754b070..4b97c34d7 100644 --- a/maintenance/removeOrphanedEvents.php +++ b/maintenance/removeOrphanedEvents.php @@ -73,7 +73,7 @@ class RemoveOrphanedEvents extends LoggedUpdateMaintenance { $iterator->addConditions( [ 'notification_user' => null, 'eeb_user_id' => null, - 'event_id < ' . $maxId + $dbr->expr( 'event_id', '<', $maxId ), ] ); $iterator->setCaller( __METHOD__ ); @@ -113,7 +113,7 @@ class RemoveOrphanedEvents extends LoggedUpdateMaintenance { $iterator->addConditions( [ 'event_type' => null, - 'etp_event < ' . $maxId + $dbr->expr( 'etp_event', '<', $maxId ), ] ); $iterator->addOptions( [ 'DISTINCT' ] );