PluginProbe
ووسلام – همگام سازی ووکامرس و باسلام / 1.8.6
ووسلام – همگام سازی ووکامرس و باسلام v1.8.6
1.10.19 1.10.20 1.10.18 1.10.17 1.10.15 1.10.14 1.10.13 1.10.12 1.10.10 1.10.9 1.10.8 1.10.7 1.10.6 1.10.5 1.10.4 1.10.3 1.10.2 1.10.1 1.10.0 1.9.2 1.9.1 1.9.0 1.8.8 1.8.5 1.8.6 All 53 releases
sync-basalam / includes / Migrations / Versions / Migration_1_7_8.php

Migration_1_7_8.php in ووسلام – همگام سازی ووکامرس و باسلام 1.8.6, at includes/Migrations/Versions/Migration_1_7_8.php

37 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace SyncBasalam\Migrations\Versions;
4
5 use SyncBasalam\Migrations\MigrationInterface;
6
7 defined('ABSPATH') || exit;
8
9 class Migration_1_7_8 implements MigrationInterface
10 {
11 public function up()
12 {
13 global $wpdb;
14 $tableName = $wpdb->prefix . 'sync_basalam_job_manager';
15
16 $this->addNewColumns($wpdb, $tableName);
17 $this->removeProductOperationTypeSetting();
18 }
19
20 private function addNewColumns($wpdb, $tableName)
21 {
22 $wpdb->query("ALTER TABLE {$tableName} ADD COLUMN attempts TINYINT UNSIGNED NOT NULL DEFAULT 0");
23 $wpdb->query("ALTER TABLE {$tableName} ADD COLUMN max_attempts TINYINT UNSIGNED NOT NULL DEFAULT 3");
24 $wpdb->query("ALTER TABLE {$tableName} ADD COLUMN failed_at INT NULL");
25 }
26
27 private function removeProductOperationTypeSetting()
28 {
29 $settings = (array) get_option('sync_basalam_settings', []);
30
31 if (is_array($settings) && isset($settings['product_operation_type'])) {
32 unset($settings['product_operation_type']);
33 update_option('sync_basalam_settings', $settings);
34 }
35 }
36 }
37