From 4f485a14deaedff4ba41fb95a1d50b180108563e Mon Sep 17 00:00:00 2001 From: Peter Fabian Date: Fri, 7 Feb 2020 12:58:31 +0100 Subject: [PATCH] Added explanation comments. --- includes/admin/class-wc-admin-notices.php | 3 +++ includes/admin/class-wc-admin.php | 2 ++ 2 files changed, 5 insertions(+) diff --git a/includes/admin/class-wc-admin-notices.php b/includes/admin/class-wc-admin-notices.php index a688a45e930..9fa28b060f0 100644 --- a/includes/admin/class-wc-admin-notices.php +++ b/includes/admin/class-wc-admin-notices.php @@ -49,6 +49,9 @@ class WC_Admin_Notices { add_action( 'switch_theme', array( __CLASS__, 'reset_admin_notices' ) ); add_action( 'woocommerce_installed', array( __CLASS__, 'reset_admin_notices' ) ); add_action( 'wp_loaded', array( __CLASS__, 'hide_notices' ) ); + // @TODO: This prevents Action Scheduler async jobs from storing empty list of notices during WC installation. + // That could lead to OBW not starting and 'Run setup wizard' notice not appearing in WP admin, which we want + // to avoid. if ( ! WC_Install::is_new_install() || ! wc_is_running_from_async_action_scheduler() ) { add_action( 'shutdown', array( __CLASS__, 'store_notices' ) ); } diff --git a/includes/admin/class-wc-admin.php b/includes/admin/class-wc-admin.php index 6f56304ad04..23d27e5bd73 100644 --- a/includes/admin/class-wc-admin.php +++ b/includes/admin/class-wc-admin.php @@ -127,6 +127,8 @@ class WC_Admin { * For setup wizard, transient must be present, the user must have access rights, and we must ignore the network/bulk plugin updaters. */ public function admin_redirects() { + // Don't run this fn from Action Scheduler requests, as it would clear _wc_activation_redirect transient. + // That means OBW would never be shown. if ( wc_is_running_from_async_action_scheduler() ) { return; }