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

64 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 WPAdminify\Inc\Classes;
4
5 class Upgrade {
6
7 /**
8 * Plugin version option key
9 *
10 * @var string $option_name
11 */
12 protected $option_name = 'wp_adminify_version';
13
14 /**
15 * Lists of upgrades
16 *
17 * @var string[] $upgrades
18 */
19 protected $upgrades = [
20 '3.0.2' => 'Upgrades/upgrade-3.0.2.php'
21 ];
22
23 /**
24 * Get plugin installed version
25 *
26 * @return string
27 */
28 protected function get_installed_version() {
29 return get_option( $this->option_name, '1.0.0' );
30 }
31
32 /**
33 * Check if plugin's update is available
34 *
35 * @return bool
36 */
37 public function if_updates_available() {
38 if ( version_compare( $this->get_installed_version(), WP_ADMINIFY_VER, '<' ) ) {
39 return true;
40 }
41
42 return false;
43 }
44
45 /**
46 * Run plugin updates
47 *
48 * @return void
49 */
50 public function run_updates() {
51 $installed_version = $this->get_installed_version();
52 $path = trailingslashit( __DIR__ );
53
54 foreach ( $this->upgrades as $version => $file ) {
55 if ( version_compare( $installed_version, $version, '<' ) ) {
56 include $path . $file;
57 }
58 }
59
60 // update_option( $this->option_name, WP_ADMINIFY_VER );
61 }
62
63 }
64