OSDN Git Service

initialized configurator on demand
authorscribu <mail@scribu.net>
Wed, 23 Oct 2013 23:09:31 +0000 (02:09 +0300)
committerscribu <mail@scribu.net>
Wed, 23 Oct 2013 23:09:31 +0000 (02:09 +0300)
php/class-wp-cli.php
php/wp-cli.php

index e0996fa..abe3a59 100644 (file)
@@ -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() {
index 5380e8a..f1fa299 100644 (file)
@@ -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