Skip to content

Commit

Permalink
fix initialization order on activation
Browse files Browse the repository at this point in the history
  • Loading branch information
rrennick committed Mar 12, 2020
1 parent 59dbd87 commit c0efea9
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions classes/abstracts/ActionScheduler.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,31 +137,29 @@ public static function init( $plugin_file ) {
*/
do_action( 'action_scheduler_pre_init' );

require_once( self::plugin_path('functions.php') );
require_once( self::plugin_path( 'functions.php' ) );
ActionScheduler_DataController::init();

$store = self::store();
add_action( 'init', array( $store, 'init' ), 1, 0 );

$logger = self::logger();
add_action( 'init', array( $logger, 'init' ), 1, 0 );

$runner = self::runner();
add_action( 'init', array( $runner, 'init' ), 1, 0 );

$store = self::store();
$logger = self::logger();
$runner = self::runner();
$admin_view = self::admin_view();
add_action( 'init', array( $admin_view, 'init' ), 0, 0 ); // run before $store::init()

// Ensure initialization on plugin activation.
if ( did_action( 'init' ) ) {
if ( ! did_action( 'init' ) ) {
add_action( 'init', array( $admin_view, 'init' ), 0, 0 ); // run before $store::init()
add_action( 'init', array( $store, 'init' ), 1, 0 );
add_action( 'init', array( $logger, 'init' ), 1, 0 );
add_action( 'init', array( $runner, 'init' ), 1, 0 );
} else {
$admin_view->init();
$store->init();
$logger->init();
$runner->init();
$admin_view->init();
}

if ( apply_filters( 'action_scheduler_load_deprecated_functions', true ) ) {
require_once( self::plugin_path('deprecated/functions.php') );
require_once( self::plugin_path( 'deprecated/functions.php' ) );
}

if ( defined( 'WP_CLI' ) && WP_CLI ) {
Expand Down

0 comments on commit c0efea9

Please sign in to comment.