From 22f93d003591a35b0320d398a50dd9baae4f191f Mon Sep 17 00:00:00 2001 From: Rostislav Wolny Date: Thu, 19 Dec 2019 18:05:24 +0100 Subject: [PATCH] Fill last_subscribed_at to all subscribed users who has it set to null [MAILPOET-2590] --- lib/Config/Populator.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Config/Populator.php b/lib/Config/Populator.php index 130de44cab..0b6a2fa3e8 100644 --- a/lib/Config/Populator.php +++ b/lib/Config/Populator.php @@ -623,11 +623,11 @@ class Populator { private function updateLastSubscribedAt() { global $wpdb; - // perform once for versions below or equal to 3.33.0 - if (version_compare($this->settings->get('db_version', '3.33.1'), '3.33.0', '>')) { + // perform once for versions below or equal to 3.41.2 + if (version_compare($this->settings->get('db_version', '3.41.3'), '3.41.2', '>')) { return false; } - $query = "UPDATE `%s` SET last_subscribed_at = GREATEST(COALESCE(confirmed_at, 0), COALESCE(created_at, 0)) WHERE status != '%s';"; + $query = "UPDATE `%s` SET last_subscribed_at = GREATEST(COALESCE(confirmed_at, 0), COALESCE(created_at, 0)) WHERE status != '%s' AND last_subscribed_at IS NULL;"; $wpdb->query(sprintf( $query, Subscriber::$_table,