Skip to content

Commit

Permalink
Merge pull request #105 from humanmade/eager-bootstrap
Browse files Browse the repository at this point in the history
Eager bootstrapping of the plugin
  • Loading branch information
roborourke authored Jul 31, 2020
2 parents a7bb0d3 + 2471886 commit 771b2e1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 2 additions & 4 deletions inc/namespace.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,8 @@ function maybe_populate_site_option() {
return;
}

$cavalcade_db_version = get_option( 'cavalcade_db_version' );

$set_site_meta = function ( $site_meta ) use ( $cavalcade_db_version ) {
$site_meta['cavalcade_db_version'] = $cavalcade_db_version;
$set_site_meta = function ( $site_meta ) {
$site_meta['cavalcade_db_version'] = get_option( 'cavalcade_db_version' );
return $site_meta;
};

Expand Down
2 changes: 1 addition & 1 deletion plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
require __DIR__ . '/inc/connector/namespace.php';
require __DIR__ . '/inc/upgrade/namespace.php';

add_action( 'plugins_loaded', __NAMESPACE__ . '\\bootstrap' );
bootstrap();

// Register cache groups as early as possible, as some plugins may use cron functions before plugins_loaded
if ( function_exists( 'wp_cache_add_global_groups' ) ) {
Expand Down
2 changes: 2 additions & 0 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
/**
* Bootstrap the plugin unit testing environment.
*
* phpcs:disable PSR1.Files.SideEffects
*
* @package WordPress
*/

Expand Down

0 comments on commit 771b2e1

Please sign in to comment.