Merge pull request woocommerce/woocommerce-admin#1960 from woocommerce/fix/1946
Only check for unsnooze note scheduled action in admin_init
This commit is contained in:
commit
d315f6a6f4
|
@ -18,16 +18,10 @@ class WC_Admin_Notes {
|
|||
const UNSNOOZE_HOOK = 'wc_admin_unsnooze_admin_notes';
|
||||
|
||||
/**
|
||||
* Schedule events and hook appropriate actions.
|
||||
* Hook appropriate actions.
|
||||
*/
|
||||
public static function init() {
|
||||
$queue = WC()->queue();
|
||||
$next = $queue->get_next( self::UNSNOOZE_HOOK );
|
||||
|
||||
if ( ! $next ) {
|
||||
$queue->schedule_recurring( time(), HOUR_IN_SECONDS, self::UNSNOOZE_HOOK );
|
||||
}
|
||||
|
||||
add_action( 'admin_init', array( __CLASS__, 'schedule_unsnooze_notes' ) );
|
||||
add_action( self::UNSNOOZE_HOOK, array( __CLASS__, 'unsnooze_notes' ) );
|
||||
}
|
||||
|
||||
|
@ -128,6 +122,18 @@ class WC_Admin_Notes {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Schedule unsnooze notes event.
|
||||
*/
|
||||
public static function schedule_unsnooze_notes() {
|
||||
$queue = WC()->queue();
|
||||
$next = $queue->get_next( self::UNSNOOZE_HOOK );
|
||||
|
||||
if ( ! $next ) {
|
||||
$queue->schedule_recurring( time(), HOUR_IN_SECONDS, self::UNSNOOZE_HOOK );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
WC_Admin_Notes::init();
|
||||
|
|
Loading…
Reference in New Issue