Automattic\WooCommerce\Blueprint\Cli
ExportCli::run
Run the export process.
Метод класса: ExportCli{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$ExportCli = new ExportCli(); $ExportCli->run( $args );
- $args(массив)
- The arguments for the export process.
По умолчанию:array()
Код ExportCli::run() ExportCli::run WC 10.8.1
public function run( $args = array() ) {
if ( ! isset( $args['steps'] ) ) {
$args['steps'] = array();
}
$exporter = new ExportSchema();
$result = $exporter->export( $args['steps'] );
if ( is_wp_error( $result ) ) {
\WP_CLI::error( $result->get_error_message() );
return;
}
$is_saved = $this->wp_filesystem_put_contents( $this->save_to, wp_json_encode( $result, JSON_PRETTY_PRINT ) );
if ( false === $is_saved ) {
\WP_CLI::error( "Failed to save to {$this->save_to}" );
} else {
\WP_CLI::success( "Exported JSON to {$this->save_to}" );
}
}