PluginProbe
Elementor Website Builder – more than just a page builder / 3.2.0
Elementor Website Builder – more than just a page builder v3.2.0
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 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 4.0.7 All 451 releases
← All changes | core/upgrade/manager.php +9 -52 4.2.23.2.0 View file →
@@ -3,27 +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 - public static function get_install_history_meta() {
18 - return 'elementor_install_history';
19 - }
20 -
21 - /**
22 - * TODO: Remove in future releases
23 - *
24 - * @deprecated 3.1.0
25 - */
14 + // todo: remove in future releases
26 15 public function should_upgrade() {
27 16 if ( ( 'elementor' === $this->get_plugin_name() ) && version_compare( get_option( $this->get_version_option_name() ), '2.4.2', '<' ) ) {
28 17 delete_option( 'elementor_log' );
29 18 }
@@ -43,13 +32,13 @@
43 32 return 'elementor';
44 33 }
45 34
46 35 public function get_plugin_label() {
47 - return esc_html__( 'Elementor', 'elementor' );
36 + return __( 'Elementor', 'elementor' );
48 37 }
49 38
50 39 public function get_updater_label() {
51 - return esc_html__( 'Elementor Data Updater', 'elementor' );
40 + return __( 'Elementor Data Updater', 'elementor' );
52 41 }
53 42
54 43 public function get_new_version() {
55 44 return ELEMENTOR_VERSION;
@@ -63,19 +52,15 @@
63 52 return 'Elementor\Core\Upgrade\Upgrades';
64 53 }
65 54
66 55 public static function get_installs_history() {
67 - return get_option( static::get_install_history_meta(), [] );
56 + return get_option( self::INSTALLS_HISTORY_META, [] );
68 57 }
69 58
70 59 public static function install_compare( $version, $operator ) {
71 60 $installs_history = self::get_installs_history();
72 61
73 - return version_compare(
74 - key( $installs_history ),
75 - $version ? $version : '0.0.0', // when no version assigned
76 - $operator
77 - );
62 + return version_compare( key( $installs_history ), $version, $operator );
78 63 }
79 64
80 65 protected function update_db_version() {
81 66 parent::update_db_version();
@@ -83,46 +68,18 @@
83 68 $installs_history = self::get_installs_history();
84 69
85 70 $time = time();
86 71
87 - $installs_history[ $this->get_new_version() ] = $time;
72 + $installs_history[ ELEMENTOR_VERSION ] = $time;
88 73
89 74 $old_version = $this->get_current_version();
90 75
91 76 // If there was an old version of Elementor, and there's no record for that install yet
92 77 if ( $old_version && empty( $installs_history[ $old_version ] ) ) {
93 - $installs_history[ $old_version ] = $installs_history[ $this->get_new_version() ] - 1;
78 + $installs_history[ $old_version ] = $installs_history[ ELEMENTOR_VERSION ] - 1;
94 79 }
95 80
96 81 uksort( $installs_history, 'version_compare' );
97 82
98 - update_option( static::get_install_history_meta(), $installs_history );
99 - }
100 -
101 - public static function is_new_installation(): bool {
102 - $installs_history = self::get_installs_history();
103 -
104 - return empty( $installs_history ) || static::install_compare( ELEMENTOR_VERSION, '>=' );
105 - }
106 -
107 - public static function had_install_prior_to( string $version ): bool {
108 - if ( ! $version ) {
109 - return false;
110 - }
111 -
112 - $installs_history = self::get_installs_history();
113 -
114 - if ( empty( $installs_history ) ) {
115 - return false;
116 - }
117 -
118 - uksort( $installs_history, 'version_compare' );
119 -
120 - $first_version = array_key_first( $installs_history );
121 -
122 - if ( ! $first_version ) {
123 - return false;
124 - }
125 -
126 - return version_compare( $first_version, $version, '<' );
83 + update_option( self::INSTALLS_HISTORY_META, $installs_history );
127 84 }
128 85 }