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

65 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 * 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 '3.0.9' => 'Upgrades/upgrade-3.0.9.php',
22 ];
23
24 /**
25 * Get plugin installed version
26 *
27 * @return string
28 */
29 protected function get_installed_version() {
30 return get_option( $this->option_name, '1.0.0' );
31 }
32
33 /**
34 * Check if plugin's update is available
35 *
36 * @return bool
37 */
38 public function if_updates_available() {
39 if ( version_compare( $this->get_installed_version(), WP_ADMINIFY_VER, '<' ) ) {
40 return true;
41 }
42
43 return false;
44 }
45
46 /**
47 * Run plugin updates
48 *
49 * @return void
50 */
51 public function run_updates() {
52 $installed_version = $this->get_installed_version();
53 $path = trailingslashit( __DIR__ );
54
55 foreach ( $this->upgrades as $version => $file ) {
56 if ( version_compare( $installed_version, $version, '<' ) ) {
57 include $path . $file;
58 }
59 }
60
61 // update_option( $this->option_name, WP_ADMINIFY_VER );
62 }
63
64 }
65