2016-11-14 11:36:26 +00:00
|
|
|
<?php
|
2018-01-15 05:21:53 +00:00
|
|
|
/**
|
|
|
|
* Enables WooCommerce, via the the command line.
|
|
|
|
*
|
|
|
|
* @package WooCommerce\CLI
|
|
|
|
* @version 3.0.0
|
|
|
|
*/
|
|
|
|
|
2017-02-16 11:46:01 +00:00
|
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2016-11-14 11:36:26 +00:00
|
|
|
/**
|
2018-01-15 05:21:53 +00:00
|
|
|
* CLI class.
|
2016-11-14 11:36:26 +00:00
|
|
|
*/
|
2016-12-08 18:59:07 +00:00
|
|
|
class WC_CLI {
|
|
|
|
/**
|
|
|
|
* Load required files and hooks to make the CLI work.
|
|
|
|
*/
|
|
|
|
public function __construct() {
|
|
|
|
$this->includes();
|
|
|
|
$this->hooks();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Load command files.
|
|
|
|
*/
|
|
|
|
private function includes() {
|
2018-01-15 05:21:53 +00:00
|
|
|
require_once dirname( __FILE__ ) . '/cli/class-wc-cli-runner.php';
|
|
|
|
require_once dirname( __FILE__ ) . '/cli/class-wc-cli-rest-command.php';
|
|
|
|
require_once dirname( __FILE__ ) . '/cli/class-wc-cli-tool-command.php';
|
|
|
|
require_once dirname( __FILE__ ) . '/cli/class-wc-cli-update-command.php';
|
2016-12-08 18:59:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets up and hooks WP CLI to our CLI code.
|
|
|
|
*/
|
|
|
|
private function hooks() {
|
|
|
|
WP_CLI::add_hook( 'after_wp_load', 'WC_CLI_Runner::after_wp_load' );
|
2016-12-13 13:38:20 +00:00
|
|
|
WP_CLI::add_hook( 'after_wp_load', 'WC_CLI_Tool_Command::register_commands' );
|
|
|
|
WP_CLI::add_hook( 'after_wp_load', 'WC_CLI_Update_Command::register_commands' );
|
2016-12-08 18:59:07 +00:00
|
|
|
}
|
|
|
|
}
|
2017-02-16 11:46:01 +00:00
|
|
|
|
2018-01-15 05:21:53 +00:00
|
|
|
new WC_CLI();
|