@@ -43,17 +43,18 @@ final class Domains_Table extends Table {
4343 * @since 2.0.0
4444 * @var string
4545 */
46- protected $ version = '2.0.1-revision.20230601 ' ;
46+ protected $ version = '2.0.1-revision.20260109 ' ;
4747
4848 /**
49- * List of table upgrades.
50- *
51- * @var array
49+ * Use real callbacks.
5250 */
53- protected $ upgrades = [
54- '2.0.1-revision.20230601 ' => 20_230_601 ,
55- ];
56-
51+ public function __construct () {
52+ $ this ->upgrades = [
53+ '2.0.1-revision.20230601 ' => [$ this , 'allow_nulls ' ],
54+ '2.0.1-revision.20260109 ' => [$ this , 'update_enum ' ],
55+ ];
56+ parent ::__construct ();
57+ }
5758
5859 /**
5960 * Set up the database schema
@@ -70,7 +71,7 @@ protected function set_schema(): void {
7071 active tinyint(4) default 1,
7172 primary_domain tinyint(4) default 0,
7273 secure tinyint(4) default 0,
73- stage enum('checking-dns ', 'checking-ssl-cert ', 'done ', 'failed ', 'done-without-ssl') DEFAULT 'checking-dns ',
74+ stage enum(' " . Domain_Stage:: CHECKING_DNS . " ', ' " . Domain_Stage:: CHECKING_SSL . " ', ' " . Domain_Stage:: DONE_WITHOUT_SSL . " ', ' " . Domain_Stage:: DONE . " ', ' " . Domain_Stage:: FAILED . " ', ' " . Domain_Stage:: SSL_FAILED . " ')) DEFAULT '" . Domain_Stage:: CHECKING_DNS . " ',
7475 date_created datetime NULL,
7576 date_modified datetime NULL,
7677 PRIMARY KEY (id),
@@ -83,7 +84,7 @@ protected function set_schema(): void {
8384 *
8485 * @since 2.1.2
8586 */
86- protected function __20230601 (): bool { // phpcs:ignore PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.MethodDoubleUnderscore
87+ protected function allow_nulls (): bool {
8788
8889 $ null_columns = [
8990 'date_created ' ,
@@ -102,4 +103,22 @@ protected function __20230601(): bool { // phpcs:ignore PHPCompatibility.Functio
102103
103104 return true ;
104105 }
106+
107+ /**
108+ * Adds the ssl-failed stage
109+ *
110+ * @since 2.4.10
111+ */
112+ protected function update_enum (): bool { // phpcs:ignore PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.MethodDoubleUnderscore
113+
114+ $ query = "ALTER TABLE {$ this ->table_name } MODIFY COLUMN `stage` enum(' " . Domain_Stage::CHECKING_DNS . "', ' " . Domain_Stage::CHECKING_SSL . "', ' " . Domain_Stage::DONE_WITHOUT_SSL . "', ' " . Domain_Stage::DONE . "', ' " . Domain_Stage::FAILED . "', ' " . Domain_Stage::SSL_FAILED . "') DEFAULT ' " . Domain_Stage::CHECKING_DNS . "'; " ;
115+
116+ $ result = $ this ->get_db ()->query ($ query );
117+
118+ if ( ! $ this ->is_success ($ result )) {
119+ return false ;
120+ }
121+
122+ return true ;
123+ }
105124}
0 commit comments