diff --git a/lib/Config/Populator.php b/lib/Config/Populator.php index 53be0b65de..17132e3aef 100644 --- a/lib/Config/Populator.php +++ b/lib/Config/Populator.php @@ -10,6 +10,7 @@ use MailPoet\Models\NewsletterTemplate; use MailPoet\Models\Form; use MailPoet\Models\ScheduledTask; use MailPoet\Models\Segment; +use MailPoet\Models\SendingQueue; use MailPoet\Models\StatisticsForms; use MailPoet\Models\Subscriber; use MailPoet\Models\UserFlag; @@ -133,6 +134,7 @@ class Populator { $this->createMailPoetPage(); $this->createSourceForSubscribers(); $this->updateNewsletterCategories(); + $this->updateMetaFields(); $this->scheduleInitialInactiveSubscribersCheck(); // Will be uncommented on task [MAILPOET-1998] // $this->updateFormsSuccessMessages(); @@ -513,6 +515,20 @@ class Populator { return true; } + private function updateMetaFields() { + global $wpdb; + // perform once for versions below or equal to 3.26.0 + if (version_compare($this->settings->get('db_version', '3.26.1'), '3.26.0', '>')) { + return false; + } + $tables = [ScheduledTask::$_table, SendingQueue::$_table]; + foreach ($tables as $table) { + $query = "UPDATE `%s` SET meta = NULL WHERE meta = 'null'"; + $wpdb->query(sprintf($query, $table)); + } + return true; + } + private function scheduleInitialInactiveSubscribersCheck() { $task = ScheduledTask::where('type', InactiveSubscribers::TASK_TYPE) ->whereRaw('status = ? OR status IS NULL', [ScheduledTask::STATUS_SCHEDULED])