PluginProbe
Elementor Website Builder – more than just a page builder / 3.13.0-beta1
Elementor Website Builder – more than just a page builder v3.13.0-beta1
4.3.4 4.3.3 4.3.2 4.3.1 4.3.0 4.3.0-beta3 4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 All 457 releases
← All changes | core/upgrade/manager.php +7 -48 4.3.4 → 3.13.0-beta1 View file →
@@ -3,29 +3,16 @@
3 3
4 4 use Elementor\Core\Base\DB_Upgrades_Manager;
5 5
6 6 if ( ! defined( 'ABSPATH' ) ) {
7 - exit; // Exit if accessed directly.
7 + exit; // Exit if accessed directly
8 8 }
9 9
10 10 class Manager extends DB_Upgrades_Manager {
11 11
12 - /**
13 - * @deprecated 3.17.0
14 - */
15 12 const INSTALLS_HISTORY_META = 'elementor_install_history';
16 13
17 - const VERSION_OPTION_NAME = 'elementor_version';
18 -
19 - public static function get_install_history_meta() {
20 - return 'elementor_install_history';
21 - }
22 -
23 - /**
24 - * TODO: Remove in future releases
25 - *
26 - * @deprecated 3.1.0
27 - */
14 + // todo: remove in future releases
28 15 public function should_upgrade() {
29 16 if ( ( 'elementor' === $this->get_plugin_name() ) && version_compare( get_option( $this->get_version_option_name() ), '2.4.2', '<' ) ) {
30 17 delete_option( 'elementor_log' );
31 18 }
@@ -57,9 +44,9 @@
57 44 return ELEMENTOR_VERSION;
58 45 }
59 46
60 47 public function get_version_option_name() {
61 - return self::VERSION_OPTION_NAME;
48 + return 'elementor_version';
62 49 }
63 50
64 51 public function get_upgrades_class() {
65 52 return 'Elementor\Core\Upgrade\Upgrades';
@@ -65,9 +52,9 @@
65 52 return 'Elementor\Core\Upgrade\Upgrades';
66 53 }
67 54
68 55 public static function get_installs_history() {
69 - return get_option( static::get_install_history_meta(), [] );
56 + return get_option( self::INSTALLS_HISTORY_META, [] );
70 57 }
71 58
72 59 public static function install_compare( $version, $operator ) {
73 60 $installs_history = self::get_installs_history();
@@ -85,46 +72,18 @@
85 72 $installs_history = self::get_installs_history();
86 73
87 74 $time = time();
88 75
89 - $installs_history[ $this->get_new_version() ] = $time;
76 + $installs_history[ ELEMENTOR_VERSION ] = $time;
90 77
91 78 $old_version = $this->get_current_version();
92 79
93 80 // If there was an old version of Elementor, and there's no record for that install yet
94 81 if ( $old_version && empty( $installs_history[ $old_version ] ) ) {
95 - $installs_history[ $old_version ] = $installs_history[ $this->get_new_version() ] - 1;
82 + $installs_history[ $old_version ] = $installs_history[ ELEMENTOR_VERSION ] - 1;
96 83 }
97 84
98 85 uksort( $installs_history, 'version_compare' );
99 86
100 - update_option( static::get_install_history_meta(), $installs_history );
101 - }
102 -
103 - public static function is_new_installation(): bool {
104 - $installs_history = self::get_installs_history();
105 -
106 - return empty( $installs_history ) || static::install_compare( ELEMENTOR_VERSION, '>=' );
107 - }
108 -
109 - public static function had_install_prior_to( string $version ): bool {
110 - if ( ! $version ) {
111 - return false;
112 - }
113 -
114 - $installs_history = self::get_installs_history();
115 -
116 - if ( empty( $installs_history ) ) {
117 - return false;
118 - }
119 -
120 - uksort( $installs_history, 'version_compare' );
121 -
122 - $first_version = array_key_first( $installs_history );
123 -
124 - if ( ! $first_version ) {
125 - return false;
126 - }
127 -
128 - return version_compare( $first_version, $version, '<' );
87 + update_option( self::INSTALLS_HISTORY_META, $installs_history );
129 88 }
130 89 }