Use PHP 7.4 featers and PHP 8 polyfills
This commit is contained in:
@ -48,7 +48,7 @@ class Domain_Query extends Query {
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
protected $table_schema = '\\WP_Ultimo\\Database\\Domains\\Domains_Schema';
|
||||
protected $table_schema = \WP_Ultimo\Database\Domains\Domains_Schema::class;
|
||||
|
||||
/** Item ******************************************************************/
|
||||
|
||||
@ -77,7 +77,7 @@ class Domain_Query extends Query {
|
||||
* @access public
|
||||
* @var mixed
|
||||
*/
|
||||
protected $item_shape = '\\WP_Ultimo\\Models\\Domain';
|
||||
protected $item_shape = \WP_Ultimo\Models\Domain::class;
|
||||
|
||||
/**
|
||||
* Group to cache queries and queried items in.
|
||||
@ -104,7 +104,7 @@ class Domain_Query extends Query {
|
||||
*
|
||||
* @param string|array $query Array of query arguments.
|
||||
*/
|
||||
public function __construct($query = array()) {
|
||||
public function __construct($query = []) {
|
||||
|
||||
parent::__construct($query);
|
||||
}
|
||||
|
@ -40,13 +40,13 @@ class Domain_Stage extends Enum {
|
||||
*/
|
||||
protected function classes() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
static::FAILED => 'wu-bg-red-200 wu-text-red-700',
|
||||
static::CHECKING_DNS => 'wu-bg-blue-200 wu-text-blue-700',
|
||||
static::CHECKING_SSL => 'wu-bg-yellow-200 wu-text-yellow-700',
|
||||
static::DONE => 'wu-bg-green-200 wu-text-green-700',
|
||||
static::DONE_WITHOUT_SSL => 'wu-bg-gray-800 wu-text-white',
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -57,12 +57,12 @@ class Domain_Stage extends Enum {
|
||||
*/
|
||||
protected function labels() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
static::FAILED => __('DNS Failed', 'wp-ultimo'),
|
||||
static::CHECKING_DNS => __('Checking DNS', 'wp-ultimo'),
|
||||
static::CHECKING_SSL => __('Checking SSL', 'wp-ultimo'),
|
||||
static::DONE => __('Ready', 'wp-ultimo'),
|
||||
static::DONE_WITHOUT_SSL => __('Ready (without SSL)', 'wp-ultimo'),
|
||||
);
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -28,9 +28,9 @@ class Domains_Schema extends Schema {
|
||||
* @access public
|
||||
* @var array
|
||||
*/
|
||||
public $columns = array(
|
||||
public $columns = [
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'id',
|
||||
'type' => 'bigint',
|
||||
'length' => '20',
|
||||
@ -38,27 +38,27 @@ class Domains_Schema extends Schema {
|
||||
'extra' => 'auto_increment',
|
||||
'primary' => true,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'blog_id',
|
||||
'type' => 'bigint',
|
||||
'length' => '20',
|
||||
'unsigned' => true,
|
||||
'aliases' => array('site_id', 'site'),
|
||||
'aliases' => ['site_id', 'site'],
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'domain',
|
||||
'type' => 'varchar',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'transition' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'active',
|
||||
'type' => 'tinyint',
|
||||
'length' => '4',
|
||||
@ -66,9 +66,9 @@ class Domains_Schema extends Schema {
|
||||
'default' => 1,
|
||||
'transition' => true,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'primary_domain',
|
||||
'type' => 'tinyint',
|
||||
'length' => '4',
|
||||
@ -76,9 +76,9 @@ class Domains_Schema extends Schema {
|
||||
'default' => 0,
|
||||
'transition' => true,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'secure',
|
||||
'type' => 'tinyint',
|
||||
'length' => '4',
|
||||
@ -86,17 +86,17 @@ class Domains_Schema extends Schema {
|
||||
'default' => 0,
|
||||
'transition' => true,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'stage',
|
||||
'type' => 'enum(\'checking-dns\', \'checking-ssl-cert\', \'done-without-ssl\', \'done\', \'failed\')',
|
||||
'default' => 'checking-dns',
|
||||
'transition' => true,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'date_created',
|
||||
'type' => 'datetime',
|
||||
'default' => null,
|
||||
@ -104,9 +104,9 @@ class Domains_Schema extends Schema {
|
||||
'date_query' => true,
|
||||
'sortable' => true,
|
||||
'allow_null' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'date_modified',
|
||||
'type' => 'datetime',
|
||||
'default' => null,
|
||||
@ -114,7 +114,7 @@ class Domains_Schema extends Schema {
|
||||
'date_query' => true,
|
||||
'sortable' => true,
|
||||
'allow_null' => true,
|
||||
),
|
||||
],
|
||||
|
||||
);
|
||||
];
|
||||
}
|
||||
|
@ -50,9 +50,9 @@ final class Domains_Table extends Table {
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $upgrades = array(
|
||||
protected $upgrades = [
|
||||
'2.0.1-revision.20230601' => 20_230_601,
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Domains constructor.
|
||||
@ -73,7 +73,7 @@ final class Domains_Table extends Table {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
protected function set_schema() {
|
||||
protected function set_schema(): void {
|
||||
|
||||
$this->schema = "id bigint(20) NOT NULL auto_increment,
|
||||
blog_id bigint(20) NOT NULL,
|
||||
@ -95,10 +95,10 @@ final class Domains_Table extends Table {
|
||||
*/
|
||||
protected function __20230601(): bool {
|
||||
|
||||
$null_columns = array(
|
||||
$null_columns = [
|
||||
'date_created',
|
||||
'date_modified',
|
||||
);
|
||||
];
|
||||
|
||||
foreach ($null_columns as $column) {
|
||||
$query = "ALTER TABLE {$this->table_name} MODIFY COLUMN `{$column}` datetime DEFAULT NULL;";
|
||||
|
Reference in New Issue
Block a user