| @@ -1,24 +1,24 @@ | ||
| 1 | 1 | <?php |
| 2 | -/** | |
| 3 | - * Based on https://github.com/woocommerce/woocommerce/blob/master/includes/abstracts/class-wc-background-process.php | |
| 4 | - * & https://github.com/woocommerce/woocommerce/blob/master/includes/class-wc-background-updater.php | |
| 5 | - * | |
| 6 | - * @package Elementor\Core\Base | |
| 7 | - */ | |
| 8 | 2 | |
| 9 | 3 | namespace Elementor\Core\Base; |
| 10 | 4 | |
| 11 | 5 | use Elementor\Plugin; |
| 12 | -use Elementor\Core\Base\BackgroundProcess\WP_Background_Process; | |
| 13 | 6 | |
| 7 | +/** | |
| 8 | + * Based on https://github.com/woocommerce/woocommerce/blob/master/includes/abstracts/class-wc-background-process.php | |
| 9 | + * & https://github.com/woocommerce/woocommerce/blob/master/includes/class-wc-background-updater.php | |
| 10 | + */ | |
| 14 | 11 | |
| 15 | 12 | defined( 'ABSPATH' ) || exit; |
| 16 | 13 | |
| 14 | +include_once ELEMENTOR_PATH . '/includes/libraries/wp-background-process/wp-async-request.php'; | |
| 15 | +include_once ELEMENTOR_PATH . '/includes/libraries/wp-background-process/wp-background-process.php'; | |
| 16 | + | |
| 17 | 17 | /** |
| 18 | 18 | * WC_Background_Process class. |
| 19 | 19 | */ |
| 20 | -abstract class Background_Task extends WP_Background_Process { | |
| 20 | +abstract class Background_Task extends \WP_Background_Process { | |
| 21 | 21 | protected $current_item; |
| 22 | 22 | |
| 23 | 23 | /** |
| 24 | 24 | * Dispatch updater. |
| @@ -28,9 +28,9 @@ | ||
| 28 | 28 | public function dispatch() { |
| 29 | 29 | $dispatched = parent::dispatch(); |
| 30 | 30 | |
| 31 | 31 | if ( is_wp_error( $dispatched ) ) { |
| 32 | - wp_die( esc_html( $dispatched ) ); | |
| 32 | + wp_die( $dispatched ); | |
| 33 | 33 | } |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | public function query_col( $sql ) { |
| @@ -211,9 +211,8 @@ | ||
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | /** |
| 214 | 214 | * Use the protected `is_process_running` method as a public method. |
| 215 | - * | |
| 216 | 215 | * @return bool |
| 217 | 216 | */ |
| 218 | 217 | public function is_process_locked() { |
| 219 | 218 | return $this->is_process_running(); |
| @@ -287,9 +286,9 @@ | ||
| 287 | 286 | } elseif ( 1 === $item['iterate_num'] ) { |
| 288 | 287 | $logger->info( sprintf( '%s callback needs to run more %d times', $callback, $item['total'] - $item['iterate_num'] ) ); |
| 289 | 288 | } |
| 290 | 289 | |
| 291 | - ++$item['iterate_num']; | |
| 290 | + $item['iterate_num']++; | |
| 292 | 291 | } else { |
| 293 | 292 | $logger->info( sprintf( '%s Finished', $callback ) ); |
| 294 | 293 | } |
| 295 | 294 | } else { |
| @@ -308,16 +307,13 @@ | ||
| 308 | 307 | public function schedule_cron_healthcheck( $schedules ) { |
| 309 | 308 | $interval = apply_filters( $this->identifier . '_cron_interval', 5 ); |
| 310 | 309 | |
| 311 | 310 | // Adds every 5 minutes to the existing schedules. |
| 312 | - $schedules[ $this->identifier . '_cron_interval' ] = [ | |
| 311 | + $schedules[ $this->identifier . '_cron_interval' ] = array( | |
| 313 | 312 | 'interval' => MINUTE_IN_SECONDS * $interval, |
| 314 | - 'display' => sprintf( | |
| 315 | - /* translators: %d: Interval in minutes. */ | |
| 316 | - esc_html__( 'Every %d minutes', 'elementor' ), | |
| 317 | - $interval | |
| 318 | - ), | |
| 319 | - ]; | |
| 313 | + /* translators: %d: interval */ | |
| 314 | + 'display' => sprintf( __( 'Every %d minutes', 'elementor' ), $interval ), | |
| 315 | + ); | |
| 320 | 316 | |
| 321 | 317 | return $schedules; |
| 322 | 318 | } |
| 323 | 319 | |