PluginProbe
ووسلام – همگام سازی ووکامرس و باسلام / 1.10.22
ووسلام – همگام سازی ووکامرس و باسلام v1.10.22
1.10.22 1.10.21 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 All 55 releases
← All changes | sync-basalam.php +25 -4 1.9.1 → 1.10.22 View file →
@@ -1,4 +1,4 @@
1 1 <?php
2 2
3 3 use SyncBasalam\Plugin;
4 4 use SyncBasalam\Admin\Settings\SettingsContainer;
@@ -5,8 +5,11 @@
5 5 use SyncBasalam\Activator;
6 6 use SyncBasalam\JobsRunner;
7 7 use SyncBasalam\Infrastructure\Container\AppServiceProvider;
8 8 use SyncBasalam\Infrastructure\Container\Container;
9 +use SyncBasalam\Services\ForceUpdateGate;
10 +use SyncBasalam\Services\VendorSyncPolicy;
11 +use SyncBasalam\Services\ScheduledProductSync;
9 12
10 13 defined('ABSPATH') || exit;
11 14
12 15 /**
@@ -11,12 +14,12 @@
11 14
12 15 /**
13 16 * Plugin Name: sync basalam | ووسلام
14 17 * Description: با استفاده از پلاگین ووسلام میتوایند تمامی محصولات ووکامرس را با یک کلیک به غرفه باسلامی خود اضافه کنید‌، همچنین تمامی سفارش باسلامی شما به سایت شما اضافه میگردد.
15 - * Version: 1.9.1
18 + * Version: 1.10.22
16 19 * Author: Woosalam Dev
17 - * Author URI: https://wp.hamsalam.ir/
18 - * Plugin URI: https://wp.hamsalam.ir
20 + * Author URI: https://hamsalam.ir/wp
21 + * Plugin URI: https://hamsalam.ir/wp
19 22 * Text Domain: sync-basalam
20 23 * WC requires at least: 10.0.0
21 24 * WC tested up to: 9.9.5
22 25 * Requires Plugins: woocommerce
@@ -26,8 +29,9 @@
26 29
27 30 require_once __DIR__ . '/vendor/autoload.php';
28 31
29 32 register_activation_hook(__FILE__, 'syncBasalamActivatePlugin');
33 +register_deactivation_hook(__FILE__, 'syncBasalamDeactivatePlugin');
30 34
31 35 add_action('before_woocommerce_init', function () {
32 36 if (class_exists(\Automattic\WooCommerce\Utilities\FeaturesUtil::class)) {
33 37 \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility('custom_order_tables', __FILE__, true);
@@ -33,9 +37,12 @@
33 37 \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility('custom_order_tables', __FILE__, true);
34 38 }
35 39 });
36 40
37 -if (get_option('sync_basalam_force_update')) {
41 +$forceUpdate = get_option('sync_basalam_force_update');
42 +$installedVersion = (string) (get_option('sync_basalam_version') ?: '0.0.0');
43 +
44 +if (ForceUpdateGate::shouldBlock($forceUpdate, $installedVersion, Plugin::VERSION)) {
38 45 add_action('admin_notices', function () {
39 46 $template = __DIR__ . '/templates/notifications/ForceUpdateAlert.php';
40 47 require_once $template;
41 48 });
@@ -41,8 +48,12 @@
41 48 });
42 49 return;
43 50 }
44 51
52 +if ($forceUpdate) {
53 + delete_option('sync_basalam_force_update');
54 +}
55 +
45 56 add_action('init', 'syncBasalamPlugin');
46 57
47 58 function syncBasalamContainer()
48 59 {
@@ -70,8 +81,18 @@
70 81
71 82 function syncBasalamActivatePlugin()
72 83 {
73 84 Activator::activate();
85 + syncBasalamContainer()->get(VendorSyncPolicy::class)->ensureScheduled();
86 + (new ScheduledProductSync())->ensureScheduled();
74 87 set_transient('sync_basalam_just_activated', true, 10);
75 88 }
76 89
90 +function syncBasalamDeactivatePlugin()
91 +{
92 + VendorSyncPolicy::unschedule();
93 + ScheduledProductSync::unschedule();
94 +}
95 +
77 96 syncBasalamContainer()->get(JobsRunner::class);
97 +syncBasalamContainer()->get(VendorSyncPolicy::class)->registerHooks();
98 +(new ScheduledProductSync())->registerHooks();