Use PHP 7.4 featers and PHP 8 polyfills
This commit is contained in:
@ -48,7 +48,7 @@ class Customer_Query extends Query {
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
protected $table_schema = '\\WP_Ultimo\\Database\\Customers\\Customers_Schema';
|
||||
protected $table_schema = \WP_Ultimo\Database\Customers\Customers_Schema::class;
|
||||
|
||||
/** Item ******************************************************************/
|
||||
|
||||
@ -77,7 +77,7 @@ class Customer_Query extends Query {
|
||||
* @access public
|
||||
* @var mixed
|
||||
*/
|
||||
protected $item_shape = '\\WP_Ultimo\\Models\\Customer';
|
||||
protected $item_shape = \WP_Ultimo\Models\Customer::class;
|
||||
|
||||
/**
|
||||
* Group to cache queries and queried items in.
|
||||
@ -104,7 +104,7 @@ class Customer_Query extends Query {
|
||||
*
|
||||
* @param string|array $query Array of query arguments.
|
||||
*/
|
||||
public function __construct($query = array()) {
|
||||
public function __construct($query = []) {
|
||||
|
||||
// $query['type'] = 'customer';
|
||||
|
||||
|
@ -64,7 +64,7 @@ final class Customers_Meta_Table extends Table {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
protected function set_schema() {
|
||||
protected function set_schema(): void {
|
||||
|
||||
$max_index_length = 191;
|
||||
|
||||
|
@ -28,10 +28,10 @@ class Customers_Schema extends Schema {
|
||||
* @access public
|
||||
* @var array
|
||||
*/
|
||||
public $columns = array(
|
||||
public $columns = [
|
||||
|
||||
// id
|
||||
array(
|
||||
[
|
||||
'name' => 'id',
|
||||
'type' => 'bigint',
|
||||
'length' => '20',
|
||||
@ -40,27 +40,27 @@ class Customers_Schema extends Schema {
|
||||
'primary' => true,
|
||||
'sortable' => true,
|
||||
'searchable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
// user_id
|
||||
array(
|
||||
[
|
||||
'name' => 'user_id',
|
||||
'type' => 'bigint',
|
||||
'length' => '20',
|
||||
'unsigned' => true,
|
||||
'searchable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'type',
|
||||
'type' => 'varchar',
|
||||
'default' => 'customer',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
// date_registered
|
||||
array(
|
||||
[
|
||||
'name' => 'date_registered',
|
||||
'type' => 'datetime',
|
||||
'default' => null,
|
||||
@ -68,28 +68,28 @@ class Customers_Schema extends Schema {
|
||||
'date_query' => true,
|
||||
'sortable' => true,
|
||||
'allow_null' => true,
|
||||
),
|
||||
],
|
||||
|
||||
// email_verification
|
||||
array(
|
||||
[
|
||||
'name' => 'email_verification',
|
||||
'type' => 'enum(\'verified\', \'pending\', \'none\')',
|
||||
'default' => 'none',
|
||||
'transition' => true,
|
||||
),
|
||||
],
|
||||
|
||||
// last_login
|
||||
array(
|
||||
[
|
||||
'name' => 'last_login',
|
||||
'type' => 'datetime',
|
||||
'default' => null,
|
||||
'date_query' => true,
|
||||
'sortable' => true,
|
||||
'allow_null' => true,
|
||||
),
|
||||
],
|
||||
|
||||
// has_trialed
|
||||
array(
|
||||
[
|
||||
'name' => 'has_trialed',
|
||||
'type' => 'smallint',
|
||||
'length' => '',
|
||||
@ -97,10 +97,10 @@ class Customers_Schema extends Schema {
|
||||
'default' => null,
|
||||
'transition' => true,
|
||||
'allow_null' => true,
|
||||
),
|
||||
],
|
||||
|
||||
// vip
|
||||
array(
|
||||
[
|
||||
'name' => 'vip',
|
||||
'type' => 'smallint',
|
||||
'length' => '',
|
||||
@ -108,25 +108,25 @@ class Customers_Schema extends Schema {
|
||||
'default' => 0,
|
||||
'transition' => true,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
// ips
|
||||
array(
|
||||
[
|
||||
'name' => 'ips',
|
||||
'type' => 'longtext',
|
||||
'default' => '',
|
||||
'searchable' => true,
|
||||
'allow_null' => true,
|
||||
),
|
||||
],
|
||||
|
||||
// Added on 2.0 beta 7
|
||||
array(
|
||||
[
|
||||
'name' => 'signup_form',
|
||||
'type' => 'varchar',
|
||||
'default' => 'by-admin',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
);
|
||||
];
|
||||
}
|
||||
|
@ -50,11 +50,11 @@ final class Customers_Table extends Table {
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $upgrades = array(
|
||||
protected $upgrades = [
|
||||
'2.0.1-revision.20210508' => 20_210_508,
|
||||
'2.0.1-revision.20210607' => 20_210_607,
|
||||
'2.0.1-revision.20230601' => 20_230_601,
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Customer constructor.
|
||||
@ -75,7 +75,7 @@ final class Customers_Table extends Table {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
protected function set_schema() {
|
||||
protected function set_schema(): void {
|
||||
|
||||
$this->schema = "id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
user_id bigint(20) unsigned NOT NULL DEFAULT '0',
|
||||
@ -152,11 +152,11 @@ final class Customers_Table extends Table {
|
||||
*/
|
||||
protected function __20230601(): bool {
|
||||
|
||||
$null_columns = array(
|
||||
$null_columns = [
|
||||
'date_modified',
|
||||
'date_registered',
|
||||
'last_login',
|
||||
);
|
||||
];
|
||||
|
||||
foreach ($null_columns as $column) {
|
||||
$query = "ALTER TABLE {$this->table_name} MODIFY COLUMN `{$column}` datetime DEFAULT NULL;";
|
||||
|
Reference in New Issue
Block a user