PluginProbe
ووسلام – همگام سازی ووکامرس و باسلام / 1.10.0
ووسلام – همگام سازی ووکامرس و باسلام v1.10.0
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.10.0, at includes/Migrations/Versions/Migration_1_7_8.php

40 lines 2.0 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 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.SchemaChange, WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, PluginCheck.Security.DirectDB.UnescapedDBParameter -- Migration schema change on own plugin table; identifier from $wpdb->prefix, not user input.
23 $wpdb->query("ALTER TABLE {$tableName} ADD COLUMN attempts TINYINT UNSIGNED NOT NULL DEFAULT 0");
24 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.SchemaChange, WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, PluginCheck.Security.DirectDB.UnescapedDBParameter -- Migration schema change on own plugin table; identifier from $wpdb->prefix, not user input.
25 $wpdb->query("ALTER TABLE {$tableName} ADD COLUMN max_attempts TINYINT UNSIGNED NOT NULL DEFAULT 3");
26 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.SchemaChange, WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, PluginCheck.Security.DirectDB.UnescapedDBParameter -- Migration schema change on own plugin table; identifier from $wpdb->prefix, not user input.
27 $wpdb->query("ALTER TABLE {$tableName} ADD COLUMN failed_at INT NULL");
28 }
29
30 private function removeProductOperationTypeSetting()
31 {
32 $settings = (array) get_option('sync_basalam_settings', []);
33
34 if (is_array($settings) && isset($settings['product_operation_type'])) {
35 unset($settings['product_operation_type']);
36 update_option('sync_basalam_settings', $settings);
37 }
38 }
39 }
40