403Webshell
Server IP : 192.158.238.246  /  Your IP : 216.73.216.28
Web Server : LiteSpeed
System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64
User : jenniferflocom ( 1321)
PHP Version : 8.1.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /proc/7779/task/7779/cwd/plugins/woocommerce/vendor/woocommerce/blueprint/src/Cli/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/7779/task/7779/cwd/plugins/woocommerce/vendor/woocommerce/blueprint/src/Cli/ExportCli.php
<?php

namespace Automattic\WooCommerce\Blueprint\Cli;

use Automattic\WooCommerce\Blueprint\ExportSchema;
use Automattic\WooCommerce\Blueprint\ZipExportedSchema;

/**
 * Class ExportCli
 *
 * This class handles the CLI commands for exporting schemas.
 *
 * @package Automattic\WooCommerce\Blueprint\Cli
 */
class ExportCli {
	/**
	 * The path where the exported schema will be saved.
	 *
	 * @var string The path where the exported schema will be saved.
	 */
	private string $save_to;

	/**
	 * ExportCli constructor.
	 *
	 * @param string $save_to The path where the exported schema will be saved.
	 */
	public function __construct( $save_to ) {
		$this->save_to = $save_to;
	}

	/**
	 * Run the export process.
	 *
	 * @param array $args The arguments for the export process.
	 */
	public function run( $args = array() ) {
		$export_as_zip = isset( $args['format'] ) && 'zip' === $args['format'];
		if ( ! isset( $args['steps'] ) ) {
			$args['steps'] = array();
		}

		$exporter = new ExportSchema();

		$schema = $exporter->export( $args['steps'], $export_as_zip );

		if ( $export_as_zip ) {
			$zip_exported_schema = new ZipExportedSchema( $schema );
			$this->save_to       = $zip_exported_schema->zip();
			\WP_CLI::success( "Exported zip to {$this->save_to}" );
		} else {
			// phpcs:ignore
			$save = file_put_contents( $this->save_to, json_encode( $schema, JSON_PRETTY_PRINT ) );
			if ( false === $save ) {
				\WP_CLI::error( "Failed to save to {$this->save_to}" );
			} else {
				\WP_CLI::success( "Exported JSON to {$this->save_to}" );
			}
		}
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit