PluginProbe
Elementor Website Builder – more than just a page builder / 3.3.0
Elementor Website Builder – more than just a page builder v3.3.0
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/base/db-upgrades-manager.php +8 -33 4.2.0-dev2 → 3.3.0 View file →
@@ -5,9 +5,9 @@
5 5 use Elementor\Core\Admin\Admin_Notices;
6 6 use Elementor\Plugin;
7 7
8 8 if ( ! defined( 'ABSPATH' ) ) {
9 - exit; // Exit if accessed directly.
9 + exit; // Exit if accessed directly
10 10 }
11 11
12 12 abstract class DB_Upgrades_Manager extends Background_Task_Manager {
13 13 protected $current_version = null;
@@ -68,9 +68,9 @@
68 68 'to' => $this->get_new_version(),
69 69 ],
70 70 ] );
71 71
72 - $this->clear_cache();
72 + Plugin::$instance->files_manager->clear_cache();
73 73
74 74 $this->update_db_version();
75 75
76 76 if ( $did_tasks ) {
@@ -77,12 +77,8 @@
77 77 $this->add_flag( 'completed' );
78 78 }
79 79 }
80 80
81 - protected function clear_cache() {
82 - Plugin::$instance->files_manager->clear_cache();
83 - }
84 -
85 81 public function admin_notice_start_upgrade() {
86 82 /**
87 83 * @var Admin_Notices $admin_notices
88 84 */
@@ -89,13 +85,13 @@
89 85 $admin_notices = Plugin::$instance->admin->get_component( 'admin-notices' );
90 86
91 87 $options = [
92 88 'title' => $this->get_updater_label(),
93 - 'description' => esc_html__( 'Your site database needs to be updated to the latest version.', 'elementor' ),
89 + 'description' => __( 'Your site database needs to be updated to the latest version.', 'elementor' ),
94 90 'type' => 'error',
95 91 'icon' => false,
96 92 'button' => [
97 - 'text' => esc_html__( 'Update Now', 'elementor' ),
93 + 'text' => __( 'Update Now', 'elementor' ),
98 94 'url' => $this->get_start_action_url(),
99 95 'class' => 'e-button e-button--cta',
100 96 ],
101 97 ];
@@ -110,13 +106,13 @@
110 106 $admin_notices = Plugin::$instance->admin->get_component( 'admin-notices' );
111 107
112 108 $options = [
113 109 'title' => $this->get_updater_label(),
114 - 'description' => esc_html__( 'Database update process is running in the background. Taking a while?', 'elementor' ),
110 + 'description' => __( 'Database update process is running in the background. Taking a while?', 'elementor' ),
115 111 'type' => 'warning',
116 112 'icon' => false,
117 113 'button' => [
118 - 'text' => esc_html__( 'Click here to run it now', 'elementor' ),
114 + 'text' => __( 'Click here to run it now', 'elementor' ),
119 115 'url' => $this->get_continue_action_url(),
120 116 'class' => 'e-button e-button--primary',
121 117 ],
122 118 ];
@@ -126,9 +122,9 @@
126 122
127 123 public function admin_notice_upgrade_is_completed() {
128 124 $this->delete_flag( 'completed' );
129 125
130 - $message = esc_html__( 'The database update process is now complete. Thank you for updating to the latest version!', 'elementor' );
126 + $message = __( 'The database update process is now complete. Thank you for updating to the latest version!', 'elementor' );
131 127
132 128 /**
133 129 * @var Admin_Notices $admin_notices
134 130 */
@@ -148,12 +144,9 @@
148 144 */
149 145 protected function start_run() {
150 146 $updater = $this->get_task_runner();
151 147
152 - // Skip if process is actively running (has lock) or queue already has items.
153 - // Stuck queues (items exist but no lock) are handled by the shutdown fallback
154 - // registered in the constructor, so we don't need to re-push callbacks here.
155 - if ( $updater->is_process_locked() || $updater->is_running() ) {
148 + if ( $updater->is_running() ) {
156 149 return;
157 150 }
158 151
159 152 $upgrade_callbacks = $this->get_upgrade_callbacks();
@@ -162,10 +155,8 @@
162 155 $this->on_runner_complete();
163 156 return;
164 157 }
165 158
166 - $this->clear_cache();
167 -
168 159 foreach ( $upgrade_callbacks as $callback ) {
169 160 $updater->push_to_queue( [
170 161 'callback' => $callback,
171 162 ] );
@@ -227,17 +218,8 @@
227 218 if ( is_admin() && current_user_can( 'update_plugins' ) && $this->get_flag( 'completed' ) ) {
228 219 add_action( 'admin_notices', [ $this, 'admin_notice_upgrade_is_completed' ] );
229 220 }
230 221
231 - // Don't run upgrade logic during background process AJAX requests.
232 - // The AJAX handler (maybe_handle) will process the queue.
233 - // phpcs:ignore WordPress.Security.NonceVerification.Recommended
234 - $ajax_action = isset( $_REQUEST['action'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['action'] ) ) : '';
235 -
236 - if ( wp_doing_ajax() && $ajax_action && false !== strpos( $ajax_action, 'updater' ) ) {
237 - return;
238 - }
239 -
240 222 if ( ! $this->should_upgrade() ) {
241 223 return;
242 224 }
243 225
@@ -243,15 +225,8 @@
243 225
244 226 $updater = $this->get_task_runner();
245 227
246 228 $this->start_run();
247 -
248 - // If queue has items but process is not locked, it's stuck - try to process on shutdown.
249 - if ( $updater->is_running() && ! $updater->is_process_locked() ) {
250 - if ( is_admin() && ! wp_doing_ajax() && ! wp_doing_cron() ) {
251 - add_action( 'shutdown', [ $updater, 'maybe_handle_on_shutdown' ], 0 );
252 - }
253 - }
254 229
255 230 if ( $updater->is_running() && current_user_can( 'update_plugins' ) ) {
256 231 add_action( 'admin_notices', [ $this, 'admin_notice_upgrade_is_running' ] );
257 232 }