Edit File by line
/home/zeestwma/richards.../wp-conte.../plugins/woocomme.../includes
File: class-wc-cli.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Enables WooCommerce, via the command line.
[2] Fix | Delete
*
[3] Fix | Delete
* @package WooCommerce\CLI
[4] Fix | Delete
* @version 3.0.0
[5] Fix | Delete
*/
[6] Fix | Delete
[7] Fix | Delete
use Automattic\WooCommerce\Database\Migrations\CustomOrderTable\CLIRunner as CustomOrdersTableCLIRunner;
[8] Fix | Delete
use Automattic\WooCommerce\Internal\ProductAttributesLookup\CLIRunner as ProductAttributesLookupCLIRunner;
[9] Fix | Delete
use Automattic\WooCommerce\Internal\Integrations\WPPostsImporter;
[10] Fix | Delete
use Automattic\WooCommerce\Utilities\FeaturesUtil;
[11] Fix | Delete
[12] Fix | Delete
defined( 'ABSPATH' ) || exit;
[13] Fix | Delete
[14] Fix | Delete
/**
[15] Fix | Delete
* CLI class.
[16] Fix | Delete
*/
[17] Fix | Delete
class WC_CLI {
[18] Fix | Delete
/**
[19] Fix | Delete
* Load required files and hooks to make the CLI work.
[20] Fix | Delete
*/
[21] Fix | Delete
public function __construct() {
[22] Fix | Delete
$this->includes();
[23] Fix | Delete
$this->hooks();
[24] Fix | Delete
[25] Fix | Delete
/**
[26] Fix | Delete
* Adds the blueprint CLI initialization to the 'init' hook to prevent premature translation loading.
[27] Fix | Delete
*
[28] Fix | Delete
* The hook is required because FeaturesUtil::feature_is_enabled() loads translations during the
[29] Fix | Delete
* blueprint CLI check. This hook can be removed once FeaturesUtil::feature_is_enabled() is
[30] Fix | Delete
* refactored to not load translations.
[31] Fix | Delete
*
[32] Fix | Delete
* @see https://github.com/woocommerce/woocommerce/issues/56305
[33] Fix | Delete
*/
[34] Fix | Delete
add_action( 'init', array( $this, 'add_blueprint_cli_hook' ) );
[35] Fix | Delete
[36] Fix | Delete
/**
[37] Fix | Delete
* Register the WP Posts importer.
[38] Fix | Delete
*/
[39] Fix | Delete
$wp_posts_importer = wc_get_container()->get( WPPostsImporter::class );
[40] Fix | Delete
$wp_posts_importer->register();
[41] Fix | Delete
}
[42] Fix | Delete
[43] Fix | Delete
/**
[44] Fix | Delete
* Load command files.
[45] Fix | Delete
*/
[46] Fix | Delete
private function includes() {
[47] Fix | Delete
require_once __DIR__ . '/cli/class-wc-cli-runner.php';
[48] Fix | Delete
require_once __DIR__ . '/cli/class-wc-cli-rest-command.php';
[49] Fix | Delete
require_once __DIR__ . '/cli/class-wc-cli-tool-command.php';
[50] Fix | Delete
require_once __DIR__ . '/cli/class-wc-cli-update-command.php';
[51] Fix | Delete
require_once __DIR__ . '/cli/class-wc-cli-tracker-command.php';
[52] Fix | Delete
require_once __DIR__ . '/cli/class-wc-cli-com-command.php';
[53] Fix | Delete
require_once __DIR__ . '/cli/class-wc-cli-com-extension-command.php';
[54] Fix | Delete
}
[55] Fix | Delete
[56] Fix | Delete
/**
[57] Fix | Delete
* Sets up and hooks WP CLI to our CLI code.
[58] Fix | Delete
*/
[59] Fix | Delete
private function hooks() {
[60] Fix | Delete
WP_CLI::add_hook( 'after_wp_load', 'WC_CLI_Runner::after_wp_load' );
[61] Fix | Delete
WP_CLI::add_hook( 'after_wp_load', 'WC_CLI_Tool_Command::register_commands' );
[62] Fix | Delete
WP_CLI::add_hook( 'after_wp_load', 'WC_CLI_Update_Command::register_commands' );
[63] Fix | Delete
WP_CLI::add_hook( 'after_wp_load', 'WC_CLI_Tracker_Command::register_commands' );
[64] Fix | Delete
WP_CLI::add_hook( 'after_wp_load', 'WC_CLI_COM_Command::register_commands' );
[65] Fix | Delete
WP_CLI::add_hook( 'after_wp_load', 'WC_CLI_COM_Extension_Command::register_commands' );
[66] Fix | Delete
$cli_runner = wc_get_container()->get( CustomOrdersTableCLIRunner::class );
[67] Fix | Delete
WP_CLI::add_hook( 'after_wp_load', array( $cli_runner, 'register_commands' ) );
[68] Fix | Delete
$cli_runner = wc_get_container()->get( ProductAttributesLookupCLIRunner::class );
[69] Fix | Delete
WP_CLI::add_hook( 'after_wp_load', fn() => \WP_CLI::add_command( 'wc palt', $cli_runner ) );
[70] Fix | Delete
}
[71] Fix | Delete
[72] Fix | Delete
/**
[73] Fix | Delete
* Include Blueprint CLI if it's available.
[74] Fix | Delete
*/
[75] Fix | Delete
public function add_blueprint_cli_hook() {
[76] Fix | Delete
if ( FeaturesUtil::feature_is_enabled( 'blueprint' ) && class_exists( \Automattic\WooCommerce\Blueprint\Cli::class ) ) {
[77] Fix | Delete
require_once dirname( WC_PLUGIN_FILE ) . '/packages/blueprint/src/Cli.php';
[78] Fix | Delete
WP_CLI::add_hook( 'after_wp_load', 'Automattic\WooCommerce\Blueprint\Cli::register_commands' );
[79] Fix | Delete
}
[80] Fix | Delete
}
[81] Fix | Delete
}
[82] Fix | Delete
[83] Fix | Delete
new WC_CLI();
[84] Fix | Delete
[85] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function