PluginProbe
Adminify – White Label, Admin Menu Editor, Login Customizer / 4.0
Adminify – White Label, Admin Menu Editor, Login Customizer v4.0
4.3.1 4.3.0 4.2.26 4.2.25 4.2.24 4.2.23 4.2.22 4.2.21 4.2.20 4.2.19 4.2.18 4.2.17 4.2.16 4.2.15 4.2.14 4.2.13 4.2.12 4.2.11 4.2.10 4.2.9 4.2.8 4.2.7 4.2.6 4.2.5 4.1.17 All 164 releases
adminify / Inc / Classes / Upgrade.php

Upgrade.php in Adminify – White Label, Admin Menu Editor, Login Customizer 4.0, at Inc/Classes/Upgrade.php

70 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace WPAdminify\Inc\Classes;
4
5 class Upgrade
6 {
7
8 /**
9 * Plugin version option key
10 *
11 * @var string $option_name
12 */
13 protected $option_name = 'wp_adminify_version';
14
15 /**
16 * Lists of upgrades
17 *
18 * @var string[] $upgrades
19 */
20 protected $upgrades = [
21 '3.0.2' => 'Upgrades/upgrade-3.0.2.php',
22 '3.0.9' => 'Upgrades/upgrade-3.0.9.php',
23 '3.2.4.4' => 'Upgrades/upgrade-3.2.4.4.php',
24 '4.0' => 'Upgrades/upgrade-4.0.php',
25 ];
26
27 /**
28 * Get plugin installed version
29 *
30 * @return string
31 */
32 protected function get_installed_version()
33 {
34 return get_option($this->option_name, '1.0.0');
35 }
36
37 /**
38 * Check if plugin's update is available
39 *
40 * @return bool
41 */
42 public function if_updates_available()
43 {
44 if (version_compare($this->get_installed_version(), WP_ADMINIFY_VER, '<')) {
45 return true;
46 }
47
48 return false;
49 }
50
51 /**
52 * Run plugin updates
53 *
54 * @return void
55 */
56 public function run_updates()
57 {
58 $installed_version = $this->get_installed_version();
59 $path = trailingslashit(__DIR__);
60
61 foreach ($this->upgrades as $version => $file) {
62 if (version_compare($installed_version, $version, '<')) {
63 include $path . $file;
64 }
65 }
66
67 // update_option( $this->option_name, WP_ADMINIFY_VER );
68 }
69 }
70