From df068ba0758466cfc3b0a3d4119f53acebf6e4a4 Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Fri, 12 Apr 2019 15:32:56 -0700 Subject: [PATCH] removeOrphanedEvents.php: Don't remove events waiting to be emailed echo_notification isn't the only table that refers to echo_event; echo_email_batch does too, so check it as well. Change-Id: I6663c8bb83a991ee663eb1616583fde8eee46751 --- maintenance/removeOrphanedEvents.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/maintenance/removeOrphanedEvents.php b/maintenance/removeOrphanedEvents.php index 5df3b3240..dfbf23cc7 100644 --- a/maintenance/removeOrphanedEvents.php +++ b/maintenance/removeOrphanedEvents.php @@ -1,6 +1,6 @@ addDescription( "Remove rows from echo_event that don't have corresponding rows in echo_notification" ); + $this->addDescription( "Remove rows from echo_event that don't have corresponding rows in echo_notification or echo_email_batch" ); $this->setBatchSize( 500 ); @@ -35,15 +35,17 @@ class RemoveOrphanedEvents extends LoggedUpdateMaintenance { $dbr = $dbFactory->getEchoDb( DB_REPLICA ); $iterator = new BatchRowIterator( $dbr, - [ 'echo_event', 'echo_notification' ], + [ 'echo_event', 'echo_notification', 'echo_email_batch' ], 'event_id', $this->mBatchSize ); $iterator->addJoinConditions( [ - 'echo_notification' => [ 'LEFT JOIN', 'notification_event=event_id' ] + 'echo_notification' => [ 'LEFT JOIN', 'notification_event=event_id' ], + 'echo_email_batch' => [ 'LEFT JOIN', 'eeb_event_id=event_id' ], ] ); $iterator->addConditions( [ - 'notification_user' => null + 'notification_user' => null, + 'eeb_user_id' => null, ] ); $this->output( "Removing orphaned echo_event rows...\n" );