| Server IP : 194.61.116.167 / Your IP : 216.73.217.84 Web Server : Apache/2 System : Linux nimbus2000.evosiber.com 5.14.0-503.11.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Nov 12 09:26:13 EST 2024 x86_64 User : evoplastik ( 1130) PHP Version : 8.1.34 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/evoplastik/public_html/wp-content/plugins/woocommerce/packages/blueprint/src/Steps/ |
Upload File : |
<?php
namespace Automattic\WooCommerce\Blueprint\Steps;
/**
* Class RunSql
*
* @package Automattic\WooCommerce\Blueprint\Steps
*/
class RunSql extends Step {
/**
* Sql code to run.
*
* @var string
*/
protected string $sql = '';
/**
* Name of the sql file.
*
* @var string
*/
protected string $name = 'schema.sql';
/**
* Constructor.
*
* @param string $sql Sql code to run.
* @param string $name Name of the sql file.
*/
public function __construct( string $sql, $name = 'schema.sql' ) {
$this->sql = $sql;
$this->name = $name;
}
/**
* Returns the name of this step.
*
* @return string The step name.
*/
public static function get_step_name(): string {
return 'runSql';
}
/**
* Returns the schema for the JSON representation of this step.
*
* @param int $version The version of the schema to return.
* @return array The schema array.
*/
public static function get_schema( int $version = 1 ): array {
return array(
'type' => 'object',
'properties' => array(
'step' => array(
'type' => 'string',
'enum' => array( static::get_step_name() ),
),
'sql' => array(
'type' => 'object',
'required' => array( 'contents', 'resource', 'name' ),
'properties' => array(
'resource' => array(
'type' => 'string',
'enum' => array( 'literal' ),
),
'name' => array(
'type' => 'string',
),
'contents' => array(
'type' => 'string',
),
),
),
),
'required' => array( 'step', 'sql' ),
);
}
/**
* Prepares an associative array for JSON encoding.
*
* @return array Array of data to be encoded as JSON.
*/
public function prepare_json_array(): array {
return array(
'step' => static::get_step_name(),
'sql' => array(
'resource' => 'literal',
'name' => $this->name,
'contents' => $this->sql,
),
);
}
}