parent
81994720f0
commit
34f2bd683e
|
@ -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' );
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
|
||||
?>
|
||||
<div id="message" class="updated woocommerce-message wc-connect">
|
||||
<a class="woocommerce-message-close notice-dismiss" href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'wc-hide-notice', 'updating' ), 'woocommerce_hide_notices_nonce', '_wc_notice_nonce' ) ); ?>"><?php _e( 'Dismiss', 'woocommerce' ); ?></a>
|
||||
<a class="woocommerce-message-close notice-dismiss" href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'wc-hide-notice', 'update', remove_query_arg( 'do_update_woocommerce' ) ), 'woocommerce_hide_notices_nonce', '_wc_notice_nonce' ) ); ?>"><?php _e( 'Dismiss', 'woocommerce' ); ?></a>
|
||||
|
||||
<p><?php _e( 'WooCommerce data update complete. Thank you for updating to the latest version!', 'woocommerce' ); ?></p>
|
||||
</div>
|
||||
|
|
|
@ -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 '<div class="error"><p>' . __( 'Unable to dispatch WooCommerce updater:', 'woocommerce' ) . ' ' . esc_html( $this->error ) . '</p></div>';
|
||||
}
|
||||
|
||||
/**
|
||||
* 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();
|
||||
|
|
|
@ -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' );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue