From 915fd1c7e7c495258f57eb1e2cdc03bda3f025ae Mon Sep 17 00:00:00 2001 From: scribu Date: Thu, 24 Oct 2013 02:09:31 +0300 Subject: [PATCH] initialized configurator on demand --- php/class-wp-cli.php | 15 +++++++-------- php/wp-cli.php | 2 -- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/php/class-wp-cli.php b/php/class-wp-cli.php index e0996fad..abe3a592 100644 --- a/php/class-wp-cli.php +++ b/php/class-wp-cli.php @@ -17,13 +17,6 @@ class WP_CLI { private static $hooks = array(), $hooks_passed = array(); /** - * Initialize WP_CLI static variables. - */ - static function init() { - self::$configurator = new WP_CLI\Configurator( WP_CLI_ROOT . '/php/config-spec.php' ); - } - - /** * Set the logger instance. * * @param object $logger @@ -33,7 +26,13 @@ class WP_CLI { } static function get_configurator() { - return self::$configurator; + static $configurator; + + if ( !$configurator ) { + $configurator = new WP_CLI\Configurator( WP_CLI_ROOT . '/php/config-spec.php' ); + } + + return $configurator; } static function get_root_command() { diff --git a/php/wp-cli.php b/php/wp-cli.php index 5380e8a2..f1fa299c 100644 --- a/php/wp-cli.php +++ b/php/wp-cli.php @@ -12,8 +12,6 @@ include WP_CLI_ROOT . '/php/class-wp-cli-command.php'; \WP_CLI\Utils\load_dependencies(); -WP_CLI::init(); - WP_CLI::get_runner()->before_wp_load(); // Load wp-config.php code, in the global scope -- 2.11.0