Migration_20221028_105818.php
2 months ago
Migration_20221110_151621.php
3 years ago
Migration_20230111_120000.php
1 year ago
Migration_20230111_130000.php
3 years ago
Migration_20230215_050813.php
3 months ago
Migration_20230221_200520.php
3 years ago
Migration_20230421_135915.php
3 years ago
Migration_20230503_210945.php
3 years ago
Migration_20230605_174836.php
3 years ago
Migration_20230703_105957.php
3 years ago
Migration_20230716_130221_Db.php
2 years ago
Migration_20230824_054259_Db.php
2 years ago
Migration_20230831_124214_Db.php
2 years ago
Migration_20230831_143755_Db.php
1 year ago
Migration_20240119_113943_Db.php
2 years ago
Migration_20240617_122847_Db.php
2 years ago
Migration_20240725_182318_Db.php
2 years ago
Migration_20241007_170437_Db.php
1 year ago
Migration_20241108_103249_Db.php
3 months ago
Migration_20250903_151331_Db.php
11 months ago
Migration_20250926_153050_Db.php
10 months ago
Migration_20260415_090055_Db.php
3 months ago
Migration_20260427_100000.php
3 months ago
Migration_20260428_120000.php
3 months ago
Migration_20260430_103000_Db.php
3 months ago
Migration_20260430_120000.php
3 months ago
Migration_20260504_120000_Db.php
2 months ago
Migration_20260514_120000_Db.php
2 months ago
Migration_20260609_120000_Db.php
1 month ago
Migration_20260610_120000_Db.php
1 month ago
Migration_20260622_120000_Db.php
1 month ago
Migration_20260709_120000_Db.php
3 weeks ago
Migration_20260715_100000_Db.php
2 weeks ago
index.php
3 years ago
Migration_20240725_182318_Db.php
48 lines
| 1 | <?php declare(strict_types = 1); |
| 2 | |
| 3 | namespace MailPoet\Migrations\Db; |
| 4 | |
| 5 | if (!defined('ABSPATH')) exit; |
| 6 | |
| 7 | |
| 8 | use MailPoet\Migrator\DbMigration; |
| 9 | |
| 10 | class Migration_20240725_182318_Db extends DbMigration { |
| 11 | public function run(): void { |
| 12 | global $wpdb; |
| 13 | $automationRunsTable = esc_sql($wpdb->prefix . 'mailpoet_automation_runs'); |
| 14 | $automationRunLogsTable = esc_sql($wpdb->prefix . 'mailpoet_automation_run_logs'); |
| 15 | |
| 16 | if (!$this->tableExists($automationRunsTable) || !$this->tableExists($automationRunLogsTable)) { |
| 17 | return; |
| 18 | } |
| 19 | |
| 20 | // update failed automation runs that should be complete, but keep updated_at column unchanged |
| 21 | $this->connection->executeStatement( |
| 22 | "UPDATE $automationRunsTable |
| 23 | SET |
| 24 | `status` = 'complete', |
| 25 | `updated_at` = `updated_at` |
| 26 | WHERE id IN ( |
| 27 | SELECT `automation_run_id` |
| 28 | FROM $automationRunLogsTable |
| 29 | WHERE `status` = 'failed' |
| 30 | AND `error` LIKE '%nextStepNotScheduled%' |
| 31 | AND `step_key` = 'core:if-else' |
| 32 | )" |
| 33 | ); |
| 34 | |
| 35 | // update failed automation run logs that should be complete, but keep updated_at column unchanged |
| 36 | $this->connection->executeStatement( |
| 37 | "UPDATE $automationRunLogsTable |
| 38 | SET |
| 39 | `status` = 'complete', |
| 40 | `error` = NULL, |
| 41 | `updated_at` = `updated_at` |
| 42 | WHERE `status` = 'failed' |
| 43 | AND `error` LIKE '%nextStepNotScheduled%' |
| 44 | AND `step_key` = 'core:if-else'" |
| 45 | ); |
| 46 | } |
| 47 | } |
| 48 |