@@ -15,9 +15,9 @@ discard block |
||
15 | 15 | $stages = glob(EE_CORE . 'data_migration_scripts/4_9_0_stages/*'); |
16 | 16 | $class_to_filepath = array(); |
17 | 17 | foreach ($stages as $filepath) { |
18 | - $matches = array(); |
|
19 | - preg_match('~4_9_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
20 | - $class_to_filepath[ $matches[1] ] = $filepath; |
|
18 | + $matches = array(); |
|
19 | + preg_match('~4_9_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
20 | + $class_to_filepath[ $matches[1] ] = $filepath; |
|
21 | 21 | } |
22 | 22 | // give addons a chance to autoload their stages too |
23 | 23 | $class_to_filepath = apply_filters('FHEE__EE_DMS_4_9_0__autoloaded_stages', $class_to_filepath); |
@@ -36,68 +36,68 @@ discard block |
||
36 | 36 | class EE_DMS_Core_4_9_0 extends EE_Data_Migration_Script_Base |
37 | 37 | { |
38 | 38 | |
39 | - /** |
|
40 | - * return EE_DMS_Core_4_9_0 |
|
41 | - * |
|
42 | - * @param TableManager $table_manager |
|
43 | - * @param TableAnalysis $table_analysis |
|
44 | - */ |
|
45 | - public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) |
|
46 | - { |
|
47 | - $this->_pretty_name = esc_html__("Data Update to Event Espresso 4.9.0", "event_espresso"); |
|
48 | - $this->_priority = 10; |
|
49 | - $this->_migration_stages = array( |
|
50 | - new EE_DMS_4_9_0_Email_System_Question(), |
|
51 | - new EE_DMS_4_9_0_Answers_With_No_Registration(), |
|
52 | - ); |
|
53 | - parent::__construct($table_manager, $table_analysis); |
|
54 | - } |
|
39 | + /** |
|
40 | + * return EE_DMS_Core_4_9_0 |
|
41 | + * |
|
42 | + * @param TableManager $table_manager |
|
43 | + * @param TableAnalysis $table_analysis |
|
44 | + */ |
|
45 | + public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) |
|
46 | + { |
|
47 | + $this->_pretty_name = esc_html__("Data Update to Event Espresso 4.9.0", "event_espresso"); |
|
48 | + $this->_priority = 10; |
|
49 | + $this->_migration_stages = array( |
|
50 | + new EE_DMS_4_9_0_Email_System_Question(), |
|
51 | + new EE_DMS_4_9_0_Answers_With_No_Registration(), |
|
52 | + ); |
|
53 | + parent::__construct($table_manager, $table_analysis); |
|
54 | + } |
|
55 | 55 | |
56 | 56 | |
57 | 57 | |
58 | - /** |
|
59 | - * Whether to migrate or not. |
|
60 | - * |
|
61 | - * @param array $version_array |
|
62 | - * @return bool |
|
63 | - */ |
|
64 | - public function can_migrate_from_version($version_array) |
|
65 | - { |
|
66 | - $version_string = $version_array['Core']; |
|
67 | - if (version_compare($version_string, '4.9.0', '<=') && version_compare($version_string, '4.8.0', '>=')) { |
|
68 | - // echo "$version_string can be migrated from"; |
|
69 | - return true; |
|
70 | - } elseif (! $version_string) { |
|
71 | - // echo "no version string provided: $version_string"; |
|
72 | - // no version string provided... this must be pre 4.3 |
|
73 | - return false;// changed mind. dont want people thinking they should migrate yet because they cant |
|
74 | - } else { |
|
75 | - // echo "$version_string doesnt apply"; |
|
76 | - return false; |
|
77 | - } |
|
78 | - } |
|
58 | + /** |
|
59 | + * Whether to migrate or not. |
|
60 | + * |
|
61 | + * @param array $version_array |
|
62 | + * @return bool |
|
63 | + */ |
|
64 | + public function can_migrate_from_version($version_array) |
|
65 | + { |
|
66 | + $version_string = $version_array['Core']; |
|
67 | + if (version_compare($version_string, '4.9.0', '<=') && version_compare($version_string, '4.8.0', '>=')) { |
|
68 | + // echo "$version_string can be migrated from"; |
|
69 | + return true; |
|
70 | + } elseif (! $version_string) { |
|
71 | + // echo "no version string provided: $version_string"; |
|
72 | + // no version string provided... this must be pre 4.3 |
|
73 | + return false;// changed mind. dont want people thinking they should migrate yet because they cant |
|
74 | + } else { |
|
75 | + // echo "$version_string doesnt apply"; |
|
76 | + return false; |
|
77 | + } |
|
78 | + } |
|
79 | 79 | |
80 | 80 | |
81 | 81 | |
82 | - /** |
|
83 | - * @return bool |
|
84 | - */ |
|
85 | - public function schema_changes_before_migration() |
|
86 | - { |
|
87 | - require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
88 | - $now_in_mysql = current_time('mysql', true); |
|
89 | - $table_name = 'esp_answer'; |
|
90 | - $sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
82 | + /** |
|
83 | + * @return bool |
|
84 | + */ |
|
85 | + public function schema_changes_before_migration() |
|
86 | + { |
|
87 | + require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
88 | + $now_in_mysql = current_time('mysql', true); |
|
89 | + $table_name = 'esp_answer'; |
|
90 | + $sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
91 | 91 | REG_ID int(10) unsigned NOT NULL, |
92 | 92 | QST_ID int(10) unsigned NOT NULL, |
93 | 93 | ANS_value text NOT NULL, |
94 | 94 | PRIMARY KEY (ANS_ID), |
95 | 95 | KEY REG_ID (REG_ID), |
96 | 96 | KEY QST_ID (QST_ID)"; |
97 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
98 | - $table_name = 'esp_attendee_meta'; |
|
99 | - $this->_get_table_manager()->dropIndexIfSizeNot($table_name, 'ATT_email'); |
|
100 | - $sql = "ATTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
97 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
98 | + $table_name = 'esp_attendee_meta'; |
|
99 | + $this->_get_table_manager()->dropIndexIfSizeNot($table_name, 'ATT_email'); |
|
100 | + $sql = "ATTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
101 | 101 | ATT_ID bigint(20) unsigned NOT NULL, |
102 | 102 | ATT_fname varchar(45) NOT NULL, |
103 | 103 | ATT_lname varchar(45) NOT NULL, |
@@ -114,9 +114,9 @@ discard block |
||
114 | 114 | KEY ATT_email (ATT_email(191)), |
115 | 115 | KEY ATT_lname (ATT_lname), |
116 | 116 | KEY ATT_fname (ATT_fname)"; |
117 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
118 | - $table_name = 'esp_checkin'; |
|
119 | - $sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
117 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
118 | + $table_name = 'esp_checkin'; |
|
119 | + $sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
120 | 120 | REG_ID int(10) unsigned NOT NULL, |
121 | 121 | DTT_ID int(10) unsigned NOT NULL, |
122 | 122 | CHK_in tinyint(1) unsigned NOT NULL DEFAULT 1, |
@@ -124,9 +124,9 @@ discard block |
||
124 | 124 | PRIMARY KEY (CHK_ID), |
125 | 125 | KEY REG_ID (REG_ID), |
126 | 126 | KEY DTT_ID (DTT_ID)"; |
127 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
128 | - $table_name = 'esp_country'; |
|
129 | - $sql = "CNT_ISO varchar(2) NOT NULL, |
|
127 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
128 | + $table_name = 'esp_country'; |
|
129 | + $sql = "CNT_ISO varchar(2) NOT NULL, |
|
130 | 130 | CNT_ISO3 varchar(3) NOT NULL, |
131 | 131 | RGN_ID tinyint(3) unsigned DEFAULT NULL, |
132 | 132 | CNT_name varchar(45) NOT NULL, |
@@ -142,29 +142,29 @@ discard block |
||
142 | 142 | CNT_is_EU tinyint(1) DEFAULT '0', |
143 | 143 | CNT_active tinyint(1) DEFAULT '0', |
144 | 144 | PRIMARY KEY (CNT_ISO)"; |
145 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
146 | - $table_name = 'esp_currency'; |
|
147 | - $sql = "CUR_code varchar(6) NOT NULL, |
|
145 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
146 | + $table_name = 'esp_currency'; |
|
147 | + $sql = "CUR_code varchar(6) NOT NULL, |
|
148 | 148 | CUR_single varchar(45) DEFAULT 'dollar', |
149 | 149 | CUR_plural varchar(45) DEFAULT 'dollars', |
150 | 150 | CUR_sign varchar(45) DEFAULT '$', |
151 | 151 | CUR_dec_plc varchar(1) NOT NULL DEFAULT '2', |
152 | 152 | CUR_active tinyint(1) DEFAULT '0', |
153 | 153 | PRIMARY KEY (CUR_code)"; |
154 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
155 | - // note: although this table is no longer in use, |
|
156 | - // it hasn't been removed because then queries to the model will have errors. |
|
157 | - // but you should expect this table and its corresponding model to be removed in |
|
158 | - // the next few months |
|
159 | - $table_name = 'esp_currency_payment_method'; |
|
160 | - $sql = "CPM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
154 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
155 | + // note: although this table is no longer in use, |
|
156 | + // it hasn't been removed because then queries to the model will have errors. |
|
157 | + // but you should expect this table and its corresponding model to be removed in |
|
158 | + // the next few months |
|
159 | + $table_name = 'esp_currency_payment_method'; |
|
160 | + $sql = "CPM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
161 | 161 | CUR_code varchar(6) NOT NULL, |
162 | 162 | PMD_ID int(11) NOT NULL, |
163 | 163 | PRIMARY KEY (CPM_ID), |
164 | 164 | KEY PMD_ID (PMD_ID)"; |
165 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
166 | - $table_name = 'esp_datetime'; |
|
167 | - $sql = "DTT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
165 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
166 | + $table_name = 'esp_datetime'; |
|
167 | + $sql = "DTT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
168 | 168 | EVT_ID bigint(20) unsigned NOT NULL, |
169 | 169 | DTT_name varchar(255) NOT NULL DEFAULT '', |
170 | 170 | DTT_description text NOT NULL, |
@@ -181,25 +181,25 @@ discard block |
||
181 | 181 | KEY DTT_EVT_start (DTT_EVT_start), |
182 | 182 | KEY EVT_ID (EVT_ID), |
183 | 183 | KEY DTT_is_primary (DTT_is_primary)"; |
184 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
185 | - $table_name = "esp_datetime_ticket"; |
|
186 | - $sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
184 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
185 | + $table_name = "esp_datetime_ticket"; |
|
186 | + $sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
187 | 187 | DTT_ID int(10) unsigned NOT NULL, |
188 | 188 | TKT_ID int(10) unsigned NOT NULL, |
189 | 189 | PRIMARY KEY (DTK_ID), |
190 | 190 | KEY DTT_ID (DTT_ID), |
191 | 191 | KEY TKT_ID (TKT_ID)"; |
192 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
193 | - $table_name = 'esp_event_message_template'; |
|
194 | - $sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
|
192 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
193 | + $table_name = 'esp_event_message_template'; |
|
194 | + $sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
|
195 | 195 | EVT_ID bigint(20) unsigned NOT NULL DEFAULT 0, |
196 | 196 | GRP_ID int(10) unsigned NOT NULL DEFAULT 0, |
197 | 197 | PRIMARY KEY (EMT_ID), |
198 | 198 | KEY EVT_ID (EVT_ID), |
199 | 199 | KEY GRP_ID (GRP_ID)"; |
200 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
201 | - $table_name = 'esp_event_meta'; |
|
202 | - $sql = "EVTM_ID int(10) NOT NULL AUTO_INCREMENT, |
|
200 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
201 | + $table_name = 'esp_event_meta'; |
|
202 | + $sql = "EVTM_ID int(10) NOT NULL AUTO_INCREMENT, |
|
203 | 203 | EVT_ID bigint(20) unsigned NOT NULL, |
204 | 204 | EVT_display_desc tinyint(1) unsigned NOT NULL DEFAULT 1, |
205 | 205 | EVT_display_ticket_selector tinyint(1) unsigned NOT NULL DEFAULT 1, |
@@ -214,34 +214,34 @@ discard block |
||
214 | 214 | EVT_donations tinyint(1) NULL, |
215 | 215 | PRIMARY KEY (EVTM_ID), |
216 | 216 | KEY EVT_ID (EVT_ID)"; |
217 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
218 | - $table_name = 'esp_event_question_group'; |
|
219 | - $sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
217 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
218 | + $table_name = 'esp_event_question_group'; |
|
219 | + $sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
220 | 220 | EVT_ID bigint(20) unsigned NOT NULL, |
221 | 221 | QSG_ID int(10) unsigned NOT NULL, |
222 | 222 | EQG_primary tinyint(1) unsigned NOT NULL DEFAULT 0, |
223 | 223 | PRIMARY KEY (EQG_ID), |
224 | 224 | KEY EVT_ID (EVT_ID), |
225 | 225 | KEY QSG_ID (QSG_ID)"; |
226 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
227 | - $table_name = 'esp_event_venue'; |
|
228 | - $sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT, |
|
226 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
227 | + $table_name = 'esp_event_venue'; |
|
228 | + $sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT, |
|
229 | 229 | EVT_ID bigint(20) unsigned NOT NULL, |
230 | 230 | VNU_ID bigint(20) unsigned NOT NULL, |
231 | 231 | EVV_primary tinyint(1) unsigned NOT NULL DEFAULT 0, |
232 | 232 | PRIMARY KEY (EVV_ID)"; |
233 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
234 | - $table_name = 'esp_extra_meta'; |
|
235 | - $sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
233 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
234 | + $table_name = 'esp_extra_meta'; |
|
235 | + $sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
236 | 236 | OBJ_ID int(11) DEFAULT NULL, |
237 | 237 | EXM_type varchar(45) DEFAULT NULL, |
238 | 238 | EXM_key varchar(45) DEFAULT NULL, |
239 | 239 | EXM_value text, |
240 | 240 | PRIMARY KEY (EXM_ID), |
241 | 241 | KEY EXM_type (EXM_type,OBJ_ID,EXM_key)"; |
242 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
243 | - $table_name = 'esp_extra_join'; |
|
244 | - $sql = "EXJ_ID int(11) NOT NULL AUTO_INCREMENT, |
|
242 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
243 | + $table_name = 'esp_extra_join'; |
|
244 | + $sql = "EXJ_ID int(11) NOT NULL AUTO_INCREMENT, |
|
245 | 245 | EXJ_first_model_id varchar(6) NOT NULL, |
246 | 246 | EXJ_first_model_name varchar(20) NOT NULL, |
247 | 247 | EXJ_second_model_id varchar(6) NOT NULL, |
@@ -249,9 +249,9 @@ discard block |
||
249 | 249 | PRIMARY KEY (EXJ_ID), |
250 | 250 | KEY first_model (EXJ_first_model_name,EXJ_first_model_id), |
251 | 251 | KEY second_model (EXJ_second_model_name,EXJ_second_model_id)"; |
252 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
253 | - $table_name = 'esp_line_item'; |
|
254 | - $sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT, |
|
252 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
253 | + $table_name = 'esp_line_item'; |
|
254 | + $sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT, |
|
255 | 255 | LIN_code varchar(245) NOT NULL DEFAULT '', |
256 | 256 | TXN_ID int(11) DEFAULT NULL, |
257 | 257 | LIN_name varchar(245) NOT NULL DEFAULT '', |
@@ -272,11 +272,11 @@ discard block |
||
272 | 272 | KEY txn_type_timestamp (TXN_ID,LIN_type,LIN_timestamp), |
273 | 273 | KEY txn_obj_id_obj_type (TXN_ID,OBJ_ID,OBJ_type), |
274 | 274 | KEY obj_id_obj_type (OBJ_ID,OBJ_type)"; |
275 | - $this->_get_table_manager()->dropIndex('esp_line_item', 'TXN_ID'); |
|
276 | - $this->_get_table_manager()->dropIndex('esp_line_item', 'LIN_code'); |
|
277 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
278 | - $table_name = 'esp_log'; |
|
279 | - $sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT, |
|
275 | + $this->_get_table_manager()->dropIndex('esp_line_item', 'TXN_ID'); |
|
276 | + $this->_get_table_manager()->dropIndex('esp_line_item', 'LIN_code'); |
|
277 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
278 | + $table_name = 'esp_log'; |
|
279 | + $sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT, |
|
280 | 280 | LOG_time datetime DEFAULT NULL, |
281 | 281 | OBJ_ID varchar(45) DEFAULT NULL, |
282 | 282 | OBJ_type varchar(45) DEFAULT NULL, |
@@ -287,12 +287,12 @@ discard block |
||
287 | 287 | KEY LOG_time (LOG_time), |
288 | 288 | KEY OBJ (OBJ_type,OBJ_ID), |
289 | 289 | KEY LOG_type (LOG_type)"; |
290 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
291 | - $table_name = 'esp_message'; |
|
292 | - $this->_get_table_manager()->dropIndexIfSizeNot($table_name, 'MSG_to'); |
|
293 | - $this->_get_table_manager()->dropIndexIfSizeNot($table_name, 'MSG_from'); |
|
294 | - $this->_get_table_manager()->dropIndexIfSizeNot($table_name, 'MSG_subject'); |
|
295 | - $sql = "MSG_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
|
290 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
291 | + $table_name = 'esp_message'; |
|
292 | + $this->_get_table_manager()->dropIndexIfSizeNot($table_name, 'MSG_to'); |
|
293 | + $this->_get_table_manager()->dropIndexIfSizeNot($table_name, 'MSG_from'); |
|
294 | + $this->_get_table_manager()->dropIndexIfSizeNot($table_name, 'MSG_subject'); |
|
295 | + $sql = "MSG_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
|
296 | 296 | GRP_ID int(10) unsigned NULL, |
297 | 297 | MSG_token varchar(255) NULL, |
298 | 298 | TXN_ID int(10) unsigned NULL, |
@@ -324,18 +324,18 @@ discard block |
||
324 | 324 | KEY STS_ID (STS_ID), |
325 | 325 | KEY MSG_created (MSG_created), |
326 | 326 | KEY MSG_modified (MSG_modified)"; |
327 | - $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
328 | - $table_name = 'esp_message_template'; |
|
329 | - $sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
327 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
328 | + $table_name = 'esp_message_template'; |
|
329 | + $sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
330 | 330 | GRP_ID int(10) unsigned NOT NULL, |
331 | 331 | MTP_context varchar(50) NOT NULL, |
332 | 332 | MTP_template_field varchar(30) NOT NULL, |
333 | 333 | MTP_content text NOT NULL, |
334 | 334 | PRIMARY KEY (MTP_ID), |
335 | 335 | KEY GRP_ID (GRP_ID)"; |
336 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
337 | - $table_name = 'esp_message_template_group'; |
|
338 | - $sql = "GRP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
336 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
337 | + $table_name = 'esp_message_template_group'; |
|
338 | + $sql = "GRP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
339 | 339 | MTP_user_id int(10) NOT NULL DEFAULT '1', |
340 | 340 | MTP_name varchar(245) NOT NULL DEFAULT '', |
341 | 341 | MTP_description varchar(245) NOT NULL DEFAULT '', |
@@ -347,9 +347,9 @@ discard block |
||
347 | 347 | MTP_is_active tinyint(1) NOT NULL DEFAULT '1', |
348 | 348 | PRIMARY KEY (GRP_ID), |
349 | 349 | KEY MTP_user_id (MTP_user_id)"; |
350 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
351 | - $table_name = 'esp_payment'; |
|
352 | - $sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
350 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
351 | + $table_name = 'esp_payment'; |
|
352 | + $sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
353 | 353 | TXN_ID int(10) unsigned DEFAULT NULL, |
354 | 354 | STS_ID varchar(3) DEFAULT NULL, |
355 | 355 | PAY_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00', |
@@ -366,9 +366,9 @@ discard block |
||
366 | 366 | PRIMARY KEY (PAY_ID), |
367 | 367 | KEY PAY_timestamp (PAY_timestamp), |
368 | 368 | KEY TXN_ID (TXN_ID)"; |
369 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
370 | - $table_name = 'esp_payment_method'; |
|
371 | - $sql = "PMD_ID int(11) NOT NULL AUTO_INCREMENT, |
|
369 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
370 | + $table_name = 'esp_payment_method'; |
|
371 | + $sql = "PMD_ID int(11) NOT NULL AUTO_INCREMENT, |
|
372 | 372 | PMD_type varchar(124) DEFAULT NULL, |
373 | 373 | PMD_name varchar(255) DEFAULT NULL, |
374 | 374 | PMD_desc text, |
@@ -384,24 +384,24 @@ discard block |
||
384 | 384 | PRIMARY KEY (PMD_ID), |
385 | 385 | UNIQUE KEY PMD_slug_UNIQUE (PMD_slug), |
386 | 386 | KEY PMD_type (PMD_type)"; |
387 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
388 | - $table_name = "esp_ticket_price"; |
|
389 | - $sql = "TKP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
387 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
388 | + $table_name = "esp_ticket_price"; |
|
389 | + $sql = "TKP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
390 | 390 | TKT_ID int(10) unsigned NOT NULL, |
391 | 391 | PRC_ID int(10) unsigned NOT NULL, |
392 | 392 | PRIMARY KEY (TKP_ID), |
393 | 393 | KEY TKT_ID (TKT_ID), |
394 | 394 | KEY PRC_ID (PRC_ID)"; |
395 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
396 | - $table_name = "esp_ticket_template"; |
|
397 | - $sql = "TTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
395 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
396 | + $table_name = "esp_ticket_template"; |
|
397 | + $sql = "TTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
398 | 398 | TTM_name varchar(45) NOT NULL, |
399 | 399 | TTM_description text, |
400 | 400 | TTM_file varchar(45), |
401 | 401 | PRIMARY KEY (TTM_ID)"; |
402 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
403 | - $table_name = 'esp_question'; |
|
404 | - $sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
402 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
403 | + $table_name = 'esp_question'; |
|
404 | + $sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
405 | 405 | QST_display_text text NOT NULL, |
406 | 406 | QST_admin_label varchar(255) NOT NULL, |
407 | 407 | QST_system varchar(25) DEFAULT NULL, |
@@ -415,18 +415,18 @@ discard block |
||
415 | 415 | QST_deleted tinyint(2) unsigned NOT NULL DEFAULT 0, |
416 | 416 | PRIMARY KEY (QST_ID), |
417 | 417 | KEY QST_order (QST_order)'; |
418 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
419 | - $table_name = 'esp_question_group_question'; |
|
420 | - $sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
418 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
419 | + $table_name = 'esp_question_group_question'; |
|
420 | + $sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
421 | 421 | QSG_ID int(10) unsigned NOT NULL, |
422 | 422 | QST_ID int(10) unsigned NOT NULL, |
423 | 423 | QGQ_order int(10) unsigned NOT NULL DEFAULT 0, |
424 | 424 | PRIMARY KEY (QGQ_ID), |
425 | 425 | KEY QST_ID (QST_ID), |
426 | 426 | KEY QSG_ID_order (QSG_ID,QGQ_order)"; |
427 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
428 | - $table_name = 'esp_question_option'; |
|
429 | - $sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
427 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
428 | + $table_name = 'esp_question_option'; |
|
429 | + $sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
430 | 430 | QSO_value varchar(255) NOT NULL, |
431 | 431 | QSO_desc text NOT NULL, |
432 | 432 | QST_ID int(10) unsigned NOT NULL, |
@@ -436,9 +436,9 @@ discard block |
||
436 | 436 | PRIMARY KEY (QSO_ID), |
437 | 437 | KEY QST_ID (QST_ID), |
438 | 438 | KEY QSO_order (QSO_order)"; |
439 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
440 | - $table_name = 'esp_registration'; |
|
441 | - $sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
439 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
440 | + $table_name = 'esp_registration'; |
|
441 | + $sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
442 | 442 | EVT_ID bigint(20) unsigned NOT NULL, |
443 | 443 | ATT_ID bigint(20) unsigned NOT NULL, |
444 | 444 | TXN_ID int(10) unsigned NOT NULL, |
@@ -462,18 +462,18 @@ discard block |
||
462 | 462 | KEY TKT_ID (TKT_ID), |
463 | 463 | KEY EVT_ID (EVT_ID), |
464 | 464 | KEY STS_ID (STS_ID)"; |
465 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
466 | - $table_name = 'esp_registration_payment'; |
|
467 | - $sql = "RPY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
465 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
466 | + $table_name = 'esp_registration_payment'; |
|
467 | + $sql = "RPY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
468 | 468 | REG_ID int(10) unsigned NOT NULL, |
469 | 469 | PAY_ID int(10) unsigned NULL, |
470 | 470 | RPY_amount decimal(12,3) NOT NULL DEFAULT '0.00', |
471 | 471 | PRIMARY KEY (RPY_ID), |
472 | 472 | KEY REG_ID (REG_ID), |
473 | 473 | KEY PAY_ID (PAY_ID)"; |
474 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
475 | - $table_name = 'esp_state'; |
|
476 | - $sql = "STA_ID smallint(5) unsigned NOT NULL AUTO_INCREMENT, |
|
474 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
475 | + $table_name = 'esp_state'; |
|
476 | + $sql = "STA_ID smallint(5) unsigned NOT NULL AUTO_INCREMENT, |
|
477 | 477 | CNT_ISO varchar(2) NOT NULL, |
478 | 478 | STA_abbrev varchar(24) NOT NULL, |
479 | 479 | STA_name varchar(100) NOT NULL, |
@@ -481,9 +481,9 @@ discard block |
||
481 | 481 | PRIMARY KEY (STA_ID), |
482 | 482 | KEY STA_abbrev (STA_abbrev), |
483 | 483 | KEY CNT_ISO (CNT_ISO)"; |
484 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
485 | - $table_name = 'esp_status'; |
|
486 | - $sql = "STS_ID varchar(3) NOT NULL, |
|
484 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
485 | + $table_name = 'esp_status'; |
|
486 | + $sql = "STS_ID varchar(3) NOT NULL, |
|
487 | 487 | STS_code varchar(45) NOT NULL, |
488 | 488 | STS_type varchar(45) NOT NULL, |
489 | 489 | STS_can_edit tinyint(1) NOT NULL DEFAULT 0, |
@@ -491,9 +491,9 @@ discard block |
||
491 | 491 | STS_open tinyint(1) NOT NULL DEFAULT 1, |
492 | 492 | UNIQUE KEY STS_ID_UNIQUE (STS_ID), |
493 | 493 | KEY STS_type (STS_type)"; |
494 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
495 | - $table_name = 'esp_transaction'; |
|
496 | - $sql = "TXN_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
494 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
495 | + $table_name = 'esp_transaction'; |
|
496 | + $sql = "TXN_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
497 | 497 | TXN_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00', |
498 | 498 | TXN_total decimal(12,3) DEFAULT '0.00', |
499 | 499 | TXN_paid decimal(12,3) NOT NULL DEFAULT '0.00', |
@@ -505,9 +505,9 @@ discard block |
||
505 | 505 | PRIMARY KEY (TXN_ID), |
506 | 506 | KEY TXN_timestamp (TXN_timestamp), |
507 | 507 | KEY STS_ID (STS_ID)"; |
508 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
509 | - $table_name = 'esp_venue_meta'; |
|
510 | - $sql = "VNUM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
508 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
509 | + $table_name = 'esp_venue_meta'; |
|
510 | + $sql = "VNUM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
511 | 511 | VNU_ID bigint(20) unsigned NOT NULL DEFAULT 0, |
512 | 512 | VNU_address varchar(255) DEFAULT NULL, |
513 | 513 | VNU_address2 varchar(255) DEFAULT NULL, |
@@ -526,10 +526,10 @@ discard block |
||
526 | 526 | KEY VNU_ID (VNU_ID), |
527 | 527 | KEY STA_ID (STA_ID), |
528 | 528 | KEY CNT_ISO (CNT_ISO)"; |
529 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
530 | - // modified tables |
|
531 | - $table_name = "esp_price"; |
|
532 | - $sql = "PRC_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
529 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
530 | + // modified tables |
|
531 | + $table_name = "esp_price"; |
|
532 | + $sql = "PRC_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
533 | 533 | PRT_ID tinyint(3) unsigned NOT NULL, |
534 | 534 | PRC_amount decimal(12,3) NOT NULL DEFAULT '0.00', |
535 | 535 | PRC_name varchar(245) NOT NULL, |
@@ -542,9 +542,9 @@ discard block |
||
542 | 542 | PRC_parent int(10) unsigned DEFAULT 0, |
543 | 543 | PRIMARY KEY (PRC_ID), |
544 | 544 | KEY PRT_ID (PRT_ID)"; |
545 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
546 | - $table_name = "esp_price_type"; |
|
547 | - $sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT, |
|
545 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
546 | + $table_name = "esp_price_type"; |
|
547 | + $sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT, |
|
548 | 548 | PRT_name varchar(45) NOT NULL, |
549 | 549 | PBT_ID tinyint(3) unsigned NOT NULL DEFAULT '1', |
550 | 550 | PRT_is_percent tinyint(1) NOT NULL DEFAULT '0', |
@@ -553,9 +553,9 @@ discard block |
||
553 | 553 | PRT_deleted tinyint(1) NOT NULL DEFAULT '0', |
554 | 554 | UNIQUE KEY PRT_name_UNIQUE (PRT_name), |
555 | 555 | PRIMARY KEY (PRT_ID)"; |
556 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
557 | - $table_name = "esp_ticket"; |
|
558 | - $sql = "TKT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
556 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
557 | + $table_name = "esp_ticket"; |
|
558 | + $sql = "TKT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
559 | 559 | TTM_ID int(10) unsigned NOT NULL, |
560 | 560 | TKT_name varchar(245) NOT NULL DEFAULT '', |
561 | 561 | TKT_description text NOT NULL, |
@@ -578,9 +578,9 @@ discard block |
||
578 | 578 | TKT_deleted tinyint(1) NOT NULL DEFAULT '0', |
579 | 579 | PRIMARY KEY (TKT_ID), |
580 | 580 | KEY TKT_start_date (TKT_start_date)"; |
581 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
582 | - $table_name = 'esp_question_group'; |
|
583 | - $sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
581 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
582 | + $table_name = 'esp_question_group'; |
|
583 | + $sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
584 | 584 | QSG_name varchar(255) NOT NULL, |
585 | 585 | QSG_identifier varchar(100) NOT NULL, |
586 | 586 | QSG_desc text NULL, |
@@ -593,159 +593,159 @@ discard block |
||
593 | 593 | PRIMARY KEY (QSG_ID), |
594 | 594 | UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier), |
595 | 595 | KEY QSG_order (QSG_order)'; |
596 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
597 | - $this->insert_default_data(); |
|
598 | - return true; |
|
599 | - } |
|
596 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
597 | + $this->insert_default_data(); |
|
598 | + return true; |
|
599 | + } |
|
600 | 600 | |
601 | - /** |
|
602 | - * Inserts default data after parent was called. |
|
603 | - * @since $VID:$ |
|
604 | - * @throws EE_Error |
|
605 | - * @throws InvalidArgumentException |
|
606 | - * @throws ReflectionException |
|
607 | - * @throws InvalidDataTypeException |
|
608 | - * @throws InvalidInterfaceException |
|
609 | - */ |
|
610 | - public function insert_default_data() |
|
611 | - { |
|
612 | - /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */ |
|
613 | - $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
|
614 | - // (because many need to convert old string states to foreign keys into the states table) |
|
615 | - $script_4_1_defaults->insert_default_states(); |
|
616 | - $script_4_1_defaults->insert_default_countries(); |
|
617 | - /** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */ |
|
618 | - $script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0'); |
|
619 | - $script_4_5_defaults->insert_default_price_types(); |
|
620 | - $script_4_5_defaults->insert_default_prices(); |
|
621 | - $script_4_5_defaults->insert_default_tickets(); |
|
622 | - /** @var EE_DMS_Core_4_6_0 $script_4_6_defaults */ |
|
623 | - $script_4_6_defaults = EE_Registry::instance()->load_dms('Core_4_6_0'); |
|
624 | - $script_4_6_defaults->add_default_admin_only_payments(); |
|
625 | - $script_4_6_defaults->insert_default_currencies(); |
|
626 | - /** @var EE_DMS_Core_4_8_0 $script_4_8_defaults */ |
|
627 | - $script_4_8_defaults = EE_Registry::instance()->load_dms('Core_4_8_0'); |
|
628 | - $script_4_8_defaults->verify_new_countries(); |
|
629 | - $script_4_8_defaults->verify_new_currencies(); |
|
630 | - $this->verify_db_collations(); |
|
631 | - $this->verify_db_collations_again(); |
|
632 | - } |
|
601 | + /** |
|
602 | + * Inserts default data after parent was called. |
|
603 | + * @since $VID:$ |
|
604 | + * @throws EE_Error |
|
605 | + * @throws InvalidArgumentException |
|
606 | + * @throws ReflectionException |
|
607 | + * @throws InvalidDataTypeException |
|
608 | + * @throws InvalidInterfaceException |
|
609 | + */ |
|
610 | + public function insert_default_data() |
|
611 | + { |
|
612 | + /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */ |
|
613 | + $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
|
614 | + // (because many need to convert old string states to foreign keys into the states table) |
|
615 | + $script_4_1_defaults->insert_default_states(); |
|
616 | + $script_4_1_defaults->insert_default_countries(); |
|
617 | + /** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */ |
|
618 | + $script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0'); |
|
619 | + $script_4_5_defaults->insert_default_price_types(); |
|
620 | + $script_4_5_defaults->insert_default_prices(); |
|
621 | + $script_4_5_defaults->insert_default_tickets(); |
|
622 | + /** @var EE_DMS_Core_4_6_0 $script_4_6_defaults */ |
|
623 | + $script_4_6_defaults = EE_Registry::instance()->load_dms('Core_4_6_0'); |
|
624 | + $script_4_6_defaults->add_default_admin_only_payments(); |
|
625 | + $script_4_6_defaults->insert_default_currencies(); |
|
626 | + /** @var EE_DMS_Core_4_8_0 $script_4_8_defaults */ |
|
627 | + $script_4_8_defaults = EE_Registry::instance()->load_dms('Core_4_8_0'); |
|
628 | + $script_4_8_defaults->verify_new_countries(); |
|
629 | + $script_4_8_defaults->verify_new_currencies(); |
|
630 | + $this->verify_db_collations(); |
|
631 | + $this->verify_db_collations_again(); |
|
632 | + } |
|
633 | 633 | |
634 | 634 | |
635 | 635 | |
636 | - /** |
|
637 | - * @return boolean |
|
638 | - */ |
|
639 | - public function schema_changes_after_migration() |
|
640 | - { |
|
641 | - return true; |
|
642 | - } |
|
636 | + /** |
|
637 | + * @return boolean |
|
638 | + */ |
|
639 | + public function schema_changes_after_migration() |
|
640 | + { |
|
641 | + return true; |
|
642 | + } |
|
643 | 643 | |
644 | 644 | |
645 | 645 | |
646 | - public function migration_page_hooks() |
|
647 | - { |
|
648 | - } |
|
646 | + public function migration_page_hooks() |
|
647 | + { |
|
648 | + } |
|
649 | 649 | |
650 | 650 | |
651 | 651 | |
652 | - /** |
|
653 | - * Verify all EE4 models' tables use utf8mb4 collation |
|
654 | - * |
|
655 | - * @return void |
|
656 | - */ |
|
657 | - public function verify_db_collations() |
|
658 | - { |
|
659 | - global $wpdb; |
|
660 | - // double-check we haven't already done it or that that the DB doesn't support utf8mb4 |
|
661 | - if ('utf8mb4' !== $wpdb->charset |
|
662 | - || get_option('ee_verified_db_collations', false)) { |
|
663 | - return; |
|
664 | - } |
|
665 | - // grab tables from each model |
|
666 | - $tables_to_check = array(); |
|
667 | - foreach (EE_Registry::instance()->non_abstract_db_models as $model_name) { |
|
668 | - if (method_exists($model_name, 'instance')) { |
|
669 | - $model_obj = call_user_func(array($model_name, 'instance')); |
|
670 | - if ($model_obj instanceof EEM_Base) { |
|
671 | - foreach ($model_obj->get_tables() as $table) { |
|
672 | - if (strpos($table->get_table_name(), 'esp_') |
|
673 | - && (is_main_site()// for main tables, verify global tables |
|
674 | - || ! $table->is_global()// if not the main site, then only verify non-global tables (avoid doubling up) |
|
675 | - ) |
|
676 | - && function_exists('maybe_convert_table_to_utf8mb4') |
|
677 | - ) { |
|
678 | - $tables_to_check[] = $table->get_table_name(); |
|
679 | - } |
|
680 | - } |
|
681 | - } |
|
682 | - } |
|
683 | - } |
|
684 | - // and let's just be sure these addons' tables get migrated too. They already get handled if their addons are active |
|
685 | - // when this code is run, but not otherwise. Once we record what tables EE added, we'll be able to use that instead |
|
686 | - // of hard-coding this |
|
687 | - $addon_tables = array( |
|
688 | - // mailchimp |
|
689 | - 'esp_event_mailchimp_list_group', |
|
690 | - 'esp_event_question_mailchimp_field', |
|
691 | - // multisite |
|
692 | - 'esp_blog_meta', |
|
693 | - // people |
|
694 | - 'esp_people_to_post', |
|
695 | - // promotions |
|
696 | - 'esp_promotion', |
|
697 | - 'esp_promotion_object', |
|
698 | - ); |
|
699 | - foreach ($addon_tables as $table_name) { |
|
700 | - $tables_to_check[] = $table_name; |
|
701 | - } |
|
702 | - $this->_verify_db_collations_for_tables(array_unique($tables_to_check)); |
|
703 | - // ok and now let's remember this was done (without needing to check the db schemas all over again) |
|
704 | - add_option('ee_verified_db_collations', true, null, 'no'); |
|
705 | - // seeing how this ran with the fix from 10435, no need to check again |
|
706 | - add_option('ee_verified_db_collations_again', true, null, 'no'); |
|
707 | - } |
|
652 | + /** |
|
653 | + * Verify all EE4 models' tables use utf8mb4 collation |
|
654 | + * |
|
655 | + * @return void |
|
656 | + */ |
|
657 | + public function verify_db_collations() |
|
658 | + { |
|
659 | + global $wpdb; |
|
660 | + // double-check we haven't already done it or that that the DB doesn't support utf8mb4 |
|
661 | + if ('utf8mb4' !== $wpdb->charset |
|
662 | + || get_option('ee_verified_db_collations', false)) { |
|
663 | + return; |
|
664 | + } |
|
665 | + // grab tables from each model |
|
666 | + $tables_to_check = array(); |
|
667 | + foreach (EE_Registry::instance()->non_abstract_db_models as $model_name) { |
|
668 | + if (method_exists($model_name, 'instance')) { |
|
669 | + $model_obj = call_user_func(array($model_name, 'instance')); |
|
670 | + if ($model_obj instanceof EEM_Base) { |
|
671 | + foreach ($model_obj->get_tables() as $table) { |
|
672 | + if (strpos($table->get_table_name(), 'esp_') |
|
673 | + && (is_main_site()// for main tables, verify global tables |
|
674 | + || ! $table->is_global()// if not the main site, then only verify non-global tables (avoid doubling up) |
|
675 | + ) |
|
676 | + && function_exists('maybe_convert_table_to_utf8mb4') |
|
677 | + ) { |
|
678 | + $tables_to_check[] = $table->get_table_name(); |
|
679 | + } |
|
680 | + } |
|
681 | + } |
|
682 | + } |
|
683 | + } |
|
684 | + // and let's just be sure these addons' tables get migrated too. They already get handled if their addons are active |
|
685 | + // when this code is run, but not otherwise. Once we record what tables EE added, we'll be able to use that instead |
|
686 | + // of hard-coding this |
|
687 | + $addon_tables = array( |
|
688 | + // mailchimp |
|
689 | + 'esp_event_mailchimp_list_group', |
|
690 | + 'esp_event_question_mailchimp_field', |
|
691 | + // multisite |
|
692 | + 'esp_blog_meta', |
|
693 | + // people |
|
694 | + 'esp_people_to_post', |
|
695 | + // promotions |
|
696 | + 'esp_promotion', |
|
697 | + 'esp_promotion_object', |
|
698 | + ); |
|
699 | + foreach ($addon_tables as $table_name) { |
|
700 | + $tables_to_check[] = $table_name; |
|
701 | + } |
|
702 | + $this->_verify_db_collations_for_tables(array_unique($tables_to_check)); |
|
703 | + // ok and now let's remember this was done (without needing to check the db schemas all over again) |
|
704 | + add_option('ee_verified_db_collations', true, null, 'no'); |
|
705 | + // seeing how this ran with the fix from 10435, no need to check again |
|
706 | + add_option('ee_verified_db_collations_again', true, null, 'no'); |
|
707 | + } |
|
708 | 708 | |
709 | 709 | |
710 | 710 | |
711 | - /** |
|
712 | - * Verifies DB collations because a bug was discovered on https://events.codebasehq.com/projects/event-espresso/tickets/10435 |
|
713 | - * which meant some DB collations might not have been updated |
|
714 | - * @return void |
|
715 | - */ |
|
716 | - public function verify_db_collations_again() |
|
717 | - { |
|
718 | - global $wpdb; |
|
719 | - // double-check we haven't already done this or that the DB doesn't support it |
|
720 | - // compare to how WordPress' upgrade_430() function does this check |
|
721 | - if ('utf8mb4' !== $wpdb->charset |
|
722 | - || get_option('ee_verified_db_collations_again', false)) { |
|
723 | - return; |
|
724 | - } |
|
725 | - $tables_to_check = array( |
|
726 | - 'esp_attendee_meta', |
|
727 | - 'esp_message' |
|
728 | - ); |
|
729 | - $this->_verify_db_collations_for_tables(array_unique($tables_to_check)); |
|
730 | - add_option('ee_verified_db_collations_again', true, null, 'no'); |
|
731 | - } |
|
711 | + /** |
|
712 | + * Verifies DB collations because a bug was discovered on https://events.codebasehq.com/projects/event-espresso/tickets/10435 |
|
713 | + * which meant some DB collations might not have been updated |
|
714 | + * @return void |
|
715 | + */ |
|
716 | + public function verify_db_collations_again() |
|
717 | + { |
|
718 | + global $wpdb; |
|
719 | + // double-check we haven't already done this or that the DB doesn't support it |
|
720 | + // compare to how WordPress' upgrade_430() function does this check |
|
721 | + if ('utf8mb4' !== $wpdb->charset |
|
722 | + || get_option('ee_verified_db_collations_again', false)) { |
|
723 | + return; |
|
724 | + } |
|
725 | + $tables_to_check = array( |
|
726 | + 'esp_attendee_meta', |
|
727 | + 'esp_message' |
|
728 | + ); |
|
729 | + $this->_verify_db_collations_for_tables(array_unique($tables_to_check)); |
|
730 | + add_option('ee_verified_db_collations_again', true, null, 'no'); |
|
731 | + } |
|
732 | 732 | |
733 | 733 | |
734 | 734 | |
735 | - /** |
|
736 | - * Runs maybe_convert_table_to_utf8mb4 on the specified tables |
|
737 | - * @param $tables_to_check |
|
738 | - * @return boolean true if logic ran, false if it didn't |
|
739 | - */ |
|
740 | - protected function _verify_db_collations_for_tables($tables_to_check) |
|
741 | - { |
|
742 | - foreach ($tables_to_check as $table_name) { |
|
743 | - $table_name = $this->_table_analysis->ensureTableNameHasPrefix($table_name); |
|
744 | - if (! apply_filters('FHEE__EE_DMS_Core_4_9_0__verify_db_collations__check_overridden', false, $table_name) |
|
745 | - && $this->_get_table_analysis()->tableExists($table_name) |
|
746 | - ) { |
|
747 | - maybe_convert_table_to_utf8mb4($table_name); |
|
748 | - } |
|
749 | - } |
|
750 | - } |
|
735 | + /** |
|
736 | + * Runs maybe_convert_table_to_utf8mb4 on the specified tables |
|
737 | + * @param $tables_to_check |
|
738 | + * @return boolean true if logic ran, false if it didn't |
|
739 | + */ |
|
740 | + protected function _verify_db_collations_for_tables($tables_to_check) |
|
741 | + { |
|
742 | + foreach ($tables_to_check as $table_name) { |
|
743 | + $table_name = $this->_table_analysis->ensureTableNameHasPrefix($table_name); |
|
744 | + if (! apply_filters('FHEE__EE_DMS_Core_4_9_0__verify_db_collations__check_overridden', false, $table_name) |
|
745 | + && $this->_get_table_analysis()->tableExists($table_name) |
|
746 | + ) { |
|
747 | + maybe_convert_table_to_utf8mb4($table_name); |
|
748 | + } |
|
749 | + } |
|
750 | + } |
|
751 | 751 | } |