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

83 lines 1.6 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 ];
31
32 /**
33 * Get plugin installed version
34 *
35 * @return string
36 */
37 protected function get_installed_version()
38 {
39 $version = get_option($this->option_name, false);
40
41 // Fall back to the legacy version option (renamed in v4.2.0) so existing
42 // installs report their real version and historical upgrades don't re-run.
43 if (false === $version) {
44 $version = get_option('wp_adminify_version', '1.0.0');
45 }
46
47 return $version;
48 }
49
50 /**
51 * Check if plugin's update is available
52 *
53 * @return bool
54 */
55 public function if_updates_available()
56 {
57 if (version_compare($this->get_installed_version(), PXLBSADMINIFY_VER, '<')) {
58 return true;
59 }
60
61 return false;
62 }
63
64 /**
65 * Run plugin updates
66 *
67 * @return void
68 */
69 public function run_updates()
70 {
71 $installed_version = $this->get_installed_version();
72 $path = trailingslashit(__DIR__);
73
74 foreach ($this->upgrades as $version => $file) {
75 if (version_compare($installed_version, $version, '<')) {
76 include $path . $file;
77 }
78 }
79
80 // update_option( $this->option_name, PXLBSADMINIFY_VER );
81 }
82 }
83