diff --git a/includes/admin/class-wc-admin-notices.php b/includes/admin/class-wc-admin-notices.php index 0d4c6f040d4..6b73df75f57 100644 --- a/includes/admin/class-wc-admin-notices.php +++ b/includes/admin/class-wc-admin-notices.php @@ -30,7 +30,6 @@ class WC_Admin_Notices { private static $core_notices = array( 'install' => 'install_notice', 'update' => 'update_notice', - 'updating' => 'updating_notice', 'template_files' => 'template_file_check_notice', 'theme_support' => 'theme_check_notice', 'legacy_shipping' => 'legacy_shipping_notice', @@ -190,15 +189,13 @@ class WC_Admin_Notices { * If we need to update, include a message with the update button. */ public static function update_notice() { - include( 'views/html-notice-update.php' ); - } - - /** - * If we are updating, show progress. - */ - public static function updating_notice() { if ( version_compare( get_option( 'woocommerce_db_version' ), WC_VERSION, '<' ) ) { - include( 'views/html-notice-updating.php' ); + $updater = new WC_Background_Updater(); + if ( ! $updater->is_updating() ) { + include( 'views/html-notice-update.php' ); + } else { + include( 'views/html-notice-updating.php' ); + } } else { include( 'views/html-notice-updated.php' ); } diff --git a/includes/admin/views/html-notice-updated.php b/includes/admin/views/html-notice-updated.php index bbaafb047ca..b32c162924e 100644 --- a/includes/admin/views/html-notice-updated.php +++ b/includes/admin/views/html-notice-updated.php @@ -9,7 +9,7 @@ if ( ! defined( 'ABSPATH' ) ) { ?>
- +

diff --git a/includes/class-wc-background-updater.php b/includes/class-wc-background-updater.php index c54d8c3ae66..c3c3cb889b9 100644 --- a/includes/class-wc-background-updater.php +++ b/includes/class-wc-background-updater.php @@ -40,8 +40,6 @@ class WC_Background_Updater extends WP_Background_Process { * Updater will still run via cron job if this fails for any reason. */ public function dispatch() { - WC_Admin_Notices::add_notice( 'updating' ); - $dispatched = parent::dispatch(); if ( is_wp_error( $dispatched ) ) { @@ -66,6 +64,14 @@ class WC_Background_Updater extends WP_Background_Process { echo '

' . __( 'Unable to dispatch WooCommerce updater:', 'woocommerce' ) . ' ' . esc_html( $this->error ) . '

'; } + /** + * Is the updater running? + * @return boolean + */ + public function is_updating() { + return false === $this->is_queue_empty(); + } + /** * Task * @@ -105,7 +111,6 @@ class WC_Background_Updater extends WP_Background_Process { */ protected function complete() { $logger = new WC_Logger(); - $logger->add( 'wc_db_updates', 'Data update complete' ); WC_Install::update_db_version(); parent::complete(); diff --git a/includes/class-wc-install.php b/includes/class-wc-install.php index 44829f4c8ba..751b086d4b0 100644 --- a/includes/class-wc-install.php +++ b/includes/class-wc-install.php @@ -114,7 +114,7 @@ class WC_Install { public static function install_actions() { if ( ! empty( $_GET['do_update_woocommerce'] ) ) { self::update(); - WC_Admin_Notices::remove_notice( 'update' ); + WC_Admin_Notices::add_notice( 'update' ); } }