PluginProbe
Adminify – White Label, Admin Menu Editor, Login Customizer / 4.3.0
Adminify – White Label, Admin Menu Editor, Login Customizer v4.3.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.3.0, at Inc/Classes/Upgrade.php

84 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace PXLBSAdminify\Inc\Classes;
4
5 if ( ! defined( 'ABSPATH' ) ) {
6 exit; // Exit if accessed directly.
7 }
8
9 class Upgrade
10 {
11
12 /**
13 * Plugin version option key
14 *
15 * @var string $option_name
16 */
17 protected $option_name = 'pxlbsadminify_version';
18
19 /**
20 * Lists of upgrades
21 *
22 * @var string[] $upgrades
23 */
24 protected $upgrades = [
25 '3.0.2' => 'Upgrades/upgrade-3.0.2.php',
26 '3.0.9' => 'Upgrades/upgrade-3.0.9.php',
27 '3.2.4.4' => 'Upgrades/upgrade-3.2.4.4.php',
28 '4.0.1' => 'Upgrades/upgrade-4.0.php',
29 '4.2.0' => 'Upgrades/upgrade-4.2.0.php',
30 '4.3.0' => 'Upgrades/upgrade-4.3.0.php'
31 ];
32
33 /**
34 * Get plugin installed version
35 *
36 * @return string
37 */
38 protected function get_installed_version()
39 {
40 $version = get_option($this->option_name, false);
41
42 // Fall back to the legacy version option (renamed in v4.2.0) so existing
43 // installs report their real version and historical upgrades don't re-run.
44 if (false === $version) {
45 $version = get_option('wp_adminify_version', '1.0.0');
46 }
47
48 return $version;
49 }
50
51 /**
52 * Check if plugin's update is available
53 *
54 * @return bool
55 */
56 public function if_updates_available()
57 {
58 if (version_compare($this->get_installed_version(), PXLBSADMINIFY_VER, '<')) {
59 return true;
60 }
61
62 return false;
63 }
64
65 /**
66 * Run plugin updates
67 *
68 * @return void
69 */
70 public function run_updates()
71 {
72 $installed_version = $this->get_installed_version();
73 $path = trailingslashit(__DIR__);
74
75 foreach ($this->upgrades as $version => $file) {
76 if (version_compare($installed_version, $version, '<')) {
77 include $path . $file;
78 }
79 }
80
81 // update_option( $this->option_name, PXLBSADMINIFY_VER );
82 }
83 }
84