Fix missing notes table on 4.0.0 upgrade. (#25891)
* Don't attempt to create a WC-Admin note before the tables exist.
This commit is contained in:
parent
0a351fb2aa
commit
6a8d8b27d9
|
@ -156,7 +156,7 @@ class WC_Install {
|
||||||
public static function init() {
|
public static function init() {
|
||||||
add_action( 'init', array( __CLASS__, 'check_version' ), 5 );
|
add_action( 'init', array( __CLASS__, 'check_version' ), 5 );
|
||||||
add_action( 'init', array( __CLASS__, 'manual_database_update' ), 20 );
|
add_action( 'init', array( __CLASS__, 'manual_database_update' ), 20 );
|
||||||
add_action( 'plugins_loaded', array( __CLASS__, 'wc_admin_db_update_notice' ), 100 );
|
add_action( 'admin_init', array( __CLASS__, 'wc_admin_db_update_notice' ) );
|
||||||
add_action( 'woocommerce_run_update_callback', array( __CLASS__, 'run_update_callback' ) );
|
add_action( 'woocommerce_run_update_callback', array( __CLASS__, 'run_update_callback' ) );
|
||||||
add_action( 'admin_init', array( __CLASS__, 'install_actions' ) );
|
add_action( 'admin_init', array( __CLASS__, 'install_actions' ) );
|
||||||
add_filter( 'plugin_action_links_' . WC_PLUGIN_BASENAME, array( __CLASS__, 'plugin_action_links' ) );
|
add_filter( 'plugin_action_links_' . WC_PLUGIN_BASENAME, array( __CLASS__, 'plugin_action_links' ) );
|
||||||
|
@ -194,7 +194,10 @@ class WC_Install {
|
||||||
* @since 4.0.0
|
* @since 4.0.0
|
||||||
*/
|
*/
|
||||||
public static function wc_admin_db_update_notice() {
|
public static function wc_admin_db_update_notice() {
|
||||||
if ( WC()->is_wc_admin_active() ) {
|
if (
|
||||||
|
WC()->is_wc_admin_active() &&
|
||||||
|
false !== get_option( 'woocommerce_admin_install_timestamp' )
|
||||||
|
) {
|
||||||
new WC_Notes_Run_Db_Update();
|
new WC_Notes_Run_Db_Update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -261,11 +264,6 @@ class WC_Install {
|
||||||
check_admin_referer( 'wc_db_update', 'wc_db_update_nonce' );
|
check_admin_referer( 'wc_db_update', 'wc_db_update_nonce' );
|
||||||
self::update();
|
self::update();
|
||||||
WC_Admin_Notices::add_notice( 'update', true );
|
WC_Admin_Notices::add_notice( 'update', true );
|
||||||
if ( WC()->is_wc_admin_active() ) {
|
|
||||||
// Pre-init data store override to allow storing WC Admin notice during activation (package is not loaded yet).
|
|
||||||
add_filter( 'woocommerce_data_stores', array( '\Automattic\WooCommerce\Admin\API\Init', 'add_data_stores' ) );
|
|
||||||
WC_Notes_Run_Db_Update::show_reminder();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -381,12 +379,6 @@ class WC_Install {
|
||||||
self::update();
|
self::update();
|
||||||
} else {
|
} else {
|
||||||
WC_Admin_Notices::add_notice( 'update', true );
|
WC_Admin_Notices::add_notice( 'update', true );
|
||||||
|
|
||||||
// Pre-init data store override to allow storing WC Admin notice during activation (package is not loaded yet).
|
|
||||||
if ( WC()->is_wc_admin_active() ) {
|
|
||||||
add_filter( 'woocommerce_data_stores', array( '\Automattic\WooCommerce\Admin\API\Init', 'add_data_stores' ) );
|
|
||||||
WC_Notes_Run_Db_Update::show_reminder();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
self::update_db_version();
|
self::update_db_version();
|
||||||
|
|
Loading…
Reference in New Issue