Add a migration to fix meta fields [MAILPOET-2073]
This commit is contained in:
@ -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])
|
||||
|
Reference in New Issue
Block a user