Fill last_subscribed_at to all subscribed users who has it set to null

[MAILPOET-2590]
This commit is contained in:
Rostislav Wolny
2019-12-19 18:05:24 +01:00
committed by Jack Kitterhing
parent 797192da7c
commit 22f93d0035

View File

@@ -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,