Skip to content

Commit

Permalink
Add the ProductAttributesLookup\CLIRunner class
Browse files Browse the repository at this point in the history
  • Loading branch information
Konamiman committed May 9, 2024
1 parent 3cab2e6 commit 6df0ad6
Show file tree
Hide file tree
Showing 4 changed files with 587 additions and 50 deletions.
21 changes: 12 additions & 9 deletions plugins/woocommerce/includes/class-wc-cli.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
* @version 3.0.0
*/

use Automattic\WooCommerce\DataBase\Migrations\CustomOrderTable\CLIRunner;
use Automattic\WooCommerce\DataBase\Migrations\CustomOrderTable\CLIRunner as CustomOrdersTableCLIRunner;
use Automattic\WooCommerce\Internal\ProductAttributesLookup\CLIRunner as ProductAttributesLookupCLIRunner;

defined( 'ABSPATH' ) || exit;

Expand All @@ -26,13 +27,13 @@ public function __construct() {
* Load command files.
*/
private function includes() {
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';
require_once dirname( __FILE__ ) . '/cli/class-wc-cli-tracker-command.php';
require_once dirname( __FILE__ ) . '/cli/class-wc-cli-com-command.php';
require_once dirname( __FILE__ ) . '/cli/class-wc-cli-com-extension-command.php';
require_once __DIR__ . '/cli/class-wc-cli-runner.php';
require_once __DIR__ . '/cli/class-wc-cli-rest-command.php';
require_once __DIR__ . '/cli/class-wc-cli-tool-command.php';
require_once __DIR__ . '/cli/class-wc-cli-update-command.php';
require_once __DIR__ . '/cli/class-wc-cli-tracker-command.php';
require_once __DIR__ . '/cli/class-wc-cli-com-command.php';
require_once __DIR__ . '/cli/class-wc-cli-com-extension-command.php';
}

/**
Expand All @@ -45,8 +46,10 @@ private function hooks() {
WP_CLI::add_hook( 'after_wp_load', 'WC_CLI_Tracker_Command::register_commands' );
WP_CLI::add_hook( 'after_wp_load', 'WC_CLI_COM_Command::register_commands' );
WP_CLI::add_hook( 'after_wp_load', 'WC_CLI_COM_Extension_Command::register_commands' );
$cli_runner = wc_get_container()->get( CLIRunner::class );
$cli_runner = wc_get_container()->get( CustomOrdersTableCLIRunner::class );
WP_CLI::add_hook( 'after_wp_load', array( $cli_runner, 'register_commands' ) );
$cli_runner = wc_get_container()->get( ProductAttributesLookupCLIRunner::class );
WP_CLI::add_hook( 'after_wp_load', fn() => \WP_CLI::add_command( 'wc palt', $cli_runner ) );
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
namespace Automattic\WooCommerce\Internal\DependencyManagement\ServiceProviders;

use Automattic\WooCommerce\Internal\DependencyManagement\AbstractServiceProvider;
use Automattic\WooCommerce\Internal\ProductAttributesLookup\CLIRunner;
use Automattic\WooCommerce\Internal\ProductAttributesLookup\DataRegenerator;
use Automattic\WooCommerce\Internal\ProductAttributesLookup\Filterer;
use Automattic\WooCommerce\Internal\ProductAttributesLookup\LookupDataStore;
Expand All @@ -24,6 +25,7 @@ class ProductAttributesLookupServiceProvider extends AbstractServiceProvider {
DataRegenerator::class,
Filterer::class,
LookupDataStore::class,
CLIRunner::class,
);

/**
Expand All @@ -33,5 +35,6 @@ public function register() {
$this->share( DataRegenerator::class )->addArgument( LookupDataStore::class );
$this->share( Filterer::class )->addArgument( LookupDataStore::class );
$this->share( LookupDataStore::class );
$this->share( CLIRunner::class )->addArguments( array( DataRegenerator::class, LookupDataStore::class ) );
}
}
Loading

0 comments on commit 6df0ad6

Please sign in to comment.