mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-23 23:44:53 +00:00
Merge "Use expression builder instead of raw sql"
This commit is contained in:
commit
d396f44ff8
|
@ -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__ );
|
||||
|
||||
|
|
|
@ -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__ );
|
||||
|
||||
|
|
|
@ -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' ] );
|
||||
|
|
Loading…
Reference in a new issue