@@ -12,9 +12,9 @@ discard block |
||
12 | 12 | $stages = glob(EE_CORE . 'data_migration_scripts/4_9_0_stages/*'); |
13 | 13 | $class_to_filepath = array(); |
14 | 14 | foreach ($stages as $filepath) { |
15 | - $matches = array(); |
|
16 | - preg_match('~4_9_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
17 | - $class_to_filepath[$matches[1]] = $filepath; |
|
15 | + $matches = array(); |
|
16 | + preg_match('~4_9_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
17 | + $class_to_filepath[$matches[1]] = $filepath; |
|
18 | 18 | } |
19 | 19 | //give addons a chance to autoload their stages too |
20 | 20 | $class_to_filepath = apply_filters('FHEE__EE_DMS_4_9_0__autoloaded_stages', $class_to_filepath); |
@@ -33,68 +33,68 @@ discard block |
||
33 | 33 | class EE_DMS_Core_4_9_0 extends EE_Data_Migration_Script_Base |
34 | 34 | { |
35 | 35 | |
36 | - /** |
|
37 | - * return EE_DMS_Core_4_9_0 |
|
38 | - * |
|
39 | - * @param TableManager $table_manager |
|
40 | - * @param TableAnalysis $table_analysis |
|
41 | - */ |
|
42 | - public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) |
|
43 | - { |
|
44 | - $this->_pretty_name = esc_html__("Data Update to Event Espresso 4.9.0", "event_espresso"); |
|
45 | - $this->_priority = 10; |
|
46 | - $this->_migration_stages = array( |
|
47 | - new EE_DMS_4_9_0_Email_System_Question(), |
|
48 | - new EE_DMS_4_9_0_Answers_With_No_Registration(), |
|
49 | - ); |
|
50 | - parent::__construct($table_manager, $table_analysis); |
|
51 | - } |
|
36 | + /** |
|
37 | + * return EE_DMS_Core_4_9_0 |
|
38 | + * |
|
39 | + * @param TableManager $table_manager |
|
40 | + * @param TableAnalysis $table_analysis |
|
41 | + */ |
|
42 | + public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) |
|
43 | + { |
|
44 | + $this->_pretty_name = esc_html__("Data Update to Event Espresso 4.9.0", "event_espresso"); |
|
45 | + $this->_priority = 10; |
|
46 | + $this->_migration_stages = array( |
|
47 | + new EE_DMS_4_9_0_Email_System_Question(), |
|
48 | + new EE_DMS_4_9_0_Answers_With_No_Registration(), |
|
49 | + ); |
|
50 | + parent::__construct($table_manager, $table_analysis); |
|
51 | + } |
|
52 | 52 | |
53 | 53 | |
54 | 54 | |
55 | - /** |
|
56 | - * Whether to migrate or not. |
|
57 | - * |
|
58 | - * @param array $version_array |
|
59 | - * @return bool |
|
60 | - */ |
|
61 | - public function can_migrate_from_version($version_array) |
|
62 | - { |
|
63 | - $version_string = $version_array['Core']; |
|
64 | - if (version_compare($version_string, '4.9.0', '<=') && version_compare($version_string, '4.8.0', '>=')) { |
|
65 | - // echo "$version_string can be migrated from"; |
|
66 | - return true; |
|
67 | - } elseif ( ! $version_string) { |
|
68 | - // echo "no version string provided: $version_string"; |
|
69 | - //no version string provided... this must be pre 4.3 |
|
70 | - return false;//changed mind. dont want people thinking they should migrate yet because they cant |
|
71 | - } else { |
|
72 | - // echo "$version_string doesnt apply"; |
|
73 | - return false; |
|
74 | - } |
|
75 | - } |
|
55 | + /** |
|
56 | + * Whether to migrate or not. |
|
57 | + * |
|
58 | + * @param array $version_array |
|
59 | + * @return bool |
|
60 | + */ |
|
61 | + public function can_migrate_from_version($version_array) |
|
62 | + { |
|
63 | + $version_string = $version_array['Core']; |
|
64 | + if (version_compare($version_string, '4.9.0', '<=') && version_compare($version_string, '4.8.0', '>=')) { |
|
65 | + // echo "$version_string can be migrated from"; |
|
66 | + return true; |
|
67 | + } elseif ( ! $version_string) { |
|
68 | + // echo "no version string provided: $version_string"; |
|
69 | + //no version string provided... this must be pre 4.3 |
|
70 | + return false;//changed mind. dont want people thinking they should migrate yet because they cant |
|
71 | + } else { |
|
72 | + // echo "$version_string doesnt apply"; |
|
73 | + return false; |
|
74 | + } |
|
75 | + } |
|
76 | 76 | |
77 | 77 | |
78 | 78 | |
79 | - /** |
|
80 | - * @return bool |
|
81 | - */ |
|
82 | - public function schema_changes_before_migration() |
|
83 | - { |
|
84 | - require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
85 | - $now_in_mysql = current_time('mysql', true); |
|
86 | - $table_name = 'esp_answer'; |
|
87 | - $sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
79 | + /** |
|
80 | + * @return bool |
|
81 | + */ |
|
82 | + public function schema_changes_before_migration() |
|
83 | + { |
|
84 | + require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
85 | + $now_in_mysql = current_time('mysql', true); |
|
86 | + $table_name = 'esp_answer'; |
|
87 | + $sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
88 | 88 | REG_ID int(10) unsigned NOT NULL, |
89 | 89 | QST_ID int(10) unsigned NOT NULL, |
90 | 90 | ANS_value text NOT NULL, |
91 | 91 | PRIMARY KEY (ANS_ID), |
92 | 92 | KEY REG_ID (REG_ID), |
93 | 93 | KEY QST_ID (QST_ID)"; |
94 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
95 | - $table_name = 'esp_attendee_meta'; |
|
96 | - $this->_get_table_manager()->dropIndexIfSizeNot($table_name, 'ATT_email'); |
|
97 | - $sql = "ATTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
94 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
95 | + $table_name = 'esp_attendee_meta'; |
|
96 | + $this->_get_table_manager()->dropIndexIfSizeNot($table_name, 'ATT_email'); |
|
97 | + $sql = "ATTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
98 | 98 | ATT_ID bigint(20) unsigned NOT NULL, |
99 | 99 | ATT_fname varchar(45) NOT NULL, |
100 | 100 | ATT_lname varchar(45) NOT NULL, |
@@ -111,9 +111,9 @@ discard block |
||
111 | 111 | KEY ATT_email (ATT_email(191)), |
112 | 112 | KEY ATT_lname (ATT_lname), |
113 | 113 | KEY ATT_fname (ATT_fname)"; |
114 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
115 | - $table_name = 'esp_checkin'; |
|
116 | - $sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
114 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
115 | + $table_name = 'esp_checkin'; |
|
116 | + $sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
117 | 117 | REG_ID int(10) unsigned NOT NULL, |
118 | 118 | DTT_ID int(10) unsigned NOT NULL, |
119 | 119 | CHK_in tinyint(1) unsigned NOT NULL DEFAULT 1, |
@@ -121,9 +121,9 @@ discard block |
||
121 | 121 | PRIMARY KEY (CHK_ID), |
122 | 122 | KEY REG_ID (REG_ID), |
123 | 123 | KEY DTT_ID (DTT_ID)"; |
124 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
125 | - $table_name = 'esp_country'; |
|
126 | - $sql = "CNT_ISO varchar(2) NOT NULL, |
|
124 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
125 | + $table_name = 'esp_country'; |
|
126 | + $sql = "CNT_ISO varchar(2) NOT NULL, |
|
127 | 127 | CNT_ISO3 varchar(3) NOT NULL, |
128 | 128 | RGN_ID tinyint(3) unsigned DEFAULT NULL, |
129 | 129 | CNT_name varchar(45) NOT NULL, |
@@ -139,25 +139,25 @@ discard block |
||
139 | 139 | CNT_is_EU tinyint(1) DEFAULT '0', |
140 | 140 | CNT_active tinyint(1) DEFAULT '0', |
141 | 141 | PRIMARY KEY (CNT_ISO)"; |
142 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
143 | - $table_name = 'esp_currency'; |
|
144 | - $sql = "CUR_code varchar(6) NOT NULL, |
|
142 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
143 | + $table_name = 'esp_currency'; |
|
144 | + $sql = "CUR_code varchar(6) NOT NULL, |
|
145 | 145 | CUR_single varchar(45) DEFAULT 'dollar', |
146 | 146 | CUR_plural varchar(45) DEFAULT 'dollars', |
147 | 147 | CUR_sign varchar(45) DEFAULT '$', |
148 | 148 | CUR_dec_plc varchar(1) NOT NULL DEFAULT '2', |
149 | 149 | CUR_active tinyint(1) DEFAULT '0', |
150 | 150 | PRIMARY KEY (CUR_code)"; |
151 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
152 | - $table_name = 'esp_currency_payment_method'; |
|
153 | - $sql = "CPM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
151 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
152 | + $table_name = 'esp_currency_payment_method'; |
|
153 | + $sql = "CPM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
154 | 154 | CUR_code varchar(6) NOT NULL, |
155 | 155 | PMD_ID int(11) NOT NULL, |
156 | 156 | PRIMARY KEY (CPM_ID), |
157 | 157 | KEY PMD_ID (PMD_ID)"; |
158 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
159 | - $table_name = 'esp_datetime'; |
|
160 | - $sql = "DTT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
158 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
159 | + $table_name = 'esp_datetime'; |
|
160 | + $sql = "DTT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
161 | 161 | EVT_ID bigint(20) unsigned NOT NULL, |
162 | 162 | DTT_name varchar(255) NOT NULL DEFAULT '', |
163 | 163 | DTT_description text NOT NULL, |
@@ -174,25 +174,25 @@ discard block |
||
174 | 174 | KEY DTT_EVT_start (DTT_EVT_start), |
175 | 175 | KEY EVT_ID (EVT_ID), |
176 | 176 | KEY DTT_is_primary (DTT_is_primary)"; |
177 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
178 | - $table_name = "esp_datetime_ticket"; |
|
179 | - $sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
177 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
178 | + $table_name = "esp_datetime_ticket"; |
|
179 | + $sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
180 | 180 | DTT_ID int(10) unsigned NOT NULL, |
181 | 181 | TKT_ID int(10) unsigned NOT NULL, |
182 | 182 | PRIMARY KEY (DTK_ID), |
183 | 183 | KEY DTT_ID (DTT_ID), |
184 | 184 | KEY TKT_ID (TKT_ID)"; |
185 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
186 | - $table_name = 'esp_event_message_template'; |
|
187 | - $sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
|
185 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
186 | + $table_name = 'esp_event_message_template'; |
|
187 | + $sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
|
188 | 188 | EVT_ID bigint(20) unsigned NOT NULL DEFAULT 0, |
189 | 189 | GRP_ID int(10) unsigned NOT NULL DEFAULT 0, |
190 | 190 | PRIMARY KEY (EMT_ID), |
191 | 191 | KEY EVT_ID (EVT_ID), |
192 | 192 | KEY GRP_ID (GRP_ID)"; |
193 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
194 | - $table_name = 'esp_event_meta'; |
|
195 | - $sql = "EVTM_ID int(10) NOT NULL AUTO_INCREMENT, |
|
193 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
194 | + $table_name = 'esp_event_meta'; |
|
195 | + $sql = "EVTM_ID int(10) NOT NULL AUTO_INCREMENT, |
|
196 | 196 | EVT_ID bigint(20) unsigned NOT NULL, |
197 | 197 | EVT_display_desc tinyint(1) unsigned NOT NULL DEFAULT 1, |
198 | 198 | EVT_display_ticket_selector tinyint(1) unsigned NOT NULL DEFAULT 1, |
@@ -207,34 +207,34 @@ discard block |
||
207 | 207 | EVT_donations tinyint(1) NULL, |
208 | 208 | PRIMARY KEY (EVTM_ID), |
209 | 209 | KEY EVT_ID (EVT_ID)"; |
210 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
211 | - $table_name = 'esp_event_question_group'; |
|
212 | - $sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
210 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
211 | + $table_name = 'esp_event_question_group'; |
|
212 | + $sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
213 | 213 | EVT_ID bigint(20) unsigned NOT NULL, |
214 | 214 | QSG_ID int(10) unsigned NOT NULL, |
215 | 215 | EQG_primary tinyint(1) unsigned NOT NULL DEFAULT 0, |
216 | 216 | PRIMARY KEY (EQG_ID), |
217 | 217 | KEY EVT_ID (EVT_ID), |
218 | 218 | KEY QSG_ID (QSG_ID)"; |
219 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
220 | - $table_name = 'esp_event_venue'; |
|
221 | - $sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT, |
|
219 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
220 | + $table_name = 'esp_event_venue'; |
|
221 | + $sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT, |
|
222 | 222 | EVT_ID bigint(20) unsigned NOT NULL, |
223 | 223 | VNU_ID bigint(20) unsigned NOT NULL, |
224 | 224 | EVV_primary tinyint(1) unsigned NOT NULL DEFAULT 0, |
225 | 225 | PRIMARY KEY (EVV_ID)"; |
226 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
227 | - $table_name = 'esp_extra_meta'; |
|
228 | - $sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
226 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
227 | + $table_name = 'esp_extra_meta'; |
|
228 | + $sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
229 | 229 | OBJ_ID int(11) DEFAULT NULL, |
230 | 230 | EXM_type varchar(45) DEFAULT NULL, |
231 | 231 | EXM_key varchar(45) DEFAULT NULL, |
232 | 232 | EXM_value text, |
233 | 233 | PRIMARY KEY (EXM_ID), |
234 | 234 | KEY EXM_type (EXM_type,OBJ_ID,EXM_key)"; |
235 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
236 | - $table_name = 'esp_extra_join'; |
|
237 | - $sql = "EXJ_ID int(11) NOT NULL AUTO_INCREMENT, |
|
235 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
236 | + $table_name = 'esp_extra_join'; |
|
237 | + $sql = "EXJ_ID int(11) NOT NULL AUTO_INCREMENT, |
|
238 | 238 | EXJ_first_model_id varchar(6) NOT NULL, |
239 | 239 | EXJ_first_model_name varchar(20) NOT NULL, |
240 | 240 | EXJ_second_model_id varchar(6) NOT NULL, |
@@ -242,9 +242,9 @@ discard block |
||
242 | 242 | PRIMARY KEY (EXJ_ID), |
243 | 243 | KEY first_model (EXJ_first_model_name,EXJ_first_model_id), |
244 | 244 | KEY second_model (EXJ_second_model_name,EXJ_second_model_id)"; |
245 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
246 | - $table_name = 'esp_line_item'; |
|
247 | - $sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT, |
|
245 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
246 | + $table_name = 'esp_line_item'; |
|
247 | + $sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT, |
|
248 | 248 | LIN_code varchar(245) NOT NULL DEFAULT '', |
249 | 249 | TXN_ID int(11) DEFAULT NULL, |
250 | 250 | LIN_name varchar(245) NOT NULL DEFAULT '', |
@@ -263,9 +263,9 @@ discard block |
||
263 | 263 | PRIMARY KEY (LIN_ID), |
264 | 264 | KEY LIN_code (LIN_code(191)), |
265 | 265 | KEY TXN_ID (TXN_ID)"; |
266 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
267 | - $table_name = 'esp_log'; |
|
268 | - $sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT, |
|
266 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
267 | + $table_name = 'esp_log'; |
|
268 | + $sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT, |
|
269 | 269 | LOG_time datetime DEFAULT NULL, |
270 | 270 | OBJ_ID varchar(45) DEFAULT NULL, |
271 | 271 | OBJ_type varchar(45) DEFAULT NULL, |
@@ -276,12 +276,12 @@ discard block |
||
276 | 276 | KEY LOG_time (LOG_time), |
277 | 277 | KEY OBJ (OBJ_type,OBJ_ID), |
278 | 278 | KEY LOG_type (LOG_type)"; |
279 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
280 | - $table_name = 'esp_message'; |
|
281 | - $this->_get_table_manager()->dropIndexIfSizeNot($table_name, 'MSG_to'); |
|
282 | - $this->_get_table_manager()->dropIndexIfSizeNot($table_name, 'MSG_from'); |
|
283 | - $this->_get_table_manager()->dropIndexIfSizeNot($table_name, 'MSG_subject'); |
|
284 | - $sql = "MSG_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
|
279 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
280 | + $table_name = 'esp_message'; |
|
281 | + $this->_get_table_manager()->dropIndexIfSizeNot($table_name, 'MSG_to'); |
|
282 | + $this->_get_table_manager()->dropIndexIfSizeNot($table_name, 'MSG_from'); |
|
283 | + $this->_get_table_manager()->dropIndexIfSizeNot($table_name, 'MSG_subject'); |
|
284 | + $sql = "MSG_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
|
285 | 285 | GRP_ID int(10) unsigned NULL, |
286 | 286 | MSG_token varchar(255) NULL, |
287 | 287 | TXN_ID int(10) unsigned NULL, |
@@ -313,18 +313,18 @@ discard block |
||
313 | 313 | KEY STS_ID (STS_ID), |
314 | 314 | KEY MSG_created (MSG_created), |
315 | 315 | KEY MSG_modified (MSG_modified)"; |
316 | - $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
317 | - $table_name = 'esp_message_template'; |
|
318 | - $sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
316 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
317 | + $table_name = 'esp_message_template'; |
|
318 | + $sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
319 | 319 | GRP_ID int(10) unsigned NOT NULL, |
320 | 320 | MTP_context varchar(50) NOT NULL, |
321 | 321 | MTP_template_field varchar(30) NOT NULL, |
322 | 322 | MTP_content text NOT NULL, |
323 | 323 | PRIMARY KEY (MTP_ID), |
324 | 324 | KEY GRP_ID (GRP_ID)"; |
325 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
326 | - $table_name = 'esp_message_template_group'; |
|
327 | - $sql = "GRP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
325 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
326 | + $table_name = 'esp_message_template_group'; |
|
327 | + $sql = "GRP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
328 | 328 | MTP_user_id int(10) NOT NULL DEFAULT '1', |
329 | 329 | MTP_name varchar(245) NOT NULL DEFAULT '', |
330 | 330 | MTP_description varchar(245) NOT NULL DEFAULT '', |
@@ -336,9 +336,9 @@ discard block |
||
336 | 336 | MTP_is_active tinyint(1) NOT NULL DEFAULT '1', |
337 | 337 | PRIMARY KEY (GRP_ID), |
338 | 338 | KEY MTP_user_id (MTP_user_id)"; |
339 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
340 | - $table_name = 'esp_payment'; |
|
341 | - $sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
339 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
340 | + $table_name = 'esp_payment'; |
|
341 | + $sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
342 | 342 | TXN_ID int(10) unsigned DEFAULT NULL, |
343 | 343 | STS_ID varchar(3) DEFAULT NULL, |
344 | 344 | PAY_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00', |
@@ -355,9 +355,9 @@ discard block |
||
355 | 355 | PRIMARY KEY (PAY_ID), |
356 | 356 | KEY PAY_timestamp (PAY_timestamp), |
357 | 357 | KEY TXN_ID (TXN_ID)"; |
358 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
359 | - $table_name = 'esp_payment_method'; |
|
360 | - $sql = "PMD_ID int(11) NOT NULL AUTO_INCREMENT, |
|
358 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
359 | + $table_name = 'esp_payment_method'; |
|
360 | + $sql = "PMD_ID int(11) NOT NULL AUTO_INCREMENT, |
|
361 | 361 | PMD_type varchar(124) DEFAULT NULL, |
362 | 362 | PMD_name varchar(255) DEFAULT NULL, |
363 | 363 | PMD_desc text, |
@@ -373,24 +373,24 @@ discard block |
||
373 | 373 | PRIMARY KEY (PMD_ID), |
374 | 374 | UNIQUE KEY PMD_slug_UNIQUE (PMD_slug), |
375 | 375 | KEY PMD_type (PMD_type)"; |
376 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
377 | - $table_name = "esp_ticket_price"; |
|
378 | - $sql = "TKP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
376 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
377 | + $table_name = "esp_ticket_price"; |
|
378 | + $sql = "TKP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
379 | 379 | TKT_ID int(10) unsigned NOT NULL, |
380 | 380 | PRC_ID int(10) unsigned NOT NULL, |
381 | 381 | PRIMARY KEY (TKP_ID), |
382 | 382 | KEY TKT_ID (TKT_ID), |
383 | 383 | KEY PRC_ID (PRC_ID)"; |
384 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
385 | - $table_name = "esp_ticket_template"; |
|
386 | - $sql = "TTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
384 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
385 | + $table_name = "esp_ticket_template"; |
|
386 | + $sql = "TTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
387 | 387 | TTM_name varchar(45) NOT NULL, |
388 | 388 | TTM_description text, |
389 | 389 | TTM_file varchar(45), |
390 | 390 | PRIMARY KEY (TTM_ID)"; |
391 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
392 | - $table_name = 'esp_question'; |
|
393 | - $sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
391 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
392 | + $table_name = 'esp_question'; |
|
393 | + $sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
394 | 394 | QST_display_text text NOT NULL, |
395 | 395 | QST_admin_label varchar(255) NOT NULL, |
396 | 396 | QST_system varchar(25) DEFAULT NULL, |
@@ -404,18 +404,18 @@ discard block |
||
404 | 404 | QST_deleted tinyint(2) unsigned NOT NULL DEFAULT 0, |
405 | 405 | PRIMARY KEY (QST_ID), |
406 | 406 | KEY QST_order (QST_order)'; |
407 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
408 | - $table_name = 'esp_question_group_question'; |
|
409 | - $sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
407 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
408 | + $table_name = 'esp_question_group_question'; |
|
409 | + $sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
410 | 410 | QSG_ID int(10) unsigned NOT NULL, |
411 | 411 | QST_ID int(10) unsigned NOT NULL, |
412 | 412 | QGQ_order int(10) unsigned NOT NULL DEFAULT 0, |
413 | 413 | PRIMARY KEY (QGQ_ID), |
414 | 414 | KEY QST_ID (QST_ID), |
415 | 415 | KEY QSG_ID_order (QSG_ID,QGQ_order)"; |
416 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
417 | - $table_name = 'esp_question_option'; |
|
418 | - $sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
416 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
417 | + $table_name = 'esp_question_option'; |
|
418 | + $sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
419 | 419 | QSO_value varchar(255) NOT NULL, |
420 | 420 | QSO_desc text NOT NULL, |
421 | 421 | QST_ID int(10) unsigned NOT NULL, |
@@ -425,9 +425,9 @@ discard block |
||
425 | 425 | PRIMARY KEY (QSO_ID), |
426 | 426 | KEY QST_ID (QST_ID), |
427 | 427 | KEY QSO_order (QSO_order)"; |
428 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
429 | - $table_name = 'esp_registration'; |
|
430 | - $sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
428 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
429 | + $table_name = 'esp_registration'; |
|
430 | + $sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
431 | 431 | EVT_ID bigint(20) unsigned NOT NULL, |
432 | 432 | ATT_ID bigint(20) unsigned NOT NULL, |
433 | 433 | TXN_ID int(10) unsigned NOT NULL, |
@@ -451,18 +451,18 @@ discard block |
||
451 | 451 | KEY TKT_ID (TKT_ID), |
452 | 452 | KEY EVT_ID (EVT_ID), |
453 | 453 | KEY STS_ID (STS_ID)"; |
454 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
455 | - $table_name = 'esp_registration_payment'; |
|
456 | - $sql = "RPY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
454 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
455 | + $table_name = 'esp_registration_payment'; |
|
456 | + $sql = "RPY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
457 | 457 | REG_ID int(10) unsigned NOT NULL, |
458 | 458 | PAY_ID int(10) unsigned NULL, |
459 | 459 | RPY_amount decimal(12,3) NOT NULL DEFAULT '0.00', |
460 | 460 | PRIMARY KEY (RPY_ID), |
461 | 461 | KEY REG_ID (REG_ID), |
462 | 462 | KEY PAY_ID (PAY_ID)"; |
463 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
464 | - $table_name = 'esp_state'; |
|
465 | - $sql = "STA_ID smallint(5) unsigned NOT NULL AUTO_INCREMENT, |
|
463 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
464 | + $table_name = 'esp_state'; |
|
465 | + $sql = "STA_ID smallint(5) unsigned NOT NULL AUTO_INCREMENT, |
|
466 | 466 | CNT_ISO varchar(2) NOT NULL, |
467 | 467 | STA_abbrev varchar(24) NOT NULL, |
468 | 468 | STA_name varchar(100) NOT NULL, |
@@ -470,9 +470,9 @@ discard block |
||
470 | 470 | PRIMARY KEY (STA_ID), |
471 | 471 | KEY STA_abbrev (STA_abbrev), |
472 | 472 | KEY CNT_ISO (CNT_ISO)"; |
473 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
474 | - $table_name = 'esp_status'; |
|
475 | - $sql = "STS_ID varchar(3) NOT NULL, |
|
473 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
474 | + $table_name = 'esp_status'; |
|
475 | + $sql = "STS_ID varchar(3) NOT NULL, |
|
476 | 476 | STS_code varchar(45) NOT NULL, |
477 | 477 | STS_type varchar(45) NOT NULL, |
478 | 478 | STS_can_edit tinyint(1) NOT NULL DEFAULT 0, |
@@ -480,9 +480,9 @@ discard block |
||
480 | 480 | STS_open tinyint(1) NOT NULL DEFAULT 1, |
481 | 481 | UNIQUE KEY STS_ID_UNIQUE (STS_ID), |
482 | 482 | KEY STS_type (STS_type)"; |
483 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
484 | - $table_name = 'esp_transaction'; |
|
485 | - $sql = "TXN_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
483 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
484 | + $table_name = 'esp_transaction'; |
|
485 | + $sql = "TXN_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
486 | 486 | TXN_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00', |
487 | 487 | TXN_total decimal(12,3) DEFAULT '0.00', |
488 | 488 | TXN_paid decimal(12,3) NOT NULL DEFAULT '0.00', |
@@ -494,9 +494,9 @@ discard block |
||
494 | 494 | PRIMARY KEY (TXN_ID), |
495 | 495 | KEY TXN_timestamp (TXN_timestamp), |
496 | 496 | KEY STS_ID (STS_ID)"; |
497 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
498 | - $table_name = 'esp_venue_meta'; |
|
499 | - $sql = "VNUM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
497 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
498 | + $table_name = 'esp_venue_meta'; |
|
499 | + $sql = "VNUM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
500 | 500 | VNU_ID bigint(20) unsigned NOT NULL DEFAULT 0, |
501 | 501 | VNU_address varchar(255) DEFAULT NULL, |
502 | 502 | VNU_address2 varchar(255) DEFAULT NULL, |
@@ -515,10 +515,10 @@ discard block |
||
515 | 515 | KEY VNU_ID (VNU_ID), |
516 | 516 | KEY STA_ID (STA_ID), |
517 | 517 | KEY CNT_ISO (CNT_ISO)"; |
518 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
519 | - //modified tables |
|
520 | - $table_name = "esp_price"; |
|
521 | - $sql = "PRC_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
518 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
519 | + //modified tables |
|
520 | + $table_name = "esp_price"; |
|
521 | + $sql = "PRC_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
522 | 522 | PRT_ID tinyint(3) unsigned NOT NULL, |
523 | 523 | PRC_amount decimal(12,3) NOT NULL DEFAULT '0.00', |
524 | 524 | PRC_name varchar(245) NOT NULL, |
@@ -531,9 +531,9 @@ discard block |
||
531 | 531 | PRC_parent int(10) unsigned DEFAULT 0, |
532 | 532 | PRIMARY KEY (PRC_ID), |
533 | 533 | KEY PRT_ID (PRT_ID)"; |
534 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
535 | - $table_name = "esp_price_type"; |
|
536 | - $sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT, |
|
534 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
535 | + $table_name = "esp_price_type"; |
|
536 | + $sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT, |
|
537 | 537 | PRT_name varchar(45) NOT NULL, |
538 | 538 | PBT_ID tinyint(3) unsigned NOT NULL DEFAULT '1', |
539 | 539 | PRT_is_percent tinyint(1) NOT NULL DEFAULT '0', |
@@ -542,9 +542,9 @@ discard block |
||
542 | 542 | PRT_deleted tinyint(1) NOT NULL DEFAULT '0', |
543 | 543 | UNIQUE KEY PRT_name_UNIQUE (PRT_name), |
544 | 544 | PRIMARY KEY (PRT_ID)"; |
545 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
546 | - $table_name = "esp_ticket"; |
|
547 | - $sql = "TKT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
545 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
546 | + $table_name = "esp_ticket"; |
|
547 | + $sql = "TKT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
548 | 548 | TTM_ID int(10) unsigned NOT NULL, |
549 | 549 | TKT_name varchar(245) NOT NULL DEFAULT '', |
550 | 550 | TKT_description text NOT NULL, |
@@ -567,9 +567,9 @@ discard block |
||
567 | 567 | TKT_deleted tinyint(1) NOT NULL DEFAULT '0', |
568 | 568 | PRIMARY KEY (TKT_ID), |
569 | 569 | KEY TKT_start_date (TKT_start_date)"; |
570 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
571 | - $table_name = 'esp_question_group'; |
|
572 | - $sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
570 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
571 | + $table_name = 'esp_question_group'; |
|
572 | + $sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
573 | 573 | QSG_name varchar(255) NOT NULL, |
574 | 574 | QSG_identifier varchar(100) NOT NULL, |
575 | 575 | QSG_desc text NULL, |
@@ -582,138 +582,138 @@ discard block |
||
582 | 582 | PRIMARY KEY (QSG_ID), |
583 | 583 | UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier), |
584 | 584 | KEY QSG_order (QSG_order)'; |
585 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
586 | - /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */ |
|
587 | - $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
|
588 | - //(because many need to convert old string states to foreign keys into the states table) |
|
589 | - $script_4_1_defaults->insert_default_states(); |
|
590 | - $script_4_1_defaults->insert_default_countries(); |
|
591 | - /** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */ |
|
592 | - $script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0'); |
|
593 | - $script_4_5_defaults->insert_default_price_types(); |
|
594 | - $script_4_5_defaults->insert_default_prices(); |
|
595 | - $script_4_5_defaults->insert_default_tickets(); |
|
596 | - /** @var EE_DMS_Core_4_6_0 $script_4_6_defaults */ |
|
597 | - $script_4_6_defaults = EE_Registry::instance()->load_dms('Core_4_6_0'); |
|
598 | - $script_4_6_defaults->add_default_admin_only_payments(); |
|
599 | - $script_4_6_defaults->insert_default_currencies(); |
|
600 | - /** @var EE_DMS_Core_4_8_0 $script_4_8_defaults */ |
|
601 | - $script_4_8_defaults = EE_Registry::instance()->load_dms('Core_4_8_0'); |
|
602 | - $script_4_8_defaults->verify_new_countries(); |
|
603 | - $script_4_8_defaults->verify_new_currencies(); |
|
604 | - $this->verify_db_collations(); |
|
605 | - $this->verify_db_collations_again(); |
|
606 | - return true; |
|
607 | - } |
|
585 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
586 | + /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */ |
|
587 | + $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
|
588 | + //(because many need to convert old string states to foreign keys into the states table) |
|
589 | + $script_4_1_defaults->insert_default_states(); |
|
590 | + $script_4_1_defaults->insert_default_countries(); |
|
591 | + /** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */ |
|
592 | + $script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0'); |
|
593 | + $script_4_5_defaults->insert_default_price_types(); |
|
594 | + $script_4_5_defaults->insert_default_prices(); |
|
595 | + $script_4_5_defaults->insert_default_tickets(); |
|
596 | + /** @var EE_DMS_Core_4_6_0 $script_4_6_defaults */ |
|
597 | + $script_4_6_defaults = EE_Registry::instance()->load_dms('Core_4_6_0'); |
|
598 | + $script_4_6_defaults->add_default_admin_only_payments(); |
|
599 | + $script_4_6_defaults->insert_default_currencies(); |
|
600 | + /** @var EE_DMS_Core_4_8_0 $script_4_8_defaults */ |
|
601 | + $script_4_8_defaults = EE_Registry::instance()->load_dms('Core_4_8_0'); |
|
602 | + $script_4_8_defaults->verify_new_countries(); |
|
603 | + $script_4_8_defaults->verify_new_currencies(); |
|
604 | + $this->verify_db_collations(); |
|
605 | + $this->verify_db_collations_again(); |
|
606 | + return true; |
|
607 | + } |
|
608 | 608 | |
609 | 609 | |
610 | 610 | |
611 | - /** |
|
612 | - * @return boolean |
|
613 | - */ |
|
614 | - public function schema_changes_after_migration() |
|
615 | - { |
|
616 | - return true; |
|
617 | - } |
|
611 | + /** |
|
612 | + * @return boolean |
|
613 | + */ |
|
614 | + public function schema_changes_after_migration() |
|
615 | + { |
|
616 | + return true; |
|
617 | + } |
|
618 | 618 | |
619 | 619 | |
620 | 620 | |
621 | - public function migration_page_hooks() |
|
622 | - { |
|
623 | - } |
|
621 | + public function migration_page_hooks() |
|
622 | + { |
|
623 | + } |
|
624 | 624 | |
625 | 625 | |
626 | 626 | |
627 | - /** |
|
628 | - * Verify all EE4 models' tables use utf8mb4 collation |
|
629 | - * |
|
630 | - * @return void |
|
631 | - */ |
|
632 | - public function verify_db_collations() |
|
633 | - { |
|
634 | - if (get_option('ee_verified_db_collations', false)) { |
|
635 | - return; |
|
636 | - } |
|
637 | - // grab tables from each model |
|
638 | - $tables_to_check = array(); |
|
639 | - foreach (EE_Registry::instance()->non_abstract_db_models as $model_name) { |
|
640 | - if (method_exists($model_name, 'instance')) { |
|
641 | - $model_obj = call_user_func(array($model_name, 'instance')); |
|
642 | - if ($model_obj instanceof EEM_Base) { |
|
643 | - foreach ($model_obj->get_tables() as $table) { |
|
644 | - if ( |
|
645 | - strpos($table->get_table_name(), 'esp_') |
|
646 | - && (is_main_site()//for main tables, verify global tables |
|
647 | - || ! $table->is_global()//if not the main site, then only verify non-global tables (avoid doubling up) |
|
648 | - ) |
|
649 | - && function_exists('maybe_convert_table_to_utf8mb4') |
|
650 | - ) { |
|
651 | - $tables_to_check[] = $table->get_table_name(); |
|
652 | - } |
|
653 | - } |
|
654 | - } |
|
655 | - } |
|
656 | - } |
|
657 | - //and let's just be sure these addons' tables get migrated too. They already get handled if their addons are active |
|
658 | - //when this code is run, but not otherwise. Once we record what tables EE added, we'll be able to use that instead |
|
659 | - //of hard-coding this |
|
660 | - $addon_tables = array( |
|
661 | - //mailchimp |
|
662 | - 'esp_event_mailchimp_list_group', |
|
663 | - 'esp_event_question_mailchimp_field', |
|
664 | - //multisite |
|
665 | - 'esp_blog_meta', |
|
666 | - //people |
|
667 | - 'esp_people_to_post', |
|
668 | - //promotions |
|
669 | - 'esp_promotion', |
|
670 | - 'esp_promotion_object', |
|
671 | - ); |
|
672 | - foreach ($addon_tables as $table_name) { |
|
673 | - $tables_to_check[] = $table_name; |
|
674 | - } |
|
675 | - $this->_verify_db_collations_for_tables(array_unique($tables_to_check)); |
|
676 | - //ok and now let's remember this was done (without needing to check the db schemas all over again) |
|
677 | - add_option('ee_verified_db_collations', true, null, 'no'); |
|
678 | - //seeing how this ran with the fix from 10435, no need to check again |
|
679 | - add_option('ee_verified_db_collations_again',true,null,'no'); |
|
680 | - } |
|
627 | + /** |
|
628 | + * Verify all EE4 models' tables use utf8mb4 collation |
|
629 | + * |
|
630 | + * @return void |
|
631 | + */ |
|
632 | + public function verify_db_collations() |
|
633 | + { |
|
634 | + if (get_option('ee_verified_db_collations', false)) { |
|
635 | + return; |
|
636 | + } |
|
637 | + // grab tables from each model |
|
638 | + $tables_to_check = array(); |
|
639 | + foreach (EE_Registry::instance()->non_abstract_db_models as $model_name) { |
|
640 | + if (method_exists($model_name, 'instance')) { |
|
641 | + $model_obj = call_user_func(array($model_name, 'instance')); |
|
642 | + if ($model_obj instanceof EEM_Base) { |
|
643 | + foreach ($model_obj->get_tables() as $table) { |
|
644 | + if ( |
|
645 | + strpos($table->get_table_name(), 'esp_') |
|
646 | + && (is_main_site()//for main tables, verify global tables |
|
647 | + || ! $table->is_global()//if not the main site, then only verify non-global tables (avoid doubling up) |
|
648 | + ) |
|
649 | + && function_exists('maybe_convert_table_to_utf8mb4') |
|
650 | + ) { |
|
651 | + $tables_to_check[] = $table->get_table_name(); |
|
652 | + } |
|
653 | + } |
|
654 | + } |
|
655 | + } |
|
656 | + } |
|
657 | + //and let's just be sure these addons' tables get migrated too. They already get handled if their addons are active |
|
658 | + //when this code is run, but not otherwise. Once we record what tables EE added, we'll be able to use that instead |
|
659 | + //of hard-coding this |
|
660 | + $addon_tables = array( |
|
661 | + //mailchimp |
|
662 | + 'esp_event_mailchimp_list_group', |
|
663 | + 'esp_event_question_mailchimp_field', |
|
664 | + //multisite |
|
665 | + 'esp_blog_meta', |
|
666 | + //people |
|
667 | + 'esp_people_to_post', |
|
668 | + //promotions |
|
669 | + 'esp_promotion', |
|
670 | + 'esp_promotion_object', |
|
671 | + ); |
|
672 | + foreach ($addon_tables as $table_name) { |
|
673 | + $tables_to_check[] = $table_name; |
|
674 | + } |
|
675 | + $this->_verify_db_collations_for_tables(array_unique($tables_to_check)); |
|
676 | + //ok and now let's remember this was done (without needing to check the db schemas all over again) |
|
677 | + add_option('ee_verified_db_collations', true, null, 'no'); |
|
678 | + //seeing how this ran with the fix from 10435, no need to check again |
|
679 | + add_option('ee_verified_db_collations_again',true,null,'no'); |
|
680 | + } |
|
681 | 681 | |
682 | 682 | |
683 | 683 | |
684 | - /** |
|
685 | - * Verifies DB collations because a bug was discovered on https://events.codebasehq.com/projects/event-espresso/tickets/10435 |
|
686 | - * which meant some DB collations might not have been updated |
|
687 | - * @return void |
|
688 | - */ |
|
689 | - public function verify_db_collations_again(){ |
|
690 | - if (get_option('ee_verified_db_collations_again', false)) { |
|
691 | - return; |
|
692 | - } |
|
693 | - $tables_to_check = array( |
|
694 | - 'esp_attendee_meta', |
|
695 | - 'esp_message' |
|
696 | - ); |
|
697 | - $this->_verify_db_collations_for_tables(array_unique($tables_to_check)); |
|
698 | - add_option('ee_verified_db_collations_again',true,null,'no'); |
|
699 | - } |
|
684 | + /** |
|
685 | + * Verifies DB collations because a bug was discovered on https://events.codebasehq.com/projects/event-espresso/tickets/10435 |
|
686 | + * which meant some DB collations might not have been updated |
|
687 | + * @return void |
|
688 | + */ |
|
689 | + public function verify_db_collations_again(){ |
|
690 | + if (get_option('ee_verified_db_collations_again', false)) { |
|
691 | + return; |
|
692 | + } |
|
693 | + $tables_to_check = array( |
|
694 | + 'esp_attendee_meta', |
|
695 | + 'esp_message' |
|
696 | + ); |
|
697 | + $this->_verify_db_collations_for_tables(array_unique($tables_to_check)); |
|
698 | + add_option('ee_verified_db_collations_again',true,null,'no'); |
|
699 | + } |
|
700 | 700 | |
701 | 701 | |
702 | 702 | |
703 | - /** |
|
704 | - * Runs maybe_convert_table_to_utf8mb4 on the specified tables |
|
705 | - * @param $tables_to_check |
|
706 | - * @return boolean true if logic ran, false if it didn't |
|
707 | - */ |
|
708 | - protected function _verify_db_collations_for_tables($tables_to_check) |
|
709 | - { |
|
710 | - foreach ($tables_to_check as $table_name) { |
|
711 | - $table_name = $this->_table_analysis->ensureTableNameHasPrefix($table_name); |
|
712 | - if ( ! apply_filters('FHEE__EE_DMS_Core_4_9_0__verify_db_collations__check_overridden', false, $table_name ) |
|
713 | - && $this->_get_table_analysis()->tableExists($table_name) |
|
714 | - ) { |
|
715 | - maybe_convert_table_to_utf8mb4($table_name); |
|
716 | - } |
|
717 | - } |
|
718 | - } |
|
703 | + /** |
|
704 | + * Runs maybe_convert_table_to_utf8mb4 on the specified tables |
|
705 | + * @param $tables_to_check |
|
706 | + * @return boolean true if logic ran, false if it didn't |
|
707 | + */ |
|
708 | + protected function _verify_db_collations_for_tables($tables_to_check) |
|
709 | + { |
|
710 | + foreach ($tables_to_check as $table_name) { |
|
711 | + $table_name = $this->_table_analysis->ensureTableNameHasPrefix($table_name); |
|
712 | + if ( ! apply_filters('FHEE__EE_DMS_Core_4_9_0__verify_db_collations__check_overridden', false, $table_name ) |
|
713 | + && $this->_get_table_analysis()->tableExists($table_name) |
|
714 | + ) { |
|
715 | + maybe_convert_table_to_utf8mb4($table_name); |
|
716 | + } |
|
717 | + } |
|
718 | + } |
|
719 | 719 | } |
720 | 720 | \ No newline at end of file |