PluginProbe
Yatra – Travel Booking & Tour Operator Software / 3.0.16
Yatra – Travel Booking & Tour Operator Software v3.0.16
3.0.16 3.0.15 3.0.14 3.0.14.1 3.0.14.2 3.0.12 3.0.13 3.0.11 3.0.10 3.0.9 3.0.8 3.0.7 3.0.6 3.0.5 3.0.5.1 3.0.4 3.0.3 3.0.2.9 3.0.2.7 3.0.2.8 3.0.2.6 trunk 1.0.0 2.0.0 2.0.1 All 84 releases
yatra / app / Upgrades / Versions / Upgrade_3_0_3.php

Upgrade_3_0_3.php in Yatra – Travel Booking & Tour Operator Software 3.0.16, at app/Upgrades/Versions/Upgrade_3_0_3.php

50 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 declare(strict_types=1);
4
5 namespace Yatra\Upgrades\Versions;
6
7 use Yatra\Services\InstallerService;
8 use Yatra\Upgrades\AbstractUpgradeStep;
9
10 /**
11 * Free 3.0.3: drop legacy payment-token tables after Pro (or nothing) has migrated scheduled rows.
12 *
13 * Canonical table name matches Pro {@see \YatraPro\Upgrades\Versions\Upgrade_3_0_0_1} (`wp_*_yatra_payment_tokens`).
14 * Some installs may still have a mistaken `yatra_new_payment_tokens` name from early builds; drop both if present.
15 */
16 final class Upgrade_3_0_3 extends AbstractUpgradeStep
17 {
18 public static function targetVersion(): string
19 {
20 return '3.0.3';
21 }
22
23 public static function runOnHooks(): array
24 {
25 return ['admin_init'];
26 }
27
28 public static function run(string $fromVersion, string $toVersion): void
29 {
30 unset($fromVersion, $toVersion);
31
32 global $wpdb;
33
34 $suffixes = [
35 'yatra_payment_tokens',
36 'yatra_new_payment_tokens',
37 ];
38
39 foreach ($suffixes as $suffix) {
40 $table = $wpdb->prefix . $suffix;
41 if (!InstallerService::databaseTableExists($table)) {
42 continue;
43 }
44
45 // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- table name is escaped.
46 $wpdb->query('DROP TABLE IF EXISTS `' . esc_sql($table) . '`');
47 }
48 }
49 }
50