Merge "Use expression builder instead of raw sql"

This commit is contained in:
jenkins-bot 2024-07-26 18:29:36 +00:00 committed by Gerrit Code Review
commit d396f44ff8
3 changed files with 6 additions and 5 deletions

View file

@ -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__ );

View file

@ -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__ );

View file

@ -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' ] );