PluginProbe
ووسلام – همگام سازی ووکامرس و باسلام / 1.10.18
ووسلام – همگام سازی ووکامرس و باسلام v1.10.18
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 1.8.7 1.8.4 All 51 releases
sync-basalam / includes / Services / ForceUpdateGate.php

ForceUpdateGate.php in ووسلام – همگام سازی ووکامرس و باسلام 1.10.18, at includes/Services/ForceUpdateGate.php

38 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 namespace SyncBasalam\Services;
4
5 defined('ABSPATH') || exit;
6
7 class ForceUpdateGate
8 {
9 public static function shouldBlock($forceUpdate, string $installedVersion, string $runningVersion): bool
10 {
11 if (!$forceUpdate) return false;
12
13 // A newer plugin package must be allowed to boot so it can re-check
14 // the remote force-update status and run its migrations. Otherwise the
15 // flag set by the old version permanently prevents the update from
16 // taking effect even though WordPress reports the plugin as active.
17 return version_compare($installedVersion ?: '0.0.0', $runningVersion, '>=');
18 }
19
20 public static function shouldHonorRemoteFlag(
21 $forceUpdate,
22 string $runningVersion,
23 ?string $latestPublishedVersion
24 ): bool {
25 if (!$forceUpdate) return false;
26
27 // The version API currently treats versions it does not know about as
28 // forced updates. A hotfix newer than the latest published package is
29 // not outdated and must not disable itself because it has no download
30 // record yet.
31 if ($latestPublishedVersion && version_compare($runningVersion, $latestPublishedVersion, '>')) {
32 return false;
33 }
34
35 return true;
36 }
37 }
38