PluginProbe
Elementor Website Builder – more than just a page builder / 3.0.3
Elementor Website Builder – more than just a page builder v3.0.3
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
elementor / core / upgrade / manager.php

manager.php in Elementor Website Builder – more than just a page builder 3.0.3, at core/upgrade/manager.php

77 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Elementor\Core\Upgrade;
3
4 use Elementor\Core\Base\DB_Upgrades_Manager;
5
6 if ( ! defined( 'ABSPATH' ) ) {
7 exit; // Exit if accessed directly
8 }
9
10 class Manager extends DB_Upgrades_Manager {
11
12 const INSTALLS_HISTORY_META = 'elementor_install_history';
13
14 // todo: remove in future releases
15 public function should_upgrade() {
16 if ( ( 'elementor' === $this->get_plugin_name() ) && version_compare( get_option( $this->get_version_option_name() ), '2.4.2', '<' ) ) {
17 delete_option( 'elementor_log' );
18 }
19
20 return parent::should_upgrade();
21 }
22
23 public function get_name() {
24 return 'upgrade';
25 }
26
27 public function get_action() {
28 return 'elementor_updater';
29 }
30
31 public function get_plugin_name() {
32 return 'elementor';
33 }
34
35 public function get_plugin_label() {
36 return __( 'Elementor', 'elementor' );
37 }
38
39 public function get_updater_label() {
40 return sprintf( '<strong>%s </strong> &#8211;', __( 'Elementor Data Updater', 'elementor' ) );
41 }
42
43 public function get_new_version() {
44 return ELEMENTOR_VERSION;
45 }
46
47 public function get_version_option_name() {
48 return 'elementor_version';
49 }
50
51 public function get_upgrades_class() {
52 return 'Elementor\Core\Upgrade\Upgrades';
53 }
54
55 protected function update_db_version() {
56 parent::update_db_version();
57
58 $installs_history = self::get_installs_history();
59
60 $installs_history[ ELEMENTOR_VERSION ] = time();
61
62 uksort( $installs_history, 'version_compare' );
63
64 update_option( self::INSTALLS_HISTORY_META, $installs_history );
65 }
66
67 public static function get_installs_history() {
68 return get_option( self::INSTALLS_HISTORY_META, [] );
69 }
70
71 public static function install_compare( $version, $operator ) {
72 $installs_history = self::get_installs_history();
73
74 return version_compare( key( $installs_history ), $version, $operator );
75 }
76 }
77