Files
assets
data
dependencies
inc
admin-pages
api
builders
checkout
compat
contracts
country
database
broadcasts
checkout-forms
customers
discount-codes
domains
class-domain-query.php
class-domain-stage.php
class-domains-schema.php
class-domains-table.php
emails
engine
events
memberships
payments
posts
products
sites
webhooks
debug
deprecated
development
domain-mapping
duplication
exception
functions
gateways
helpers
installers
integrations
internal
invoices
limitations
limits
list-tables
loaders
managers
mercator
models
next
objects
site-templates
sso
tax
traits
ui
updater
class-admin-notices.php
class-admin-themes-compatibility.php
class-ajax.php
class-api.php
class-async-calls.php
class-autoloader.php
class-cron.php
class-current.php
class-dashboard-statistics.php
class-dashboard-widgets.php
class-documentation.php
class-domain-mapping.php
class-faker.php
class-geolocation.php
class-helper.php
class-hooks.php
class-license.php
class-light-ajax.php
class-logger.php
class-maintenance-mode.php
class-newsletter.php
class-requirements.php
class-scripts.php
class-session-cookie.php
class-settings.php
class-sunrise.php
class-user-switching.php
class-views.php
class-whitelabel.php
class-wp-ultimo.php
lang
views
.gitignore
LICENSE
autoload.php
composer.json
constants.php
loco.xml
readme.txt
sunrise.php
uninstall.php
wp-multisite-waas.php
wp-multisite-waas/inc/database/domains/class-domains-table.php
2024-11-30 18:24:12 -07:00

124 lines
2.2 KiB
PHP

<?php
/**
* Class used for querying domain mappings.
*
* @package WP_Ultimo
* @subpackage Database\Domains
* @since 2.0.0
*/
namespace WP_Ultimo\Database\Domains;
use WP_Ultimo\Database\Engine\Table;
// Exit if accessed directly
defined('ABSPATH') || exit;
/**
* Setup the "wu_domain_mapping" database table
*
* @since 2.0.0
*/
final class Domains_Table extends Table {
/**
* Table name
*
* @since 2.0.0
* @var string
*/
protected $name = 'domain_mappings';
/**
* Is this table global?
*
* @since 2.0.0
* @var boolean
*/
protected $global = true;
/**
* Table current version
*
* @since 2.0.0
* @var string
*/
protected $version = '2.0.1-revision.20230601';
/**
* List of table upgrades.
*
* @var array
*/
protected $upgrades = array(
'2.0.1-revision.20230601' => 20_230_601,
);
/**
* Domains constructor.
*
* @access public
* @since 2.0.0
* @return void
*/
public function __construct() {
parent::__construct();
} // end __construct;
/**
* Setup the database schema
*
* @access protected
* @since 2.0.0
* @return void
*/
protected function set_schema() {
$this->schema = "id bigint(20) NOT NULL auto_increment,
blog_id bigint(20) NOT NULL,
domain varchar(191) NOT NULL,
active tinyint(4) default 1,
primary_domain tinyint(4) default 0,
secure tinyint(4) default 0,
stage enum('checking-dns', 'checking-ssl-cert', 'done', 'failed', 'done-without-ssl') DEFAULT 'checking-dns',
date_created datetime NULL,
date_modified datetime NULL,
PRIMARY KEY (id),
KEY blog_id (blog_id,domain,active),
KEY domain (domain)";
} // end set_schema;
/**
* Fixes the datetime columns to accept null.
*
* @since 2.1.2
*/
protected function __20230601(): bool {
$null_columns = array(
'date_created',
'date_modified',
);
foreach ($null_columns as $column) {
$query = "ALTER TABLE {$this->table_name} MODIFY COLUMN `{$column}` datetime DEFAULT NULL;";
$result = $this->get_db()->query($query);
if (!$this->is_success($result)) {
return false;
} // end if;
} // end foreach;
return true;
} // end __20230601;
} // end class Domains_Table;