@@ -15,12 +15,12 @@ discard block |
||
15 | 15 | // unfortunately, this needs to be done upon INCLUSION of this file, |
16 | 16 | // instead of construction, because it only gets constructed on first page load |
17 | 17 | // (all other times it gets resurrected from a wordpress option) |
18 | -$stages = glob(EE_CORE . 'data_migration_scripts/4_7_0_stages/*'); |
|
18 | +$stages = glob(EE_CORE.'data_migration_scripts/4_7_0_stages/*'); |
|
19 | 19 | $class_to_filepath = array(); |
20 | 20 | foreach ($stages as $filepath) { |
21 | 21 | $matches = array(); |
22 | 22 | preg_match('~4_7_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
23 | - $class_to_filepath[ $matches[1] ] = $filepath; |
|
23 | + $class_to_filepath[$matches[1]] = $filepath; |
|
24 | 24 | } |
25 | 25 | // give addons a chance to autoload their stages too |
26 | 26 | $class_to_filepath = apply_filters('FHEE__EE_DMS_4_7_0__autoloaded_stages', $class_to_filepath); |
@@ -76,9 +76,9 @@ discard block |
||
76 | 76 | ) |
77 | 77 | ) { |
78 | 78 | return true; |
79 | - } elseif (! $version_string) { |
|
79 | + } elseif ( ! $version_string) { |
|
80 | 80 | // no version string provided... this must be pre 4.3 |
81 | - return false;// changed mind. dont want people thinking they should migrate yet because they cant |
|
81 | + return false; // changed mind. dont want people thinking they should migrate yet because they cant |
|
82 | 82 | } else { |
83 | 83 | return false; |
84 | 84 | } |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | public function schema_changes_before_migration() |
93 | 93 | { |
94 | 94 | // relies on 4.1's EEH_Activation::create_table |
95 | - require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
95 | + require_once(EE_HELPERS.'EEH_Activation.helper.php'); |
|
96 | 96 | $table_name = 'esp_answer'; |
97 | 97 | $sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
98 | 98 | REG_ID int(10) unsigned NOT NULL, |
@@ -9,7 +9,6 @@ discard block |
||
9 | 9 | * and recalculates esp_registration.REG_final_price to actually be the final price |
10 | 10 | * for that registration (before this it was just the ticket's price, NOT including |
11 | 11 | * taxes or other price modifiers) |
12 | - |
|
13 | 12 | */ |
14 | 13 | // make sure we have all the stages loaded too |
15 | 14 | // unfortunately, this needs to be done upon INCLUSION of this file, |
@@ -18,9 +17,9 @@ discard block |
||
18 | 17 | $stages = glob(EE_CORE . 'data_migration_scripts/4_7_0_stages/*'); |
19 | 18 | $class_to_filepath = array(); |
20 | 19 | foreach ($stages as $filepath) { |
21 | - $matches = array(); |
|
22 | - preg_match('~4_7_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
23 | - $class_to_filepath[ $matches[1] ] = $filepath; |
|
20 | + $matches = array(); |
|
21 | + preg_match('~4_7_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
22 | + $class_to_filepath[ $matches[1] ] = $filepath; |
|
24 | 23 | } |
25 | 24 | // give addons a chance to autoload their stages too |
26 | 25 | $class_to_filepath = apply_filters('FHEE__EE_DMS_4_7_0__autoloaded_stages', $class_to_filepath); |
@@ -39,71 +38,71 @@ discard block |
||
39 | 38 | class EE_DMS_Core_4_7_0 extends EE_Data_Migration_Script_Base |
40 | 39 | { |
41 | 40 | |
42 | - /** |
|
43 | - * return EE_DMS_Core_4_7_0 |
|
44 | - * |
|
45 | - * @param TableManager $table_manager |
|
46 | - * @param TableAnalysis $table_analysis |
|
47 | - */ |
|
48 | - public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) |
|
49 | - { |
|
50 | - $this->_pretty_name = __("Data Update to Event Espresso 4.7.0", "event_espresso"); |
|
51 | - $this->_priority = 10; |
|
52 | - $this->_migration_stages = array( |
|
53 | - new EE_DMS_4_7_0_Add_Taxes_To_REG_Final_Price(), |
|
54 | - new EE_DMS_4_7_0_Registration_Payments(), |
|
55 | - ); |
|
56 | - parent::__construct($table_manager, $table_analysis); |
|
57 | - } |
|
41 | + /** |
|
42 | + * return EE_DMS_Core_4_7_0 |
|
43 | + * |
|
44 | + * @param TableManager $table_manager |
|
45 | + * @param TableAnalysis $table_analysis |
|
46 | + */ |
|
47 | + public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) |
|
48 | + { |
|
49 | + $this->_pretty_name = __("Data Update to Event Espresso 4.7.0", "event_espresso"); |
|
50 | + $this->_priority = 10; |
|
51 | + $this->_migration_stages = array( |
|
52 | + new EE_DMS_4_7_0_Add_Taxes_To_REG_Final_Price(), |
|
53 | + new EE_DMS_4_7_0_Registration_Payments(), |
|
54 | + ); |
|
55 | + parent::__construct($table_manager, $table_analysis); |
|
56 | + } |
|
58 | 57 | |
59 | 58 | |
60 | 59 | |
61 | - /** |
|
62 | - * @param array $version_array |
|
63 | - * @return bool |
|
64 | - */ |
|
65 | - public function can_migrate_from_version($version_array) |
|
66 | - { |
|
67 | - $version_string = $version_array['Core']; |
|
68 | - if (( |
|
69 | - version_compare($version_string, '4.7.0', '<=') |
|
70 | - && version_compare($version_string, '4.6.0', '>=') |
|
71 | - ) |
|
72 | - || ( |
|
73 | - version_compare($version_string, '4.7.0', '>=') |
|
74 | - && ! $this->_get_table_analysis()->tableExists('esp_registration_payment') |
|
75 | - && $this->_get_table_analysis()->tableExists('esp_registration') |
|
76 | - ) |
|
77 | - ) { |
|
78 | - return true; |
|
79 | - } elseif (! $version_string) { |
|
80 | - // no version string provided... this must be pre 4.3 |
|
81 | - return false;// changed mind. dont want people thinking they should migrate yet because they cant |
|
82 | - } else { |
|
83 | - return false; |
|
84 | - } |
|
85 | - } |
|
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 (( |
|
68 | + version_compare($version_string, '4.7.0', '<=') |
|
69 | + && version_compare($version_string, '4.6.0', '>=') |
|
70 | + ) |
|
71 | + || ( |
|
72 | + version_compare($version_string, '4.7.0', '>=') |
|
73 | + && ! $this->_get_table_analysis()->tableExists('esp_registration_payment') |
|
74 | + && $this->_get_table_analysis()->tableExists('esp_registration') |
|
75 | + ) |
|
76 | + ) { |
|
77 | + return true; |
|
78 | + } elseif (! $version_string) { |
|
79 | + // no version string provided... this must be pre 4.3 |
|
80 | + return false;// changed mind. dont want people thinking they should migrate yet because they cant |
|
81 | + } else { |
|
82 | + return false; |
|
83 | + } |
|
84 | + } |
|
86 | 85 | |
87 | 86 | |
88 | 87 | |
89 | - /** |
|
90 | - * @return bool |
|
91 | - */ |
|
92 | - public function schema_changes_before_migration() |
|
93 | - { |
|
94 | - // relies on 4.1's EEH_Activation::create_table |
|
95 | - require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
96 | - $table_name = 'esp_answer'; |
|
97 | - $sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
88 | + /** |
|
89 | + * @return bool |
|
90 | + */ |
|
91 | + public function schema_changes_before_migration() |
|
92 | + { |
|
93 | + // relies on 4.1's EEH_Activation::create_table |
|
94 | + require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
95 | + $table_name = 'esp_answer'; |
|
96 | + $sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
98 | 97 | REG_ID int(10) unsigned NOT NULL, |
99 | 98 | QST_ID int(10) unsigned NOT NULL, |
100 | 99 | ANS_value text NOT NULL, |
101 | 100 | PRIMARY KEY (ANS_ID), |
102 | 101 | KEY REG_ID (REG_ID), |
103 | 102 | KEY QST_ID (QST_ID)"; |
104 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
105 | - $table_name = 'esp_attendee_meta'; |
|
106 | - $sql = "ATTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
103 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
104 | + $table_name = 'esp_attendee_meta'; |
|
105 | + $sql = "ATTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
107 | 106 | ATT_ID bigint(20) unsigned NOT NULL, |
108 | 107 | ATT_fname varchar(45) NOT NULL, |
109 | 108 | ATT_lname varchar(45) NOT NULL, |
@@ -120,9 +119,9 @@ discard block |
||
120 | 119 | KEY ATT_email (ATT_email(191)), |
121 | 120 | KEY ATT_lname (ATT_lname), |
122 | 121 | KEY ATT_fname (ATT_fname)"; |
123 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
124 | - $table_name = 'esp_country'; |
|
125 | - $sql = "CNT_ISO varchar(2) COLLATE utf8_bin NOT NULL, |
|
122 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
123 | + $table_name = 'esp_country'; |
|
124 | + $sql = "CNT_ISO varchar(2) COLLATE utf8_bin NOT NULL, |
|
126 | 125 | CNT_ISO3 varchar(3) COLLATE utf8_bin NOT NULL, |
127 | 126 | RGN_ID tinyint(3) unsigned DEFAULT NULL, |
128 | 127 | CNT_name varchar(45) COLLATE utf8_bin NOT NULL, |
@@ -138,25 +137,25 @@ discard block |
||
138 | 137 | CNT_is_EU tinyint(1) DEFAULT '0', |
139 | 138 | CNT_active tinyint(1) DEFAULT '0', |
140 | 139 | PRIMARY KEY (CNT_ISO)"; |
141 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
142 | - $table_name = 'esp_currency'; |
|
143 | - $sql = "CUR_code varchar(6) COLLATE utf8_bin NOT NULL, |
|
140 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
141 | + $table_name = 'esp_currency'; |
|
142 | + $sql = "CUR_code varchar(6) COLLATE utf8_bin NOT NULL, |
|
144 | 143 | CUR_single varchar(45) COLLATE utf8_bin DEFAULT 'dollar', |
145 | 144 | CUR_plural varchar(45) COLLATE utf8_bin DEFAULT 'dollars', |
146 | 145 | CUR_sign varchar(45) COLLATE utf8_bin DEFAULT '$', |
147 | 146 | CUR_dec_plc varchar(1) COLLATE utf8_bin NOT NULL DEFAULT '2', |
148 | 147 | CUR_active tinyint(1) DEFAULT '0', |
149 | 148 | PRIMARY KEY (CUR_code)"; |
150 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
151 | - $table_name = 'esp_currency_payment_method'; |
|
152 | - $sql = "CPM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
149 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
150 | + $table_name = 'esp_currency_payment_method'; |
|
151 | + $sql = "CPM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
153 | 152 | CUR_code varchar(6) COLLATE utf8_bin NOT NULL, |
154 | 153 | PMD_ID int(11) NOT NULL, |
155 | 154 | PRIMARY KEY (CPM_ID), |
156 | 155 | KEY PMD_ID (PMD_ID)"; |
157 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
158 | - $table_name = 'esp_datetime'; |
|
159 | - $sql = "DTT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
156 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
157 | + $table_name = 'esp_datetime'; |
|
158 | + $sql = "DTT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
160 | 159 | EVT_ID bigint(20) unsigned NOT NULL, |
161 | 160 | DTT_name varchar(255) NOT NULL DEFAULT '', |
162 | 161 | DTT_description text NOT NULL, |
@@ -172,9 +171,9 @@ discard block |
||
172 | 171 | KEY DTT_EVT_start (DTT_EVT_start), |
173 | 172 | KEY EVT_ID (EVT_ID), |
174 | 173 | KEY DTT_is_primary (DTT_is_primary)"; |
175 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
176 | - $table_name = 'esp_event_meta'; |
|
177 | - $sql = " |
|
174 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
175 | + $table_name = 'esp_event_meta'; |
|
176 | + $sql = " |
|
178 | 177 | EVTM_ID int(10) NOT NULL AUTO_INCREMENT, |
179 | 178 | EVT_ID bigint(20) unsigned NOT NULL, |
180 | 179 | EVT_display_desc tinyint(1) unsigned NOT NULL DEFAULT 1, |
@@ -190,34 +189,34 @@ discard block |
||
190 | 189 | EVT_donations tinyint(1) NULL, |
191 | 190 | PRIMARY KEY (EVTM_ID), |
192 | 191 | KEY EVT_ID (EVT_ID)"; |
193 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
194 | - $table_name = 'esp_event_question_group'; |
|
195 | - $sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
192 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
193 | + $table_name = 'esp_event_question_group'; |
|
194 | + $sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
196 | 195 | EVT_ID bigint(20) unsigned NOT NULL, |
197 | 196 | QSG_ID int(10) unsigned NOT NULL, |
198 | 197 | EQG_primary tinyint(1) unsigned NOT NULL DEFAULT 0, |
199 | 198 | PRIMARY KEY (EQG_ID), |
200 | 199 | KEY EVT_ID (EVT_ID), |
201 | 200 | KEY QSG_ID (QSG_ID)"; |
202 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
203 | - $table_name = 'esp_event_venue'; |
|
204 | - $sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT, |
|
201 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
202 | + $table_name = 'esp_event_venue'; |
|
203 | + $sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT, |
|
205 | 204 | EVT_ID bigint(20) unsigned NOT NULL, |
206 | 205 | VNU_ID bigint(20) unsigned NOT NULL, |
207 | 206 | EVV_primary tinyint(1) unsigned NOT NULL DEFAULT 0, |
208 | 207 | PRIMARY KEY (EVV_ID)"; |
209 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
210 | - $table_name = 'esp_extra_meta'; |
|
211 | - $sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
208 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
209 | + $table_name = 'esp_extra_meta'; |
|
210 | + $sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
212 | 211 | OBJ_ID int(11) DEFAULT NULL, |
213 | 212 | EXM_type varchar(45) DEFAULT NULL, |
214 | 213 | EXM_key varchar(45) DEFAULT NULL, |
215 | 214 | EXM_value text, |
216 | 215 | PRIMARY KEY (EXM_ID), |
217 | 216 | KEY EXM_type (EXM_type, OBJ_ID, EXM_key(45))"; |
218 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
219 | - $table_name = 'esp_line_item'; |
|
220 | - $sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT, |
|
217 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
218 | + $table_name = 'esp_line_item'; |
|
219 | + $sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT, |
|
221 | 220 | LIN_code varchar(245) NOT NULL DEFAULT '', |
222 | 221 | TXN_ID int(11) DEFAULT NULL, |
223 | 222 | LIN_name varchar(245) NOT NULL DEFAULT '', |
@@ -235,9 +234,9 @@ discard block |
||
235 | 234 | PRIMARY KEY (LIN_ID), |
236 | 235 | KEY LIN_code (LIN_code(191)), |
237 | 236 | KEY TXN_ID (TXN_ID)"; |
238 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
239 | - $table_name = 'esp_log'; |
|
240 | - $sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT, |
|
237 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
238 | + $table_name = 'esp_log'; |
|
239 | + $sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT, |
|
241 | 240 | LOG_time datetime DEFAULT NULL, |
242 | 241 | OBJ_ID varchar(45) DEFAULT NULL, |
243 | 242 | OBJ_type varchar(45) DEFAULT NULL, |
@@ -248,18 +247,18 @@ discard block |
||
248 | 247 | KEY LOG_time (LOG_time), |
249 | 248 | KEY OBJ (OBJ_type,OBJ_ID), |
250 | 249 | KEY LOG_type (LOG_type)"; |
251 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
252 | - $table_name = 'esp_message_template'; |
|
253 | - $sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
250 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
251 | + $table_name = 'esp_message_template'; |
|
252 | + $sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
254 | 253 | GRP_ID int(10) unsigned NOT NULL, |
255 | 254 | MTP_context varchar(50) NOT NULL, |
256 | 255 | MTP_template_field varchar(30) NOT NULL, |
257 | 256 | MTP_content text NOT NULL, |
258 | 257 | PRIMARY KEY (MTP_ID), |
259 | 258 | KEY GRP_ID (GRP_ID)"; |
260 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
261 | - $table_name = 'esp_message_template_group'; |
|
262 | - $sql = "GRP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
259 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
260 | + $table_name = 'esp_message_template_group'; |
|
261 | + $sql = "GRP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
263 | 262 | MTP_user_id int(10) NOT NULL DEFAULT '1', |
264 | 263 | MTP_name varchar(245) NOT NULL DEFAULT '', |
265 | 264 | MTP_description varchar(245) NOT NULL DEFAULT '', |
@@ -271,17 +270,17 @@ discard block |
||
271 | 270 | MTP_is_active tinyint(1) NOT NULL DEFAULT '1', |
272 | 271 | PRIMARY KEY (GRP_ID), |
273 | 272 | KEY MTP_user_id (MTP_user_id)"; |
274 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
275 | - $table_name = 'esp_event_message_template'; |
|
276 | - $sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
|
273 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
274 | + $table_name = 'esp_event_message_template'; |
|
275 | + $sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
|
277 | 276 | EVT_ID bigint(20) unsigned NOT NULL DEFAULT 0, |
278 | 277 | GRP_ID int(10) unsigned NOT NULL DEFAULT 0, |
279 | 278 | PRIMARY KEY (EMT_ID), |
280 | 279 | KEY EVT_ID (EVT_ID), |
281 | 280 | KEY GRP_ID (GRP_ID)"; |
282 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
283 | - $table_name = 'esp_payment'; |
|
284 | - $sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
281 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
282 | + $table_name = 'esp_payment'; |
|
283 | + $sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
285 | 284 | TXN_ID int(10) unsigned DEFAULT NULL, |
286 | 285 | STS_ID varchar(3) COLLATE utf8_bin DEFAULT NULL, |
287 | 286 | PAY_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00', |
@@ -298,9 +297,9 @@ discard block |
||
298 | 297 | PRIMARY KEY (PAY_ID), |
299 | 298 | KEY PAY_timestamp (PAY_timestamp), |
300 | 299 | KEY TXN_ID (TXN_ID)"; |
301 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
302 | - $table_name = 'esp_payment_method'; |
|
303 | - $sql = "PMD_ID int(11) NOT NULL AUTO_INCREMENT, |
|
300 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
301 | + $table_name = 'esp_payment_method'; |
|
302 | + $sql = "PMD_ID int(11) NOT NULL AUTO_INCREMENT, |
|
304 | 303 | PMD_type varchar(124) DEFAULT NULL, |
305 | 304 | PMD_name varchar(255) DEFAULT NULL, |
306 | 305 | PMD_desc text, |
@@ -316,32 +315,32 @@ discard block |
||
316 | 315 | PRIMARY KEY (PMD_ID), |
317 | 316 | UNIQUE KEY PMD_slug_UNIQUE (PMD_slug), |
318 | 317 | KEY PMD_type (PMD_type)"; |
319 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
320 | - $table_name = "esp_ticket_price"; |
|
321 | - $sql = "TKP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
318 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
319 | + $table_name = "esp_ticket_price"; |
|
320 | + $sql = "TKP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
322 | 321 | TKT_ID int(10) unsigned NOT NULL, |
323 | 322 | PRC_ID int(10) unsigned NOT NULL, |
324 | 323 | PRIMARY KEY (TKP_ID), |
325 | 324 | KEY TKT_ID (TKT_ID), |
326 | 325 | KEY PRC_ID (PRC_ID)"; |
327 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
328 | - $table_name = "esp_datetime_ticket"; |
|
329 | - $sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
326 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
327 | + $table_name = "esp_datetime_ticket"; |
|
328 | + $sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
330 | 329 | DTT_ID int(10) unsigned NOT NULL, |
331 | 330 | TKT_ID int(10) unsigned NOT NULL, |
332 | 331 | PRIMARY KEY (DTK_ID), |
333 | 332 | KEY DTT_ID (DTT_ID), |
334 | 333 | KEY TKT_ID (TKT_ID)"; |
335 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
336 | - $table_name = "esp_ticket_template"; |
|
337 | - $sql = "TTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
334 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
335 | + $table_name = "esp_ticket_template"; |
|
336 | + $sql = "TTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
338 | 337 | TTM_name varchar(45) NOT NULL, |
339 | 338 | TTM_description text, |
340 | 339 | TTM_file varchar(45), |
341 | 340 | PRIMARY KEY (TTM_ID)"; |
342 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
343 | - $table_name = 'esp_question'; |
|
344 | - $sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
341 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
342 | + $table_name = 'esp_question'; |
|
343 | + $sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
345 | 344 | QST_display_text text NOT NULL, |
346 | 345 | QST_admin_label varchar(255) NOT NULL, |
347 | 346 | QST_system varchar(25) DEFAULT NULL, |
@@ -354,18 +353,18 @@ discard block |
||
354 | 353 | QST_deleted tinyint(2) unsigned NOT NULL DEFAULT 0, |
355 | 354 | PRIMARY KEY (QST_ID), |
356 | 355 | KEY QST_order (QST_order)'; |
357 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
358 | - $table_name = 'esp_question_group_question'; |
|
359 | - $sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
356 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
357 | + $table_name = 'esp_question_group_question'; |
|
358 | + $sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
360 | 359 | QSG_ID int(10) unsigned NOT NULL, |
361 | 360 | QST_ID int(10) unsigned NOT NULL, |
362 | 361 | QGQ_order int(10) unsigned NOT NULL DEFAULT 0, |
363 | 362 | PRIMARY KEY (QGQ_ID), |
364 | 363 | KEY QST_ID (QST_ID), |
365 | 364 | KEY QSG_ID_order (QSG_ID, QGQ_order)"; |
366 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
367 | - $table_name = 'esp_question_option'; |
|
368 | - $sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
365 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
366 | + $table_name = 'esp_question_option'; |
|
367 | + $sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
369 | 368 | QSO_value varchar(255) NOT NULL, |
370 | 369 | QSO_desc text NOT NULL, |
371 | 370 | QST_ID int(10) unsigned NOT NULL, |
@@ -374,9 +373,9 @@ discard block |
||
374 | 373 | PRIMARY KEY (QSO_ID), |
375 | 374 | KEY QST_ID (QST_ID), |
376 | 375 | KEY QSO_order (QSO_order)"; |
377 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
378 | - $table_name = 'esp_registration'; |
|
379 | - $sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
376 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
377 | + $table_name = 'esp_registration'; |
|
378 | + $sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
380 | 379 | EVT_ID bigint(20) unsigned NOT NULL, |
381 | 380 | ATT_ID bigint(20) unsigned NOT NULL, |
382 | 381 | TXN_ID int(10) unsigned NOT NULL, |
@@ -400,18 +399,18 @@ discard block |
||
400 | 399 | KEY TKT_ID (TKT_ID), |
401 | 400 | KEY EVT_ID (EVT_ID), |
402 | 401 | KEY STS_ID (STS_ID)"; |
403 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
404 | - $table_name = 'esp_registration_payment'; |
|
405 | - $sql = "RPY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
402 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
403 | + $table_name = 'esp_registration_payment'; |
|
404 | + $sql = "RPY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
406 | 405 | REG_ID int(10) unsigned NOT NULL, |
407 | 406 | PAY_ID int(10) unsigned NULL, |
408 | 407 | RPY_amount decimal(10,3) NOT NULL DEFAULT '0.00', |
409 | 408 | PRIMARY KEY (RPY_ID), |
410 | 409 | KEY REG_ID (REG_ID), |
411 | 410 | KEY PAY_ID (PAY_ID)"; |
412 | - $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
413 | - $table_name = 'esp_checkin'; |
|
414 | - $sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
411 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
412 | + $table_name = 'esp_checkin'; |
|
413 | + $sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
415 | 414 | REG_ID int(10) unsigned NOT NULL, |
416 | 415 | DTT_ID int(10) unsigned NOT NULL, |
417 | 416 | CHK_in tinyint(1) unsigned NOT NULL DEFAULT 1, |
@@ -419,9 +418,9 @@ discard block |
||
419 | 418 | PRIMARY KEY (CHK_ID), |
420 | 419 | KEY REG_ID (REG_ID), |
421 | 420 | KEY DTT_ID (DTT_ID)"; |
422 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
423 | - $table_name = 'esp_state'; |
|
424 | - $sql = "STA_ID smallint(5) unsigned NOT NULL AUTO_INCREMENT, |
|
421 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
422 | + $table_name = 'esp_state'; |
|
423 | + $sql = "STA_ID smallint(5) unsigned NOT NULL AUTO_INCREMENT, |
|
425 | 424 | CNT_ISO varchar(2) COLLATE utf8_bin NOT NULL, |
426 | 425 | STA_abbrev varchar(24) COLLATE utf8_bin NOT NULL, |
427 | 426 | STA_name varchar(100) COLLATE utf8_bin NOT NULL, |
@@ -429,9 +428,9 @@ discard block |
||
429 | 428 | PRIMARY KEY (STA_ID), |
430 | 429 | KEY STA_abbrev (STA_abbrev), |
431 | 430 | KEY CNT_ISO (CNT_ISO)"; |
432 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
433 | - $table_name = 'esp_status'; |
|
434 | - $sql = "STS_ID varchar(3) COLLATE utf8_bin NOT NULL, |
|
431 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
432 | + $table_name = 'esp_status'; |
|
433 | + $sql = "STS_ID varchar(3) COLLATE utf8_bin NOT NULL, |
|
435 | 434 | STS_code varchar(45) COLLATE utf8_bin NOT NULL, |
436 | 435 | STS_type set('event','registration','transaction','payment','email') COLLATE utf8_bin NOT NULL, |
437 | 436 | STS_can_edit tinyint(1) NOT NULL DEFAULT 0, |
@@ -439,9 +438,9 @@ discard block |
||
439 | 438 | STS_open tinyint(1) NOT NULL DEFAULT 1, |
440 | 439 | UNIQUE KEY STS_ID_UNIQUE (STS_ID), |
441 | 440 | KEY STS_type (STS_type)"; |
442 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
443 | - $table_name = 'esp_transaction'; |
|
444 | - $sql = "TXN_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
441 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
442 | + $table_name = 'esp_transaction'; |
|
443 | + $sql = "TXN_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
445 | 444 | TXN_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00', |
446 | 445 | TXN_total decimal(10,3) DEFAULT '0.00', |
447 | 446 | TXN_paid decimal(10,3) NOT NULL DEFAULT '0.00', |
@@ -453,9 +452,9 @@ discard block |
||
453 | 452 | PRIMARY KEY (TXN_ID), |
454 | 453 | KEY TXN_timestamp (TXN_timestamp), |
455 | 454 | KEY STS_ID (STS_ID)"; |
456 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
457 | - $table_name = 'esp_venue_meta'; |
|
458 | - $sql = "VNUM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
455 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
456 | + $table_name = 'esp_venue_meta'; |
|
457 | + $sql = "VNUM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
459 | 458 | VNU_ID bigint(20) unsigned NOT NULL DEFAULT 0, |
460 | 459 | VNU_address varchar(255) DEFAULT NULL, |
461 | 460 | VNU_address2 varchar(255) DEFAULT NULL, |
@@ -474,10 +473,10 @@ discard block |
||
474 | 473 | KEY VNU_ID (VNU_ID), |
475 | 474 | KEY STA_ID (STA_ID), |
476 | 475 | KEY CNT_ISO (CNT_ISO)"; |
477 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
478 | - // modified tables |
|
479 | - $table_name = "esp_price"; |
|
480 | - $sql = "PRC_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
476 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
477 | + // modified tables |
|
478 | + $table_name = "esp_price"; |
|
479 | + $sql = "PRC_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
481 | 480 | PRT_ID tinyint(3) unsigned NOT NULL, |
482 | 481 | PRC_amount decimal(10,3) NOT NULL DEFAULT '0.00', |
483 | 482 | PRC_name varchar(245) NOT NULL, |
@@ -490,9 +489,9 @@ discard block |
||
490 | 489 | PRC_parent int(10) unsigned DEFAULT 0, |
491 | 490 | PRIMARY KEY (PRC_ID), |
492 | 491 | KEY PRT_ID (PRT_ID)"; |
493 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
494 | - $table_name = "esp_price_type"; |
|
495 | - $sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT, |
|
492 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
493 | + $table_name = "esp_price_type"; |
|
494 | + $sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT, |
|
496 | 495 | PRT_name varchar(45) NOT NULL, |
497 | 496 | PBT_ID tinyint(3) unsigned NOT NULL DEFAULT '1', |
498 | 497 | PRT_is_percent tinyint(1) NOT NULL DEFAULT '0', |
@@ -501,9 +500,9 @@ discard block |
||
501 | 500 | PRT_deleted tinyint(1) NOT NULL DEFAULT '0', |
502 | 501 | UNIQUE KEY PRT_name_UNIQUE (PRT_name), |
503 | 502 | PRIMARY KEY (PRT_ID)"; |
504 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
505 | - $table_name = "esp_ticket"; |
|
506 | - $sql = "TKT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
503 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
504 | + $table_name = "esp_ticket"; |
|
505 | + $sql = "TKT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
507 | 506 | TTM_ID int(10) unsigned NOT NULL, |
508 | 507 | TKT_name varchar(245) NOT NULL DEFAULT '', |
509 | 508 | TKT_description text NOT NULL, |
@@ -525,9 +524,9 @@ discard block |
||
525 | 524 | TKT_deleted tinyint(1) NOT NULL DEFAULT '0', |
526 | 525 | PRIMARY KEY (TKT_ID), |
527 | 526 | KEY TKT_start_date (TKT_start_date)"; |
528 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
529 | - $table_name = 'esp_question_group'; |
|
530 | - $sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
527 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
528 | + $table_name = 'esp_question_group'; |
|
529 | + $sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
531 | 530 | QSG_name varchar(255) NOT NULL, |
532 | 531 | QSG_identifier varchar(100) NOT NULL, |
533 | 532 | QSG_desc text NULL, |
@@ -540,38 +539,38 @@ discard block |
||
540 | 539 | PRIMARY KEY (QSG_ID), |
541 | 540 | UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier), |
542 | 541 | KEY QSG_order (QSG_order)'; |
543 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
544 | - /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */ |
|
545 | - $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
|
546 | - // (because many need to convert old string states to foreign keys into the states table) |
|
547 | - $script_4_1_defaults->insert_default_states(); |
|
548 | - $script_4_1_defaults->insert_default_countries(); |
|
549 | - /** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */ |
|
550 | - $script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0'); |
|
551 | - $script_4_5_defaults->insert_default_price_types(); |
|
552 | - $script_4_5_defaults->insert_default_prices(); |
|
553 | - $script_4_5_defaults->insert_default_tickets(); |
|
554 | - /** @var EE_DMS_Core_4_6_0 $script_4_6_defaults */ |
|
555 | - $script_4_6_defaults = EE_Registry::instance()->load_dms('Core_4_6_0'); |
|
556 | - $script_4_6_defaults->add_default_admin_only_payments(); |
|
557 | - $script_4_6_defaults->insert_default_currencies(); |
|
558 | - return true; |
|
559 | - } |
|
542 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
543 | + /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */ |
|
544 | + $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
|
545 | + // (because many need to convert old string states to foreign keys into the states table) |
|
546 | + $script_4_1_defaults->insert_default_states(); |
|
547 | + $script_4_1_defaults->insert_default_countries(); |
|
548 | + /** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */ |
|
549 | + $script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0'); |
|
550 | + $script_4_5_defaults->insert_default_price_types(); |
|
551 | + $script_4_5_defaults->insert_default_prices(); |
|
552 | + $script_4_5_defaults->insert_default_tickets(); |
|
553 | + /** @var EE_DMS_Core_4_6_0 $script_4_6_defaults */ |
|
554 | + $script_4_6_defaults = EE_Registry::instance()->load_dms('Core_4_6_0'); |
|
555 | + $script_4_6_defaults->add_default_admin_only_payments(); |
|
556 | + $script_4_6_defaults->insert_default_currencies(); |
|
557 | + return true; |
|
558 | + } |
|
560 | 559 | |
561 | 560 | |
562 | 561 | |
563 | - /** |
|
564 | - * @return boolean |
|
565 | - */ |
|
566 | - public function schema_changes_after_migration() |
|
567 | - { |
|
568 | - return true; |
|
569 | - } |
|
562 | + /** |
|
563 | + * @return boolean |
|
564 | + */ |
|
565 | + public function schema_changes_after_migration() |
|
566 | + { |
|
567 | + return true; |
|
568 | + } |
|
570 | 569 | |
571 | 570 | |
572 | 571 | |
573 | - public function migration_page_hooks() |
|
574 | - { |
|
575 | - } |
|
572 | + public function migration_page_hooks() |
|
573 | + { |
|
574 | + } |
|
576 | 575 | } |
577 | 576 | // end of file: /core/data_migration_scripts/EE_DMS_Core_4_7_0.dms.php |
@@ -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,29 +139,29 @@ 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 | - // note: although this table is no longer in use, |
|
153 | - // it hasn't been removed because then queries to the model will have errors. |
|
154 | - // but you should expect this table and its corresponding model to be removed in |
|
155 | - // the next few months |
|
156 | - $table_name = 'esp_currency_payment_method'; |
|
157 | - $sql = "CPM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
151 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
152 | + // note: although this table is no longer in use, |
|
153 | + // it hasn't been removed because then queries to the model will have errors. |
|
154 | + // but you should expect this table and its corresponding model to be removed in |
|
155 | + // the next few months |
|
156 | + $table_name = 'esp_currency_payment_method'; |
|
157 | + $sql = "CPM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
158 | 158 | CUR_code varchar(6) NOT NULL, |
159 | 159 | PMD_ID int(11) NOT NULL, |
160 | 160 | PRIMARY KEY (CPM_ID), |
161 | 161 | KEY PMD_ID (PMD_ID)"; |
162 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
163 | - $table_name = 'esp_datetime'; |
|
164 | - $sql = "DTT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
162 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
163 | + $table_name = 'esp_datetime'; |
|
164 | + $sql = "DTT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
165 | 165 | EVT_ID bigint(20) unsigned NOT NULL, |
166 | 166 | DTT_name varchar(255) NOT NULL DEFAULT '', |
167 | 167 | DTT_description text NOT NULL, |
@@ -178,25 +178,25 @@ discard block |
||
178 | 178 | KEY DTT_EVT_start (DTT_EVT_start), |
179 | 179 | KEY EVT_ID (EVT_ID), |
180 | 180 | KEY DTT_is_primary (DTT_is_primary)"; |
181 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
182 | - $table_name = "esp_datetime_ticket"; |
|
183 | - $sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
181 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
182 | + $table_name = "esp_datetime_ticket"; |
|
183 | + $sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
184 | 184 | DTT_ID int(10) unsigned NOT NULL, |
185 | 185 | TKT_ID int(10) unsigned NOT NULL, |
186 | 186 | PRIMARY KEY (DTK_ID), |
187 | 187 | KEY DTT_ID (DTT_ID), |
188 | 188 | KEY TKT_ID (TKT_ID)"; |
189 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
190 | - $table_name = 'esp_event_message_template'; |
|
191 | - $sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
|
189 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
190 | + $table_name = 'esp_event_message_template'; |
|
191 | + $sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
|
192 | 192 | EVT_ID bigint(20) unsigned NOT NULL DEFAULT 0, |
193 | 193 | GRP_ID int(10) unsigned NOT NULL DEFAULT 0, |
194 | 194 | PRIMARY KEY (EMT_ID), |
195 | 195 | KEY EVT_ID (EVT_ID), |
196 | 196 | KEY GRP_ID (GRP_ID)"; |
197 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
198 | - $table_name = 'esp_event_meta'; |
|
199 | - $sql = "EVTM_ID int(10) NOT NULL AUTO_INCREMENT, |
|
197 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
198 | + $table_name = 'esp_event_meta'; |
|
199 | + $sql = "EVTM_ID int(10) NOT NULL AUTO_INCREMENT, |
|
200 | 200 | EVT_ID bigint(20) unsigned NOT NULL, |
201 | 201 | EVT_display_desc tinyint(1) unsigned NOT NULL DEFAULT 1, |
202 | 202 | EVT_display_ticket_selector tinyint(1) unsigned NOT NULL DEFAULT 1, |
@@ -211,34 +211,34 @@ discard block |
||
211 | 211 | EVT_donations tinyint(1) NULL, |
212 | 212 | PRIMARY KEY (EVTM_ID), |
213 | 213 | KEY EVT_ID (EVT_ID)"; |
214 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
215 | - $table_name = 'esp_event_question_group'; |
|
216 | - $sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
214 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
215 | + $table_name = 'esp_event_question_group'; |
|
216 | + $sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
217 | 217 | EVT_ID bigint(20) unsigned NOT NULL, |
218 | 218 | QSG_ID int(10) unsigned NOT NULL, |
219 | 219 | EQG_primary tinyint(1) unsigned NOT NULL DEFAULT 0, |
220 | 220 | PRIMARY KEY (EQG_ID), |
221 | 221 | KEY EVT_ID (EVT_ID), |
222 | 222 | KEY QSG_ID (QSG_ID)"; |
223 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
224 | - $table_name = 'esp_event_venue'; |
|
225 | - $sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT, |
|
223 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
224 | + $table_name = 'esp_event_venue'; |
|
225 | + $sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT, |
|
226 | 226 | EVT_ID bigint(20) unsigned NOT NULL, |
227 | 227 | VNU_ID bigint(20) unsigned NOT NULL, |
228 | 228 | EVV_primary tinyint(1) unsigned NOT NULL DEFAULT 0, |
229 | 229 | PRIMARY KEY (EVV_ID)"; |
230 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
231 | - $table_name = 'esp_extra_meta'; |
|
232 | - $sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
230 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
231 | + $table_name = 'esp_extra_meta'; |
|
232 | + $sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
233 | 233 | OBJ_ID int(11) DEFAULT NULL, |
234 | 234 | EXM_type varchar(45) DEFAULT NULL, |
235 | 235 | EXM_key varchar(45) DEFAULT NULL, |
236 | 236 | EXM_value text, |
237 | 237 | PRIMARY KEY (EXM_ID), |
238 | 238 | KEY EXM_type (EXM_type,OBJ_ID,EXM_key)"; |
239 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
240 | - $table_name = 'esp_extra_join'; |
|
241 | - $sql = "EXJ_ID int(11) NOT NULL AUTO_INCREMENT, |
|
239 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
240 | + $table_name = 'esp_extra_join'; |
|
241 | + $sql = "EXJ_ID int(11) NOT NULL AUTO_INCREMENT, |
|
242 | 242 | EXJ_first_model_id varchar(6) NOT NULL, |
243 | 243 | EXJ_first_model_name varchar(20) NOT NULL, |
244 | 244 | EXJ_second_model_id varchar(6) NOT NULL, |
@@ -246,9 +246,9 @@ discard block |
||
246 | 246 | PRIMARY KEY (EXJ_ID), |
247 | 247 | KEY first_model (EXJ_first_model_name,EXJ_first_model_id), |
248 | 248 | KEY second_model (EXJ_second_model_name,EXJ_second_model_id)"; |
249 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
250 | - $table_name = 'esp_line_item'; |
|
251 | - $sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT, |
|
249 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
250 | + $table_name = 'esp_line_item'; |
|
251 | + $sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT, |
|
252 | 252 | LIN_code varchar(245) NOT NULL DEFAULT '', |
253 | 253 | TXN_ID int(11) DEFAULT NULL, |
254 | 254 | LIN_name varchar(245) NOT NULL DEFAULT '', |
@@ -269,11 +269,11 @@ discard block |
||
269 | 269 | KEY txn_type_timestamp (TXN_ID,LIN_type,LIN_timestamp), |
270 | 270 | KEY txn_obj_id_obj_type (TXN_ID,OBJ_ID,OBJ_type), |
271 | 271 | KEY obj_id_obj_type (OBJ_ID,OBJ_type)"; |
272 | - $this->_get_table_manager()->dropIndex('esp_line_item', 'TXN_ID'); |
|
273 | - $this->_get_table_manager()->dropIndex('esp_line_item', 'LIN_code'); |
|
274 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
275 | - $table_name = 'esp_log'; |
|
276 | - $sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT, |
|
272 | + $this->_get_table_manager()->dropIndex('esp_line_item', 'TXN_ID'); |
|
273 | + $this->_get_table_manager()->dropIndex('esp_line_item', 'LIN_code'); |
|
274 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
275 | + $table_name = 'esp_log'; |
|
276 | + $sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT, |
|
277 | 277 | LOG_time datetime DEFAULT NULL, |
278 | 278 | OBJ_ID varchar(45) DEFAULT NULL, |
279 | 279 | OBJ_type varchar(45) DEFAULT NULL, |
@@ -284,12 +284,12 @@ discard block |
||
284 | 284 | KEY LOG_time (LOG_time), |
285 | 285 | KEY OBJ (OBJ_type,OBJ_ID), |
286 | 286 | KEY LOG_type (LOG_type)"; |
287 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
288 | - $table_name = 'esp_message'; |
|
289 | - $this->_get_table_manager()->dropIndexIfSizeNot($table_name, 'MSG_to'); |
|
290 | - $this->_get_table_manager()->dropIndexIfSizeNot($table_name, 'MSG_from'); |
|
291 | - $this->_get_table_manager()->dropIndexIfSizeNot($table_name, 'MSG_subject'); |
|
292 | - $sql = "MSG_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
|
287 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
288 | + $table_name = 'esp_message'; |
|
289 | + $this->_get_table_manager()->dropIndexIfSizeNot($table_name, 'MSG_to'); |
|
290 | + $this->_get_table_manager()->dropIndexIfSizeNot($table_name, 'MSG_from'); |
|
291 | + $this->_get_table_manager()->dropIndexIfSizeNot($table_name, 'MSG_subject'); |
|
292 | + $sql = "MSG_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
|
293 | 293 | GRP_ID int(10) unsigned NULL, |
294 | 294 | MSG_token varchar(255) NULL, |
295 | 295 | TXN_ID int(10) unsigned NULL, |
@@ -321,18 +321,18 @@ discard block |
||
321 | 321 | KEY STS_ID (STS_ID), |
322 | 322 | KEY MSG_created (MSG_created), |
323 | 323 | KEY MSG_modified (MSG_modified)"; |
324 | - $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
325 | - $table_name = 'esp_message_template'; |
|
326 | - $sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
324 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
325 | + $table_name = 'esp_message_template'; |
|
326 | + $sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
327 | 327 | GRP_ID int(10) unsigned NOT NULL, |
328 | 328 | MTP_context varchar(50) NOT NULL, |
329 | 329 | MTP_template_field varchar(30) NOT NULL, |
330 | 330 | MTP_content text NOT NULL, |
331 | 331 | PRIMARY KEY (MTP_ID), |
332 | 332 | KEY GRP_ID (GRP_ID)"; |
333 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
334 | - $table_name = 'esp_message_template_group'; |
|
335 | - $sql = "GRP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
333 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
334 | + $table_name = 'esp_message_template_group'; |
|
335 | + $sql = "GRP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
336 | 336 | MTP_user_id int(10) NOT NULL DEFAULT '1', |
337 | 337 | MTP_name varchar(245) NOT NULL DEFAULT '', |
338 | 338 | MTP_description varchar(245) NOT NULL DEFAULT '', |
@@ -344,9 +344,9 @@ discard block |
||
344 | 344 | MTP_is_active tinyint(1) NOT NULL DEFAULT '1', |
345 | 345 | PRIMARY KEY (GRP_ID), |
346 | 346 | KEY MTP_user_id (MTP_user_id)"; |
347 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
348 | - $table_name = 'esp_payment'; |
|
349 | - $sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
347 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
348 | + $table_name = 'esp_payment'; |
|
349 | + $sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
350 | 350 | TXN_ID int(10) unsigned DEFAULT NULL, |
351 | 351 | STS_ID varchar(3) DEFAULT NULL, |
352 | 352 | PAY_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00', |
@@ -363,9 +363,9 @@ discard block |
||
363 | 363 | PRIMARY KEY (PAY_ID), |
364 | 364 | KEY PAY_timestamp (PAY_timestamp), |
365 | 365 | KEY TXN_ID (TXN_ID)"; |
366 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
367 | - $table_name = 'esp_payment_method'; |
|
368 | - $sql = "PMD_ID int(11) NOT NULL AUTO_INCREMENT, |
|
366 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
367 | + $table_name = 'esp_payment_method'; |
|
368 | + $sql = "PMD_ID int(11) NOT NULL AUTO_INCREMENT, |
|
369 | 369 | PMD_type varchar(124) DEFAULT NULL, |
370 | 370 | PMD_name varchar(255) DEFAULT NULL, |
371 | 371 | PMD_desc text, |
@@ -381,24 +381,24 @@ discard block |
||
381 | 381 | PRIMARY KEY (PMD_ID), |
382 | 382 | UNIQUE KEY PMD_slug_UNIQUE (PMD_slug), |
383 | 383 | KEY PMD_type (PMD_type)"; |
384 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
385 | - $table_name = "esp_ticket_price"; |
|
386 | - $sql = "TKP_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_price"; |
|
386 | + $sql = "TKP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
387 | 387 | TKT_ID int(10) unsigned NOT NULL, |
388 | 388 | PRC_ID int(10) unsigned NOT NULL, |
389 | 389 | PRIMARY KEY (TKP_ID), |
390 | 390 | KEY TKT_ID (TKT_ID), |
391 | 391 | KEY PRC_ID (PRC_ID)"; |
392 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
393 | - $table_name = "esp_ticket_template"; |
|
394 | - $sql = "TTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
392 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
393 | + $table_name = "esp_ticket_template"; |
|
394 | + $sql = "TTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
395 | 395 | TTM_name varchar(45) NOT NULL, |
396 | 396 | TTM_description text, |
397 | 397 | TTM_file varchar(45), |
398 | 398 | PRIMARY KEY (TTM_ID)"; |
399 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
400 | - $table_name = 'esp_question'; |
|
401 | - $sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
399 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
400 | + $table_name = 'esp_question'; |
|
401 | + $sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
402 | 402 | QST_display_text text NOT NULL, |
403 | 403 | QST_admin_label varchar(255) NOT NULL, |
404 | 404 | QST_system varchar(25) DEFAULT NULL, |
@@ -412,18 +412,18 @@ discard block |
||
412 | 412 | QST_deleted tinyint(2) unsigned NOT NULL DEFAULT 0, |
413 | 413 | PRIMARY KEY (QST_ID), |
414 | 414 | KEY QST_order (QST_order)'; |
415 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
416 | - $table_name = 'esp_question_group_question'; |
|
417 | - $sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
415 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
416 | + $table_name = 'esp_question_group_question'; |
|
417 | + $sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
418 | 418 | QSG_ID int(10) unsigned NOT NULL, |
419 | 419 | QST_ID int(10) unsigned NOT NULL, |
420 | 420 | QGQ_order int(10) unsigned NOT NULL DEFAULT 0, |
421 | 421 | PRIMARY KEY (QGQ_ID), |
422 | 422 | KEY QST_ID (QST_ID), |
423 | 423 | KEY QSG_ID_order (QSG_ID,QGQ_order)"; |
424 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
425 | - $table_name = 'esp_question_option'; |
|
426 | - $sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
424 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
425 | + $table_name = 'esp_question_option'; |
|
426 | + $sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
427 | 427 | QSO_value varchar(255) NOT NULL, |
428 | 428 | QSO_desc text NOT NULL, |
429 | 429 | QST_ID int(10) unsigned NOT NULL, |
@@ -433,9 +433,9 @@ discard block |
||
433 | 433 | PRIMARY KEY (QSO_ID), |
434 | 434 | KEY QST_ID (QST_ID), |
435 | 435 | KEY QSO_order (QSO_order)"; |
436 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
437 | - $table_name = 'esp_registration'; |
|
438 | - $sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
436 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
437 | + $table_name = 'esp_registration'; |
|
438 | + $sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
439 | 439 | EVT_ID bigint(20) unsigned NOT NULL, |
440 | 440 | ATT_ID bigint(20) unsigned NOT NULL, |
441 | 441 | TXN_ID int(10) unsigned NOT NULL, |
@@ -459,18 +459,18 @@ discard block |
||
459 | 459 | KEY TKT_ID (TKT_ID), |
460 | 460 | KEY EVT_ID (EVT_ID), |
461 | 461 | KEY STS_ID (STS_ID)"; |
462 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
463 | - $table_name = 'esp_registration_payment'; |
|
464 | - $sql = "RPY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
462 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
463 | + $table_name = 'esp_registration_payment'; |
|
464 | + $sql = "RPY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
465 | 465 | REG_ID int(10) unsigned NOT NULL, |
466 | 466 | PAY_ID int(10) unsigned NULL, |
467 | 467 | RPY_amount decimal(12,3) NOT NULL DEFAULT '0.00', |
468 | 468 | PRIMARY KEY (RPY_ID), |
469 | 469 | KEY REG_ID (REG_ID), |
470 | 470 | KEY PAY_ID (PAY_ID)"; |
471 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
472 | - $table_name = 'esp_state'; |
|
473 | - $sql = "STA_ID smallint(5) unsigned NOT NULL AUTO_INCREMENT, |
|
471 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
472 | + $table_name = 'esp_state'; |
|
473 | + $sql = "STA_ID smallint(5) unsigned NOT NULL AUTO_INCREMENT, |
|
474 | 474 | CNT_ISO varchar(2) NOT NULL, |
475 | 475 | STA_abbrev varchar(24) NOT NULL, |
476 | 476 | STA_name varchar(100) NOT NULL, |
@@ -478,9 +478,9 @@ discard block |
||
478 | 478 | PRIMARY KEY (STA_ID), |
479 | 479 | KEY STA_abbrev (STA_abbrev), |
480 | 480 | KEY CNT_ISO (CNT_ISO)"; |
481 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
482 | - $table_name = 'esp_status'; |
|
483 | - $sql = "STS_ID varchar(3) NOT NULL, |
|
481 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
482 | + $table_name = 'esp_status'; |
|
483 | + $sql = "STS_ID varchar(3) NOT NULL, |
|
484 | 484 | STS_code varchar(45) NOT NULL, |
485 | 485 | STS_type varchar(45) NOT NULL, |
486 | 486 | STS_can_edit tinyint(1) NOT NULL DEFAULT 0, |
@@ -488,9 +488,9 @@ discard block |
||
488 | 488 | STS_open tinyint(1) NOT NULL DEFAULT 1, |
489 | 489 | UNIQUE KEY STS_ID_UNIQUE (STS_ID), |
490 | 490 | KEY STS_type (STS_type)"; |
491 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
492 | - $table_name = 'esp_transaction'; |
|
493 | - $sql = "TXN_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
491 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
492 | + $table_name = 'esp_transaction'; |
|
493 | + $sql = "TXN_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
494 | 494 | TXN_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00', |
495 | 495 | TXN_total decimal(12,3) DEFAULT '0.00', |
496 | 496 | TXN_paid decimal(12,3) NOT NULL DEFAULT '0.00', |
@@ -502,9 +502,9 @@ discard block |
||
502 | 502 | PRIMARY KEY (TXN_ID), |
503 | 503 | KEY TXN_timestamp (TXN_timestamp), |
504 | 504 | KEY STS_ID (STS_ID)"; |
505 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
506 | - $table_name = 'esp_venue_meta'; |
|
507 | - $sql = "VNUM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
505 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
506 | + $table_name = 'esp_venue_meta'; |
|
507 | + $sql = "VNUM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
508 | 508 | VNU_ID bigint(20) unsigned NOT NULL DEFAULT 0, |
509 | 509 | VNU_address varchar(255) DEFAULT NULL, |
510 | 510 | VNU_address2 varchar(255) DEFAULT NULL, |
@@ -523,10 +523,10 @@ discard block |
||
523 | 523 | KEY VNU_ID (VNU_ID), |
524 | 524 | KEY STA_ID (STA_ID), |
525 | 525 | KEY CNT_ISO (CNT_ISO)"; |
526 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
527 | - // modified tables |
|
528 | - $table_name = "esp_price"; |
|
529 | - $sql = "PRC_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
526 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
527 | + // modified tables |
|
528 | + $table_name = "esp_price"; |
|
529 | + $sql = "PRC_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
530 | 530 | PRT_ID tinyint(3) unsigned NOT NULL, |
531 | 531 | PRC_amount decimal(12,3) NOT NULL DEFAULT '0.00', |
532 | 532 | PRC_name varchar(245) NOT NULL, |
@@ -539,9 +539,9 @@ discard block |
||
539 | 539 | PRC_parent int(10) unsigned DEFAULT 0, |
540 | 540 | PRIMARY KEY (PRC_ID), |
541 | 541 | KEY PRT_ID (PRT_ID)"; |
542 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
543 | - $table_name = "esp_price_type"; |
|
544 | - $sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT, |
|
542 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
543 | + $table_name = "esp_price_type"; |
|
544 | + $sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT, |
|
545 | 545 | PRT_name varchar(45) NOT NULL, |
546 | 546 | PBT_ID tinyint(3) unsigned NOT NULL DEFAULT '1', |
547 | 547 | PRT_is_percent tinyint(1) NOT NULL DEFAULT '0', |
@@ -550,9 +550,9 @@ discard block |
||
550 | 550 | PRT_deleted tinyint(1) NOT NULL DEFAULT '0', |
551 | 551 | UNIQUE KEY PRT_name_UNIQUE (PRT_name), |
552 | 552 | PRIMARY KEY (PRT_ID)"; |
553 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
554 | - $table_name = "esp_ticket"; |
|
555 | - $sql = "TKT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
553 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
554 | + $table_name = "esp_ticket"; |
|
555 | + $sql = "TKT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
556 | 556 | TTM_ID int(10) unsigned NOT NULL, |
557 | 557 | TKT_name varchar(245) NOT NULL DEFAULT '', |
558 | 558 | TKT_description text NOT NULL, |
@@ -575,9 +575,9 @@ discard block |
||
575 | 575 | TKT_deleted tinyint(1) NOT NULL DEFAULT '0', |
576 | 576 | PRIMARY KEY (TKT_ID), |
577 | 577 | KEY TKT_start_date (TKT_start_date)"; |
578 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
579 | - $table_name = 'esp_question_group'; |
|
580 | - $sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
578 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
579 | + $table_name = 'esp_question_group'; |
|
580 | + $sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
581 | 581 | QSG_name varchar(255) NOT NULL, |
582 | 582 | QSG_identifier varchar(100) NOT NULL, |
583 | 583 | QSG_desc text NULL, |
@@ -590,145 +590,145 @@ discard block |
||
590 | 590 | PRIMARY KEY (QSG_ID), |
591 | 591 | UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier), |
592 | 592 | KEY QSG_order (QSG_order)'; |
593 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
594 | - /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */ |
|
595 | - $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
|
596 | - // (because many need to convert old string states to foreign keys into the states table) |
|
597 | - $script_4_1_defaults->insert_default_states(); |
|
598 | - $script_4_1_defaults->insert_default_countries(); |
|
599 | - /** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */ |
|
600 | - $script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0'); |
|
601 | - $script_4_5_defaults->insert_default_price_types(); |
|
602 | - $script_4_5_defaults->insert_default_prices(); |
|
603 | - $script_4_5_defaults->insert_default_tickets(); |
|
604 | - /** @var EE_DMS_Core_4_6_0 $script_4_6_defaults */ |
|
605 | - $script_4_6_defaults = EE_Registry::instance()->load_dms('Core_4_6_0'); |
|
606 | - $script_4_6_defaults->add_default_admin_only_payments(); |
|
607 | - $script_4_6_defaults->insert_default_currencies(); |
|
608 | - /** @var EE_DMS_Core_4_8_0 $script_4_8_defaults */ |
|
609 | - $script_4_8_defaults = EE_Registry::instance()->load_dms('Core_4_8_0'); |
|
610 | - $script_4_8_defaults->verify_new_countries(); |
|
611 | - $script_4_8_defaults->verify_new_currencies(); |
|
612 | - $this->verify_db_collations(); |
|
613 | - $this->verify_db_collations_again(); |
|
614 | - return true; |
|
615 | - } |
|
593 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
594 | + /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */ |
|
595 | + $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
|
596 | + // (because many need to convert old string states to foreign keys into the states table) |
|
597 | + $script_4_1_defaults->insert_default_states(); |
|
598 | + $script_4_1_defaults->insert_default_countries(); |
|
599 | + /** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */ |
|
600 | + $script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0'); |
|
601 | + $script_4_5_defaults->insert_default_price_types(); |
|
602 | + $script_4_5_defaults->insert_default_prices(); |
|
603 | + $script_4_5_defaults->insert_default_tickets(); |
|
604 | + /** @var EE_DMS_Core_4_6_0 $script_4_6_defaults */ |
|
605 | + $script_4_6_defaults = EE_Registry::instance()->load_dms('Core_4_6_0'); |
|
606 | + $script_4_6_defaults->add_default_admin_only_payments(); |
|
607 | + $script_4_6_defaults->insert_default_currencies(); |
|
608 | + /** @var EE_DMS_Core_4_8_0 $script_4_8_defaults */ |
|
609 | + $script_4_8_defaults = EE_Registry::instance()->load_dms('Core_4_8_0'); |
|
610 | + $script_4_8_defaults->verify_new_countries(); |
|
611 | + $script_4_8_defaults->verify_new_currencies(); |
|
612 | + $this->verify_db_collations(); |
|
613 | + $this->verify_db_collations_again(); |
|
614 | + return true; |
|
615 | + } |
|
616 | 616 | |
617 | 617 | |
618 | 618 | |
619 | - /** |
|
620 | - * @return boolean |
|
621 | - */ |
|
622 | - public function schema_changes_after_migration() |
|
623 | - { |
|
624 | - return true; |
|
625 | - } |
|
619 | + /** |
|
620 | + * @return boolean |
|
621 | + */ |
|
622 | + public function schema_changes_after_migration() |
|
623 | + { |
|
624 | + return true; |
|
625 | + } |
|
626 | 626 | |
627 | 627 | |
628 | 628 | |
629 | - public function migration_page_hooks() |
|
630 | - { |
|
631 | - } |
|
629 | + public function migration_page_hooks() |
|
630 | + { |
|
631 | + } |
|
632 | 632 | |
633 | 633 | |
634 | 634 | |
635 | - /** |
|
636 | - * Verify all EE4 models' tables use utf8mb4 collation |
|
637 | - * |
|
638 | - * @return void |
|
639 | - */ |
|
640 | - public function verify_db_collations() |
|
641 | - { |
|
642 | - global $wpdb; |
|
643 | - // double-check we haven't already done it or that that the DB doesn't support utf8mb4 |
|
644 | - if ('utf8mb4' !== $wpdb->charset |
|
645 | - || get_option('ee_verified_db_collations', false)) { |
|
646 | - return; |
|
647 | - } |
|
648 | - // grab tables from each model |
|
649 | - $tables_to_check = array(); |
|
650 | - foreach (EE_Registry::instance()->non_abstract_db_models as $model_name) { |
|
651 | - if (method_exists($model_name, 'instance')) { |
|
652 | - $model_obj = call_user_func(array($model_name, 'instance')); |
|
653 | - if ($model_obj instanceof EEM_Base) { |
|
654 | - foreach ($model_obj->get_tables() as $table) { |
|
655 | - if (strpos($table->get_table_name(), 'esp_') |
|
656 | - && (is_main_site()// for main tables, verify global tables |
|
657 | - || ! $table->is_global()// if not the main site, then only verify non-global tables (avoid doubling up) |
|
658 | - ) |
|
659 | - && function_exists('maybe_convert_table_to_utf8mb4') |
|
660 | - ) { |
|
661 | - $tables_to_check[] = $table->get_table_name(); |
|
662 | - } |
|
663 | - } |
|
664 | - } |
|
665 | - } |
|
666 | - } |
|
667 | - // and let's just be sure these addons' tables get migrated too. They already get handled if their addons are active |
|
668 | - // when this code is run, but not otherwise. Once we record what tables EE added, we'll be able to use that instead |
|
669 | - // of hard-coding this |
|
670 | - $addon_tables = array( |
|
671 | - // mailchimp |
|
672 | - 'esp_event_mailchimp_list_group', |
|
673 | - 'esp_event_question_mailchimp_field', |
|
674 | - // multisite |
|
675 | - 'esp_blog_meta', |
|
676 | - // people |
|
677 | - 'esp_people_to_post', |
|
678 | - // promotions |
|
679 | - 'esp_promotion', |
|
680 | - 'esp_promotion_object', |
|
681 | - ); |
|
682 | - foreach ($addon_tables as $table_name) { |
|
683 | - $tables_to_check[] = $table_name; |
|
684 | - } |
|
685 | - $this->_verify_db_collations_for_tables(array_unique($tables_to_check)); |
|
686 | - // ok and now let's remember this was done (without needing to check the db schemas all over again) |
|
687 | - add_option('ee_verified_db_collations', true, null, 'no'); |
|
688 | - // seeing how this ran with the fix from 10435, no need to check again |
|
689 | - add_option('ee_verified_db_collations_again', true, null, 'no'); |
|
690 | - } |
|
635 | + /** |
|
636 | + * Verify all EE4 models' tables use utf8mb4 collation |
|
637 | + * |
|
638 | + * @return void |
|
639 | + */ |
|
640 | + public function verify_db_collations() |
|
641 | + { |
|
642 | + global $wpdb; |
|
643 | + // double-check we haven't already done it or that that the DB doesn't support utf8mb4 |
|
644 | + if ('utf8mb4' !== $wpdb->charset |
|
645 | + || get_option('ee_verified_db_collations', false)) { |
|
646 | + return; |
|
647 | + } |
|
648 | + // grab tables from each model |
|
649 | + $tables_to_check = array(); |
|
650 | + foreach (EE_Registry::instance()->non_abstract_db_models as $model_name) { |
|
651 | + if (method_exists($model_name, 'instance')) { |
|
652 | + $model_obj = call_user_func(array($model_name, 'instance')); |
|
653 | + if ($model_obj instanceof EEM_Base) { |
|
654 | + foreach ($model_obj->get_tables() as $table) { |
|
655 | + if (strpos($table->get_table_name(), 'esp_') |
|
656 | + && (is_main_site()// for main tables, verify global tables |
|
657 | + || ! $table->is_global()// if not the main site, then only verify non-global tables (avoid doubling up) |
|
658 | + ) |
|
659 | + && function_exists('maybe_convert_table_to_utf8mb4') |
|
660 | + ) { |
|
661 | + $tables_to_check[] = $table->get_table_name(); |
|
662 | + } |
|
663 | + } |
|
664 | + } |
|
665 | + } |
|
666 | + } |
|
667 | + // and let's just be sure these addons' tables get migrated too. They already get handled if their addons are active |
|
668 | + // when this code is run, but not otherwise. Once we record what tables EE added, we'll be able to use that instead |
|
669 | + // of hard-coding this |
|
670 | + $addon_tables = array( |
|
671 | + // mailchimp |
|
672 | + 'esp_event_mailchimp_list_group', |
|
673 | + 'esp_event_question_mailchimp_field', |
|
674 | + // multisite |
|
675 | + 'esp_blog_meta', |
|
676 | + // people |
|
677 | + 'esp_people_to_post', |
|
678 | + // promotions |
|
679 | + 'esp_promotion', |
|
680 | + 'esp_promotion_object', |
|
681 | + ); |
|
682 | + foreach ($addon_tables as $table_name) { |
|
683 | + $tables_to_check[] = $table_name; |
|
684 | + } |
|
685 | + $this->_verify_db_collations_for_tables(array_unique($tables_to_check)); |
|
686 | + // ok and now let's remember this was done (without needing to check the db schemas all over again) |
|
687 | + add_option('ee_verified_db_collations', true, null, 'no'); |
|
688 | + // seeing how this ran with the fix from 10435, no need to check again |
|
689 | + add_option('ee_verified_db_collations_again', true, null, 'no'); |
|
690 | + } |
|
691 | 691 | |
692 | 692 | |
693 | 693 | |
694 | - /** |
|
695 | - * Verifies DB collations because a bug was discovered on https://events.codebasehq.com/projects/event-espresso/tickets/10435 |
|
696 | - * which meant some DB collations might not have been updated |
|
697 | - * @return void |
|
698 | - */ |
|
699 | - public function verify_db_collations_again() |
|
700 | - { |
|
701 | - global $wpdb; |
|
702 | - // double-check we haven't already done this or that the DB doesn't support it |
|
703 | - // compare to how WordPress' upgrade_430() function does this check |
|
704 | - if ('utf8mb4' !== $wpdb->charset |
|
705 | - || get_option('ee_verified_db_collations_again', false)) { |
|
706 | - return; |
|
707 | - } |
|
708 | - $tables_to_check = array( |
|
709 | - 'esp_attendee_meta', |
|
710 | - 'esp_message' |
|
711 | - ); |
|
712 | - $this->_verify_db_collations_for_tables(array_unique($tables_to_check)); |
|
713 | - add_option('ee_verified_db_collations_again', true, null, 'no'); |
|
714 | - } |
|
694 | + /** |
|
695 | + * Verifies DB collations because a bug was discovered on https://events.codebasehq.com/projects/event-espresso/tickets/10435 |
|
696 | + * which meant some DB collations might not have been updated |
|
697 | + * @return void |
|
698 | + */ |
|
699 | + public function verify_db_collations_again() |
|
700 | + { |
|
701 | + global $wpdb; |
|
702 | + // double-check we haven't already done this or that the DB doesn't support it |
|
703 | + // compare to how WordPress' upgrade_430() function does this check |
|
704 | + if ('utf8mb4' !== $wpdb->charset |
|
705 | + || get_option('ee_verified_db_collations_again', false)) { |
|
706 | + return; |
|
707 | + } |
|
708 | + $tables_to_check = array( |
|
709 | + 'esp_attendee_meta', |
|
710 | + 'esp_message' |
|
711 | + ); |
|
712 | + $this->_verify_db_collations_for_tables(array_unique($tables_to_check)); |
|
713 | + add_option('ee_verified_db_collations_again', true, null, 'no'); |
|
714 | + } |
|
715 | 715 | |
716 | 716 | |
717 | 717 | |
718 | - /** |
|
719 | - * Runs maybe_convert_table_to_utf8mb4 on the specified tables |
|
720 | - * @param $tables_to_check |
|
721 | - * @return boolean true if logic ran, false if it didn't |
|
722 | - */ |
|
723 | - protected function _verify_db_collations_for_tables($tables_to_check) |
|
724 | - { |
|
725 | - foreach ($tables_to_check as $table_name) { |
|
726 | - $table_name = $this->_table_analysis->ensureTableNameHasPrefix($table_name); |
|
727 | - if (! apply_filters('FHEE__EE_DMS_Core_4_9_0__verify_db_collations__check_overridden', false, $table_name) |
|
728 | - && $this->_get_table_analysis()->tableExists($table_name) |
|
729 | - ) { |
|
730 | - maybe_convert_table_to_utf8mb4($table_name); |
|
731 | - } |
|
732 | - } |
|
733 | - } |
|
718 | + /** |
|
719 | + * Runs maybe_convert_table_to_utf8mb4 on the specified tables |
|
720 | + * @param $tables_to_check |
|
721 | + * @return boolean true if logic ran, false if it didn't |
|
722 | + */ |
|
723 | + protected function _verify_db_collations_for_tables($tables_to_check) |
|
724 | + { |
|
725 | + foreach ($tables_to_check as $table_name) { |
|
726 | + $table_name = $this->_table_analysis->ensureTableNameHasPrefix($table_name); |
|
727 | + if (! apply_filters('FHEE__EE_DMS_Core_4_9_0__verify_db_collations__check_overridden', false, $table_name) |
|
728 | + && $this->_get_table_analysis()->tableExists($table_name) |
|
729 | + ) { |
|
730 | + maybe_convert_table_to_utf8mb4($table_name); |
|
731 | + } |
|
732 | + } |
|
733 | + } |
|
734 | 734 | } |
@@ -27,322 +27,322 @@ |
||
27 | 27 | class EE_Brewing_Regular extends EE_BASE implements InterminableInterface |
28 | 28 | { |
29 | 29 | |
30 | - /** |
|
31 | - * @var TableAnalysis $table_analysis |
|
32 | - */ |
|
33 | - protected $_table_analysis; |
|
34 | - |
|
35 | - |
|
36 | - /** |
|
37 | - * EE_Brewing_Regular constructor. |
|
38 | - * |
|
39 | - * @param TableAnalysis $table_analysis |
|
40 | - */ |
|
41 | - public function __construct(TableAnalysis $table_analysis) |
|
42 | - { |
|
43 | - $this->_table_analysis = $table_analysis; |
|
44 | - if (defined('EE_CAFF_PATH')) { |
|
45 | - $this->setInitializationHooks(); |
|
46 | - $this->setApiRegistrationHooks(); |
|
47 | - $this->setSwitchHooks(); |
|
48 | - $this->setDefaultFilterHooks(); |
|
49 | - // caffeinated constructed |
|
50 | - do_action('AHEE__EE_Brewing_Regular__construct__complete'); |
|
51 | - } |
|
52 | - } |
|
53 | - |
|
54 | - |
|
55 | - /** |
|
56 | - * Various hooks used for extending features via registration of modules or extensions. |
|
57 | - */ |
|
58 | - private function setApiRegistrationHooks() |
|
59 | - { |
|
60 | - add_filter( |
|
61 | - 'FHEE__EE_Config__register_modules__modules_to_register', |
|
62 | - array($this, 'caffeinated_modules_to_register') |
|
63 | - ); |
|
64 | - add_filter('FHEE__EE_Registry__load_helper__helper_paths', array($this, 'caf_helper_paths'), 10); |
|
65 | - add_filter( |
|
66 | - 'AHEE__EE_System__load_core_configuration__complete', |
|
67 | - function () { |
|
68 | - EE_Register_Payment_Method::register( |
|
69 | - 'caffeinated_payment_methods', |
|
70 | - array( |
|
71 | - 'payment_method_paths' => glob(EE_CAF_PAYMENT_METHODS . '*', GLOB_ONLYDIR), |
|
72 | - ) |
|
73 | - ); |
|
74 | - } |
|
75 | - ); |
|
76 | - } |
|
77 | - |
|
78 | - |
|
79 | - /** |
|
80 | - * Various hooks used for modifying initialization or activation processes. |
|
81 | - */ |
|
82 | - private function setInitializationHooks() |
|
83 | - { |
|
84 | - // activation |
|
85 | - add_action('AHEE__EEH_Activation__initialize_db_content', array($this, 'initialize_caf_db_content')); |
|
86 | - // load caff init |
|
87 | - add_action('AHEE__EE_System__set_hooks_for_core', array($this, 'caffeinated_init')); |
|
88 | - // load caff scripts |
|
89 | - add_action('wp_enqueue_scripts', array($this, 'enqueue_caffeinated_scripts'), 10); |
|
90 | - } |
|
91 | - |
|
92 | - |
|
93 | - /** |
|
94 | - * Various hooks used for switch (on/off) type filters. |
|
95 | - */ |
|
96 | - private function setSwitchHooks() |
|
97 | - { |
|
98 | - // remove the "powered by" credit link from receipts and invoices |
|
99 | - add_filter('FHEE_EE_Html_messenger__add_powered_by_credit_link_to_receipt_and_invoice', '__return_false'); |
|
100 | - // seeing how this is caf, which isn't put on WordPress.org, we can have affiliate links without a disclaimer |
|
101 | - add_filter('FHEE__ee_show_affiliate_links', '__return_false'); |
|
102 | - } |
|
103 | - |
|
104 | - |
|
105 | - /** |
|
106 | - * Various filters for affecting default configuration values in the caffeinated |
|
107 | - * context. |
|
108 | - */ |
|
109 | - private function setDefaultFilterHooks() |
|
110 | - { |
|
111 | - add_filter( |
|
112 | - 'FHEE__EE_Admin_Config__show_reg_footer__default', |
|
113 | - '__return_true' |
|
114 | - ); |
|
115 | - } |
|
116 | - |
|
117 | - |
|
118 | - /** |
|
119 | - * callback for the FHEE__EE_Registry__load_helper__helper_paths filter to add the caffeinated paths |
|
120 | - * |
|
121 | - * @param array $paths original helper paths array |
|
122 | - * @return array new array of paths |
|
123 | - */ |
|
124 | - public function caf_helper_paths($paths) |
|
125 | - { |
|
126 | - $paths[] = EE_CAF_CORE . 'helpers' . DS; |
|
127 | - return $paths; |
|
128 | - } |
|
129 | - |
|
130 | - |
|
131 | - /** |
|
132 | - * Upon brand-new activation, if this is a new activation of CAF, we want to add |
|
133 | - * some global prices that will show off EE4's capabilities. However, if they're upgrading |
|
134 | - * from 3.1, or simply EE4.x decaf, we assume they don't want us to suddenly introduce these extra prices. |
|
135 | - * This action should only be called when EE 4.x.0.P is initially activated. |
|
136 | - * Right now the only CAF content are these global prices. If there's more in the future, then |
|
137 | - * we should probably create a caf file to contain it all instead just a function like this. |
|
138 | - * Right now, we ASSUME the only price types in the system are default ones |
|
139 | - * |
|
140 | - * @global wpdb $wpdb |
|
141 | - */ |
|
142 | - public function initialize_caf_db_content() |
|
143 | - { |
|
144 | - global $wpdb; |
|
145 | - // use same method of getting creator id as the version introducing the change |
|
146 | - $default_creator_id = apply_filters('FHEE__EE_DMS_Core_4_5_0__get_default_creator_id', get_current_user_id()); |
|
147 | - $price_type_table = $wpdb->prefix . "esp_price_type"; |
|
148 | - $price_table = $wpdb->prefix . "esp_price"; |
|
149 | - if ($this->_get_table_analysis()->tableExists($price_type_table)) { |
|
150 | - $SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table . ' WHERE PBT_ID=4';// include trashed price types |
|
151 | - $tax_price_type_count = $wpdb->get_var($SQL); |
|
152 | - if ($tax_price_type_count <= 1) { |
|
153 | - $wpdb->insert( |
|
154 | - $price_type_table, |
|
155 | - array( |
|
156 | - 'PRT_name' => __("Regional Tax", "event_espresso"), |
|
157 | - 'PBT_ID' => 4, |
|
158 | - 'PRT_is_percent' => true, |
|
159 | - 'PRT_order' => 60, |
|
160 | - 'PRT_deleted' => false, |
|
161 | - 'PRT_wp_user' => $default_creator_id, |
|
162 | - ), |
|
163 | - array( |
|
164 | - '%s',// PRT_name |
|
165 | - '%d',// PBT_id |
|
166 | - '%d',// PRT_is_percent |
|
167 | - '%d',// PRT_order |
|
168 | - '%d',// PRT_deleted |
|
169 | - '%d', // PRT_wp_user |
|
170 | - ) |
|
171 | - ); |
|
172 | - // federal tax |
|
173 | - $result = $wpdb->insert( |
|
174 | - $price_type_table, |
|
175 | - array( |
|
176 | - 'PRT_name' => __("Federal Tax", "event_espresso"), |
|
177 | - 'PBT_ID' => 4, |
|
178 | - 'PRT_is_percent' => true, |
|
179 | - 'PRT_order' => 70, |
|
180 | - 'PRT_deleted' => false, |
|
181 | - 'PRT_wp_user' => $default_creator_id, |
|
182 | - ), |
|
183 | - array( |
|
184 | - '%s',// PRT_name |
|
185 | - '%d',// PBT_id |
|
186 | - '%d',// PRT_is_percent |
|
187 | - '%d',// PRT_order |
|
188 | - '%d',// PRT_deleted |
|
189 | - '%d' // PRT_wp_user |
|
190 | - ) |
|
191 | - ); |
|
192 | - if ($result) { |
|
193 | - $wpdb->insert( |
|
194 | - $price_table, |
|
195 | - array( |
|
196 | - 'PRT_ID' => $wpdb->insert_id, |
|
197 | - 'PRC_amount' => 15.00, |
|
198 | - 'PRC_name' => __("Sales Tax", "event_espresso"), |
|
199 | - 'PRC_desc' => '', |
|
200 | - 'PRC_is_default' => true, |
|
201 | - 'PRC_overrides' => null, |
|
202 | - 'PRC_deleted' => false, |
|
203 | - 'PRC_order' => 50, |
|
204 | - 'PRC_parent' => null, |
|
205 | - 'PRC_wp_user' => $default_creator_id, |
|
206 | - ), |
|
207 | - array( |
|
208 | - '%d',// PRT_id |
|
209 | - '%f',// PRC_amount |
|
210 | - '%s',// PRC_name |
|
211 | - '%s',// PRC_desc |
|
212 | - '%d',// PRC_is_default |
|
213 | - '%d',// PRC_overrides |
|
214 | - '%d',// PRC_deleted |
|
215 | - '%d',// PRC_order |
|
216 | - '%d',// PRC_parent |
|
217 | - '%d' // PRC_wp_user |
|
218 | - ) |
|
219 | - ); |
|
220 | - } |
|
221 | - } |
|
222 | - } |
|
223 | - } |
|
224 | - |
|
225 | - |
|
226 | - /** |
|
227 | - * caffeinated_modules_to_register |
|
228 | - * |
|
229 | - * @access public |
|
230 | - * @param array $modules_to_register |
|
231 | - * @return array |
|
232 | - */ |
|
233 | - public function caffeinated_modules_to_register($modules_to_register = array()) |
|
234 | - { |
|
235 | - if (is_readable(EE_CAFF_PATH . 'modules')) { |
|
236 | - $caffeinated_modules_to_register = glob(EE_CAFF_PATH . 'modules' . DS . '*', GLOB_ONLYDIR); |
|
237 | - if (is_array($caffeinated_modules_to_register) && ! empty($caffeinated_modules_to_register)) { |
|
238 | - $modules_to_register = array_merge($modules_to_register, $caffeinated_modules_to_register); |
|
239 | - } |
|
240 | - } |
|
241 | - return $modules_to_register; |
|
242 | - } |
|
243 | - |
|
244 | - |
|
245 | - /** |
|
246 | - * @throws EE_Error |
|
247 | - * @throws InvalidArgumentException |
|
248 | - * @throws ReflectionException |
|
249 | - * @throws InvalidDataTypeException |
|
250 | - * @throws InvalidInterfaceException |
|
251 | - */ |
|
252 | - public function caffeinated_init() |
|
253 | - { |
|
254 | - // Custom Post Type hooks |
|
255 | - add_filter( |
|
256 | - 'FHEE__EventEspresso_core_domain_entities_custom_post_types_TaxonomyDefinitions__getTaxonomies', |
|
257 | - array($this, 'filter_taxonomies') |
|
258 | - ); |
|
259 | - add_filter( |
|
260 | - 'FHEE__EventEspresso_core_domain_entities_custom_post_types_CustomPostTypeDefinitions__getCustomPostTypes', |
|
261 | - array($this, 'filter_cpts') |
|
262 | - ); |
|
263 | - add_filter( |
|
264 | - 'FHEE__EE_Admin__get_extra_nav_menu_pages_items', |
|
265 | - array($this, 'nav_metabox_items') |
|
266 | - ); |
|
267 | - EE_Registry::instance()->load_file( |
|
268 | - EE_CAFF_PATH, |
|
269 | - 'EE_Caf_Messages', |
|
270 | - 'class', |
|
271 | - array(), |
|
272 | - false |
|
273 | - ); |
|
274 | - // caffeinated_init__complete hook |
|
275 | - do_action('AHEE__EE_Brewing_Regular__caffeinated_init__complete'); |
|
276 | - } |
|
277 | - |
|
278 | - |
|
279 | - public function enqueue_caffeinated_scripts() |
|
280 | - { |
|
281 | - // sound of crickets... |
|
282 | - } |
|
283 | - |
|
284 | - |
|
285 | - /** |
|
286 | - * callbacks below here |
|
287 | - * |
|
288 | - * @param array $taxonomy_array |
|
289 | - * @return array |
|
290 | - */ |
|
291 | - public function filter_taxonomies(array $taxonomy_array) |
|
292 | - { |
|
293 | - $taxonomy_array['espresso_venue_categories']['args']['show_in_nav_menus'] = true; |
|
294 | - return $taxonomy_array; |
|
295 | - } |
|
296 | - |
|
297 | - |
|
298 | - /** |
|
299 | - * @param array $cpt_array |
|
300 | - * @return mixed |
|
301 | - */ |
|
302 | - public function filter_cpts(array $cpt_array) |
|
303 | - { |
|
304 | - $cpt_array['espresso_venues']['args']['show_in_nav_menus'] = true; |
|
305 | - return $cpt_array; |
|
306 | - } |
|
307 | - |
|
308 | - |
|
309 | - /** |
|
310 | - * @param array $menuitems |
|
311 | - * @return array |
|
312 | - */ |
|
313 | - public function nav_metabox_items(array $menuitems) |
|
314 | - { |
|
315 | - $menuitems[] = array( |
|
316 | - 'title' => __('Venue List', 'event_espresso'), |
|
317 | - 'url' => get_post_type_archive_link('espresso_venues'), |
|
318 | - 'description' => __('Archive page for all venues.', 'event_espresso'), |
|
319 | - ); |
|
320 | - return $menuitems; |
|
321 | - } |
|
322 | - |
|
323 | - |
|
324 | - /** |
|
325 | - * Gets the injected table analyzer, or throws an exception |
|
326 | - * |
|
327 | - * @return TableAnalysis |
|
328 | - * @throws \EE_Error |
|
329 | - */ |
|
330 | - protected function _get_table_analysis() |
|
331 | - { |
|
332 | - if ($this->_table_analysis instanceof TableAnalysis) { |
|
333 | - return $this->_table_analysis; |
|
334 | - } else { |
|
335 | - throw new \EE_Error( |
|
336 | - sprintf( |
|
337 | - __('Table analysis class on class %1$s is not set properly.', 'event_espresso'), |
|
338 | - get_class($this) |
|
339 | - ) |
|
340 | - ); |
|
341 | - } |
|
342 | - } |
|
30 | + /** |
|
31 | + * @var TableAnalysis $table_analysis |
|
32 | + */ |
|
33 | + protected $_table_analysis; |
|
34 | + |
|
35 | + |
|
36 | + /** |
|
37 | + * EE_Brewing_Regular constructor. |
|
38 | + * |
|
39 | + * @param TableAnalysis $table_analysis |
|
40 | + */ |
|
41 | + public function __construct(TableAnalysis $table_analysis) |
|
42 | + { |
|
43 | + $this->_table_analysis = $table_analysis; |
|
44 | + if (defined('EE_CAFF_PATH')) { |
|
45 | + $this->setInitializationHooks(); |
|
46 | + $this->setApiRegistrationHooks(); |
|
47 | + $this->setSwitchHooks(); |
|
48 | + $this->setDefaultFilterHooks(); |
|
49 | + // caffeinated constructed |
|
50 | + do_action('AHEE__EE_Brewing_Regular__construct__complete'); |
|
51 | + } |
|
52 | + } |
|
53 | + |
|
54 | + |
|
55 | + /** |
|
56 | + * Various hooks used for extending features via registration of modules or extensions. |
|
57 | + */ |
|
58 | + private function setApiRegistrationHooks() |
|
59 | + { |
|
60 | + add_filter( |
|
61 | + 'FHEE__EE_Config__register_modules__modules_to_register', |
|
62 | + array($this, 'caffeinated_modules_to_register') |
|
63 | + ); |
|
64 | + add_filter('FHEE__EE_Registry__load_helper__helper_paths', array($this, 'caf_helper_paths'), 10); |
|
65 | + add_filter( |
|
66 | + 'AHEE__EE_System__load_core_configuration__complete', |
|
67 | + function () { |
|
68 | + EE_Register_Payment_Method::register( |
|
69 | + 'caffeinated_payment_methods', |
|
70 | + array( |
|
71 | + 'payment_method_paths' => glob(EE_CAF_PAYMENT_METHODS . '*', GLOB_ONLYDIR), |
|
72 | + ) |
|
73 | + ); |
|
74 | + } |
|
75 | + ); |
|
76 | + } |
|
77 | + |
|
78 | + |
|
79 | + /** |
|
80 | + * Various hooks used for modifying initialization or activation processes. |
|
81 | + */ |
|
82 | + private function setInitializationHooks() |
|
83 | + { |
|
84 | + // activation |
|
85 | + add_action('AHEE__EEH_Activation__initialize_db_content', array($this, 'initialize_caf_db_content')); |
|
86 | + // load caff init |
|
87 | + add_action('AHEE__EE_System__set_hooks_for_core', array($this, 'caffeinated_init')); |
|
88 | + // load caff scripts |
|
89 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_caffeinated_scripts'), 10); |
|
90 | + } |
|
91 | + |
|
92 | + |
|
93 | + /** |
|
94 | + * Various hooks used for switch (on/off) type filters. |
|
95 | + */ |
|
96 | + private function setSwitchHooks() |
|
97 | + { |
|
98 | + // remove the "powered by" credit link from receipts and invoices |
|
99 | + add_filter('FHEE_EE_Html_messenger__add_powered_by_credit_link_to_receipt_and_invoice', '__return_false'); |
|
100 | + // seeing how this is caf, which isn't put on WordPress.org, we can have affiliate links without a disclaimer |
|
101 | + add_filter('FHEE__ee_show_affiliate_links', '__return_false'); |
|
102 | + } |
|
103 | + |
|
104 | + |
|
105 | + /** |
|
106 | + * Various filters for affecting default configuration values in the caffeinated |
|
107 | + * context. |
|
108 | + */ |
|
109 | + private function setDefaultFilterHooks() |
|
110 | + { |
|
111 | + add_filter( |
|
112 | + 'FHEE__EE_Admin_Config__show_reg_footer__default', |
|
113 | + '__return_true' |
|
114 | + ); |
|
115 | + } |
|
116 | + |
|
117 | + |
|
118 | + /** |
|
119 | + * callback for the FHEE__EE_Registry__load_helper__helper_paths filter to add the caffeinated paths |
|
120 | + * |
|
121 | + * @param array $paths original helper paths array |
|
122 | + * @return array new array of paths |
|
123 | + */ |
|
124 | + public function caf_helper_paths($paths) |
|
125 | + { |
|
126 | + $paths[] = EE_CAF_CORE . 'helpers' . DS; |
|
127 | + return $paths; |
|
128 | + } |
|
129 | + |
|
130 | + |
|
131 | + /** |
|
132 | + * Upon brand-new activation, if this is a new activation of CAF, we want to add |
|
133 | + * some global prices that will show off EE4's capabilities. However, if they're upgrading |
|
134 | + * from 3.1, or simply EE4.x decaf, we assume they don't want us to suddenly introduce these extra prices. |
|
135 | + * This action should only be called when EE 4.x.0.P is initially activated. |
|
136 | + * Right now the only CAF content are these global prices. If there's more in the future, then |
|
137 | + * we should probably create a caf file to contain it all instead just a function like this. |
|
138 | + * Right now, we ASSUME the only price types in the system are default ones |
|
139 | + * |
|
140 | + * @global wpdb $wpdb |
|
141 | + */ |
|
142 | + public function initialize_caf_db_content() |
|
143 | + { |
|
144 | + global $wpdb; |
|
145 | + // use same method of getting creator id as the version introducing the change |
|
146 | + $default_creator_id = apply_filters('FHEE__EE_DMS_Core_4_5_0__get_default_creator_id', get_current_user_id()); |
|
147 | + $price_type_table = $wpdb->prefix . "esp_price_type"; |
|
148 | + $price_table = $wpdb->prefix . "esp_price"; |
|
149 | + if ($this->_get_table_analysis()->tableExists($price_type_table)) { |
|
150 | + $SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table . ' WHERE PBT_ID=4';// include trashed price types |
|
151 | + $tax_price_type_count = $wpdb->get_var($SQL); |
|
152 | + if ($tax_price_type_count <= 1) { |
|
153 | + $wpdb->insert( |
|
154 | + $price_type_table, |
|
155 | + array( |
|
156 | + 'PRT_name' => __("Regional Tax", "event_espresso"), |
|
157 | + 'PBT_ID' => 4, |
|
158 | + 'PRT_is_percent' => true, |
|
159 | + 'PRT_order' => 60, |
|
160 | + 'PRT_deleted' => false, |
|
161 | + 'PRT_wp_user' => $default_creator_id, |
|
162 | + ), |
|
163 | + array( |
|
164 | + '%s',// PRT_name |
|
165 | + '%d',// PBT_id |
|
166 | + '%d',// PRT_is_percent |
|
167 | + '%d',// PRT_order |
|
168 | + '%d',// PRT_deleted |
|
169 | + '%d', // PRT_wp_user |
|
170 | + ) |
|
171 | + ); |
|
172 | + // federal tax |
|
173 | + $result = $wpdb->insert( |
|
174 | + $price_type_table, |
|
175 | + array( |
|
176 | + 'PRT_name' => __("Federal Tax", "event_espresso"), |
|
177 | + 'PBT_ID' => 4, |
|
178 | + 'PRT_is_percent' => true, |
|
179 | + 'PRT_order' => 70, |
|
180 | + 'PRT_deleted' => false, |
|
181 | + 'PRT_wp_user' => $default_creator_id, |
|
182 | + ), |
|
183 | + array( |
|
184 | + '%s',// PRT_name |
|
185 | + '%d',// PBT_id |
|
186 | + '%d',// PRT_is_percent |
|
187 | + '%d',// PRT_order |
|
188 | + '%d',// PRT_deleted |
|
189 | + '%d' // PRT_wp_user |
|
190 | + ) |
|
191 | + ); |
|
192 | + if ($result) { |
|
193 | + $wpdb->insert( |
|
194 | + $price_table, |
|
195 | + array( |
|
196 | + 'PRT_ID' => $wpdb->insert_id, |
|
197 | + 'PRC_amount' => 15.00, |
|
198 | + 'PRC_name' => __("Sales Tax", "event_espresso"), |
|
199 | + 'PRC_desc' => '', |
|
200 | + 'PRC_is_default' => true, |
|
201 | + 'PRC_overrides' => null, |
|
202 | + 'PRC_deleted' => false, |
|
203 | + 'PRC_order' => 50, |
|
204 | + 'PRC_parent' => null, |
|
205 | + 'PRC_wp_user' => $default_creator_id, |
|
206 | + ), |
|
207 | + array( |
|
208 | + '%d',// PRT_id |
|
209 | + '%f',// PRC_amount |
|
210 | + '%s',// PRC_name |
|
211 | + '%s',// PRC_desc |
|
212 | + '%d',// PRC_is_default |
|
213 | + '%d',// PRC_overrides |
|
214 | + '%d',// PRC_deleted |
|
215 | + '%d',// PRC_order |
|
216 | + '%d',// PRC_parent |
|
217 | + '%d' // PRC_wp_user |
|
218 | + ) |
|
219 | + ); |
|
220 | + } |
|
221 | + } |
|
222 | + } |
|
223 | + } |
|
224 | + |
|
225 | + |
|
226 | + /** |
|
227 | + * caffeinated_modules_to_register |
|
228 | + * |
|
229 | + * @access public |
|
230 | + * @param array $modules_to_register |
|
231 | + * @return array |
|
232 | + */ |
|
233 | + public function caffeinated_modules_to_register($modules_to_register = array()) |
|
234 | + { |
|
235 | + if (is_readable(EE_CAFF_PATH . 'modules')) { |
|
236 | + $caffeinated_modules_to_register = glob(EE_CAFF_PATH . 'modules' . DS . '*', GLOB_ONLYDIR); |
|
237 | + if (is_array($caffeinated_modules_to_register) && ! empty($caffeinated_modules_to_register)) { |
|
238 | + $modules_to_register = array_merge($modules_to_register, $caffeinated_modules_to_register); |
|
239 | + } |
|
240 | + } |
|
241 | + return $modules_to_register; |
|
242 | + } |
|
243 | + |
|
244 | + |
|
245 | + /** |
|
246 | + * @throws EE_Error |
|
247 | + * @throws InvalidArgumentException |
|
248 | + * @throws ReflectionException |
|
249 | + * @throws InvalidDataTypeException |
|
250 | + * @throws InvalidInterfaceException |
|
251 | + */ |
|
252 | + public function caffeinated_init() |
|
253 | + { |
|
254 | + // Custom Post Type hooks |
|
255 | + add_filter( |
|
256 | + 'FHEE__EventEspresso_core_domain_entities_custom_post_types_TaxonomyDefinitions__getTaxonomies', |
|
257 | + array($this, 'filter_taxonomies') |
|
258 | + ); |
|
259 | + add_filter( |
|
260 | + 'FHEE__EventEspresso_core_domain_entities_custom_post_types_CustomPostTypeDefinitions__getCustomPostTypes', |
|
261 | + array($this, 'filter_cpts') |
|
262 | + ); |
|
263 | + add_filter( |
|
264 | + 'FHEE__EE_Admin__get_extra_nav_menu_pages_items', |
|
265 | + array($this, 'nav_metabox_items') |
|
266 | + ); |
|
267 | + EE_Registry::instance()->load_file( |
|
268 | + EE_CAFF_PATH, |
|
269 | + 'EE_Caf_Messages', |
|
270 | + 'class', |
|
271 | + array(), |
|
272 | + false |
|
273 | + ); |
|
274 | + // caffeinated_init__complete hook |
|
275 | + do_action('AHEE__EE_Brewing_Regular__caffeinated_init__complete'); |
|
276 | + } |
|
277 | + |
|
278 | + |
|
279 | + public function enqueue_caffeinated_scripts() |
|
280 | + { |
|
281 | + // sound of crickets... |
|
282 | + } |
|
283 | + |
|
284 | + |
|
285 | + /** |
|
286 | + * callbacks below here |
|
287 | + * |
|
288 | + * @param array $taxonomy_array |
|
289 | + * @return array |
|
290 | + */ |
|
291 | + public function filter_taxonomies(array $taxonomy_array) |
|
292 | + { |
|
293 | + $taxonomy_array['espresso_venue_categories']['args']['show_in_nav_menus'] = true; |
|
294 | + return $taxonomy_array; |
|
295 | + } |
|
296 | + |
|
297 | + |
|
298 | + /** |
|
299 | + * @param array $cpt_array |
|
300 | + * @return mixed |
|
301 | + */ |
|
302 | + public function filter_cpts(array $cpt_array) |
|
303 | + { |
|
304 | + $cpt_array['espresso_venues']['args']['show_in_nav_menus'] = true; |
|
305 | + return $cpt_array; |
|
306 | + } |
|
307 | + |
|
308 | + |
|
309 | + /** |
|
310 | + * @param array $menuitems |
|
311 | + * @return array |
|
312 | + */ |
|
313 | + public function nav_metabox_items(array $menuitems) |
|
314 | + { |
|
315 | + $menuitems[] = array( |
|
316 | + 'title' => __('Venue List', 'event_espresso'), |
|
317 | + 'url' => get_post_type_archive_link('espresso_venues'), |
|
318 | + 'description' => __('Archive page for all venues.', 'event_espresso'), |
|
319 | + ); |
|
320 | + return $menuitems; |
|
321 | + } |
|
322 | + |
|
323 | + |
|
324 | + /** |
|
325 | + * Gets the injected table analyzer, or throws an exception |
|
326 | + * |
|
327 | + * @return TableAnalysis |
|
328 | + * @throws \EE_Error |
|
329 | + */ |
|
330 | + protected function _get_table_analysis() |
|
331 | + { |
|
332 | + if ($this->_table_analysis instanceof TableAnalysis) { |
|
333 | + return $this->_table_analysis; |
|
334 | + } else { |
|
335 | + throw new \EE_Error( |
|
336 | + sprintf( |
|
337 | + __('Table analysis class on class %1$s is not set properly.', 'event_espresso'), |
|
338 | + get_class($this) |
|
339 | + ) |
|
340 | + ); |
|
341 | + } |
|
342 | + } |
|
343 | 343 | } |
344 | 344 | |
345 | 345 | |
346 | 346 | $brewing = new EE_Brewing_Regular( |
347 | - EE_Registry::instance()->create('TableAnalysis', array(), true) |
|
347 | + EE_Registry::instance()->create('TableAnalysis', array(), true) |
|
348 | 348 | ); |
@@ -11,10 +11,10 @@ discard block |
||
11 | 11 | * define and use the hook in a specific caffeinated/whatever class or file. |
12 | 12 | */ |
13 | 13 | // defined some new constants related to caffeinated folder |
14 | -define('EE_CAF_URL', EE_PLUGIN_DIR_URL . 'caffeinated/'); |
|
15 | -define('EE_CAF_CORE', EE_CAFF_PATH . 'core' . DS); |
|
16 | -define('EE_CAF_LIBRARIES', EE_CAF_CORE . 'libraries' . DS); |
|
17 | -define('EE_CAF_PAYMENT_METHODS', EE_CAFF_PATH . 'payment_methods' . DS); |
|
14 | +define('EE_CAF_URL', EE_PLUGIN_DIR_URL.'caffeinated/'); |
|
15 | +define('EE_CAF_CORE', EE_CAFF_PATH.'core'.DS); |
|
16 | +define('EE_CAF_LIBRARIES', EE_CAF_CORE.'libraries'.DS); |
|
17 | +define('EE_CAF_PAYMENT_METHODS', EE_CAFF_PATH.'payment_methods'.DS); |
|
18 | 18 | |
19 | 19 | |
20 | 20 | /** |
@@ -64,11 +64,11 @@ discard block |
||
64 | 64 | add_filter('FHEE__EE_Registry__load_helper__helper_paths', array($this, 'caf_helper_paths'), 10); |
65 | 65 | add_filter( |
66 | 66 | 'AHEE__EE_System__load_core_configuration__complete', |
67 | - function () { |
|
67 | + function() { |
|
68 | 68 | EE_Register_Payment_Method::register( |
69 | 69 | 'caffeinated_payment_methods', |
70 | 70 | array( |
71 | - 'payment_method_paths' => glob(EE_CAF_PAYMENT_METHODS . '*', GLOB_ONLYDIR), |
|
71 | + 'payment_method_paths' => glob(EE_CAF_PAYMENT_METHODS.'*', GLOB_ONLYDIR), |
|
72 | 72 | ) |
73 | 73 | ); |
74 | 74 | } |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | */ |
124 | 124 | public function caf_helper_paths($paths) |
125 | 125 | { |
126 | - $paths[] = EE_CAF_CORE . 'helpers' . DS; |
|
126 | + $paths[] = EE_CAF_CORE.'helpers'.DS; |
|
127 | 127 | return $paths; |
128 | 128 | } |
129 | 129 | |
@@ -144,10 +144,10 @@ discard block |
||
144 | 144 | global $wpdb; |
145 | 145 | // use same method of getting creator id as the version introducing the change |
146 | 146 | $default_creator_id = apply_filters('FHEE__EE_DMS_Core_4_5_0__get_default_creator_id', get_current_user_id()); |
147 | - $price_type_table = $wpdb->prefix . "esp_price_type"; |
|
148 | - $price_table = $wpdb->prefix . "esp_price"; |
|
147 | + $price_type_table = $wpdb->prefix."esp_price_type"; |
|
148 | + $price_table = $wpdb->prefix."esp_price"; |
|
149 | 149 | if ($this->_get_table_analysis()->tableExists($price_type_table)) { |
150 | - $SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table . ' WHERE PBT_ID=4';// include trashed price types |
|
150 | + $SQL = 'SELECT COUNT(PRT_ID) FROM '.$price_type_table.' WHERE PBT_ID=4'; // include trashed price types |
|
151 | 151 | $tax_price_type_count = $wpdb->get_var($SQL); |
152 | 152 | if ($tax_price_type_count <= 1) { |
153 | 153 | $wpdb->insert( |
@@ -161,11 +161,11 @@ discard block |
||
161 | 161 | 'PRT_wp_user' => $default_creator_id, |
162 | 162 | ), |
163 | 163 | array( |
164 | - '%s',// PRT_name |
|
165 | - '%d',// PBT_id |
|
166 | - '%d',// PRT_is_percent |
|
167 | - '%d',// PRT_order |
|
168 | - '%d',// PRT_deleted |
|
164 | + '%s', // PRT_name |
|
165 | + '%d', // PBT_id |
|
166 | + '%d', // PRT_is_percent |
|
167 | + '%d', // PRT_order |
|
168 | + '%d', // PRT_deleted |
|
169 | 169 | '%d', // PRT_wp_user |
170 | 170 | ) |
171 | 171 | ); |
@@ -181,11 +181,11 @@ discard block |
||
181 | 181 | 'PRT_wp_user' => $default_creator_id, |
182 | 182 | ), |
183 | 183 | array( |
184 | - '%s',// PRT_name |
|
185 | - '%d',// PBT_id |
|
186 | - '%d',// PRT_is_percent |
|
187 | - '%d',// PRT_order |
|
188 | - '%d',// PRT_deleted |
|
184 | + '%s', // PRT_name |
|
185 | + '%d', // PBT_id |
|
186 | + '%d', // PRT_is_percent |
|
187 | + '%d', // PRT_order |
|
188 | + '%d', // PRT_deleted |
|
189 | 189 | '%d' // PRT_wp_user |
190 | 190 | ) |
191 | 191 | ); |
@@ -205,15 +205,15 @@ discard block |
||
205 | 205 | 'PRC_wp_user' => $default_creator_id, |
206 | 206 | ), |
207 | 207 | array( |
208 | - '%d',// PRT_id |
|
209 | - '%f',// PRC_amount |
|
210 | - '%s',// PRC_name |
|
211 | - '%s',// PRC_desc |
|
212 | - '%d',// PRC_is_default |
|
213 | - '%d',// PRC_overrides |
|
214 | - '%d',// PRC_deleted |
|
215 | - '%d',// PRC_order |
|
216 | - '%d',// PRC_parent |
|
208 | + '%d', // PRT_id |
|
209 | + '%f', // PRC_amount |
|
210 | + '%s', // PRC_name |
|
211 | + '%s', // PRC_desc |
|
212 | + '%d', // PRC_is_default |
|
213 | + '%d', // PRC_overrides |
|
214 | + '%d', // PRC_deleted |
|
215 | + '%d', // PRC_order |
|
216 | + '%d', // PRC_parent |
|
217 | 217 | '%d' // PRC_wp_user |
218 | 218 | ) |
219 | 219 | ); |
@@ -232,8 +232,8 @@ discard block |
||
232 | 232 | */ |
233 | 233 | public function caffeinated_modules_to_register($modules_to_register = array()) |
234 | 234 | { |
235 | - if (is_readable(EE_CAFF_PATH . 'modules')) { |
|
236 | - $caffeinated_modules_to_register = glob(EE_CAFF_PATH . 'modules' . DS . '*', GLOB_ONLYDIR); |
|
235 | + if (is_readable(EE_CAFF_PATH.'modules')) { |
|
236 | + $caffeinated_modules_to_register = glob(EE_CAFF_PATH.'modules'.DS.'*', GLOB_ONLYDIR); |
|
237 | 237 | if (is_array($caffeinated_modules_to_register) && ! empty($caffeinated_modules_to_register)) { |
238 | 238 | $modules_to_register = array_merge($modules_to_register, $caffeinated_modules_to_register); |
239 | 239 | } |
@@ -7,16 +7,16 @@ discard block |
||
7 | 7 | define('EE_SUPPORT_EMAIL', '[email protected]'); |
8 | 8 | // used to be DIRECTORY_SEPARATOR, but that caused issues on windows |
9 | 9 | if (! defined('DS')) { |
10 | - define('DS', '/'); |
|
10 | + define('DS', '/'); |
|
11 | 11 | } |
12 | 12 | if (! defined('PS')) { |
13 | - define('PS', PATH_SEPARATOR); |
|
13 | + define('PS', PATH_SEPARATOR); |
|
14 | 14 | } |
15 | 15 | if (! defined('SP')) { |
16 | - define('SP', ' '); |
|
16 | + define('SP', ' '); |
|
17 | 17 | } |
18 | 18 | if (! defined('EENL')) { |
19 | - define('EENL', "\n"); |
|
19 | + define('EENL', "\n"); |
|
20 | 20 | } |
21 | 21 | // define the plugin directory and URL |
22 | 22 | define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE)); |
@@ -70,16 +70,16 @@ discard block |
||
70 | 70 | define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages' . DS); |
71 | 71 | // check for DOMPDF fonts in uploads |
72 | 72 | if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS)) { |
73 | - define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS); |
|
73 | + define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS); |
|
74 | 74 | } |
75 | 75 | // ajax constants |
76 | 76 | define( |
77 | - 'EE_FRONT_AJAX', |
|
78 | - isset($_REQUEST['ee_front_ajax']) || isset($_REQUEST['data']['ee_front_ajax']) |
|
77 | + 'EE_FRONT_AJAX', |
|
78 | + isset($_REQUEST['ee_front_ajax']) || isset($_REQUEST['data']['ee_front_ajax']) |
|
79 | 79 | ); |
80 | 80 | define( |
81 | - 'EE_ADMIN_AJAX', |
|
82 | - isset($_REQUEST['ee_admin_ajax']) || isset($_REQUEST['data']['ee_admin_ajax']) |
|
81 | + 'EE_ADMIN_AJAX', |
|
82 | + isset($_REQUEST['ee_admin_ajax']) || isset($_REQUEST['data']['ee_admin_ajax']) |
|
83 | 83 | ); |
84 | 84 | // just a handy constant occasionally needed for finding values representing infinity in the DB |
85 | 85 | // you're better to use this than its straight value (currently -1) in case you ever |
@@ -87,9 +87,9 @@ discard block |
||
87 | 87 | define('EE_INF_IN_DB', -1); |
88 | 88 | define('EE_INF', INF > (float) PHP_INT_MAX ? INF : PHP_INT_MAX); |
89 | 89 | if (! defined('EE_DEBUG')) { |
90 | - define('EE_DEBUG', false); |
|
90 | + define('EE_DEBUG', false); |
|
91 | 91 | } |
92 | 92 | // for older WP versions |
93 | 93 | if (! defined('MONTH_IN_SECONDS')) { |
94 | - define('MONTH_IN_SECONDS', DAY_IN_SECONDS * 30); |
|
94 | + define('MONTH_IN_SECONDS', DAY_IN_SECONDS * 30); |
|
95 | 95 | } |
@@ -6,71 +6,71 @@ discard block |
||
6 | 6 | define('EE_MIN_PHP_VER_RECOMMENDED', '5.6.32'); |
7 | 7 | define('EE_SUPPORT_EMAIL', '[email protected]'); |
8 | 8 | // used to be DIRECTORY_SEPARATOR, but that caused issues on windows |
9 | -if (! defined('DS')) { |
|
9 | +if ( ! defined('DS')) { |
|
10 | 10 | define('DS', '/'); |
11 | 11 | } |
12 | -if (! defined('PS')) { |
|
12 | +if ( ! defined('PS')) { |
|
13 | 13 | define('PS', PATH_SEPARATOR); |
14 | 14 | } |
15 | -if (! defined('SP')) { |
|
15 | +if ( ! defined('SP')) { |
|
16 | 16 | define('SP', ' '); |
17 | 17 | } |
18 | -if (! defined('EENL')) { |
|
18 | +if ( ! defined('EENL')) { |
|
19 | 19 | define('EENL', "\n"); |
20 | 20 | } |
21 | 21 | // define the plugin directory and URL |
22 | 22 | define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE)); |
23 | -define('EE_PLUGIN_DIR_PATH', dirname(EVENT_ESPRESSO_MAIN_FILE) . DS); |
|
23 | +define('EE_PLUGIN_DIR_PATH', dirname(EVENT_ESPRESSO_MAIN_FILE).DS); |
|
24 | 24 | define('EE_PLUGIN_DIR_URL', plugin_dir_url(EVENT_ESPRESSO_MAIN_FILE)); |
25 | 25 | // main root folder paths |
26 | -define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH . 'admin_pages' . DS); |
|
27 | -define('EE_CORE', EE_PLUGIN_DIR_PATH . 'core' . DS); |
|
28 | -define('EE_MODULES', EE_PLUGIN_DIR_PATH . 'modules' . DS); |
|
29 | -define('EE_PUBLIC', EE_PLUGIN_DIR_PATH . 'public' . DS); |
|
30 | -define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH . 'shortcodes' . DS); |
|
31 | -define('EE_WIDGETS', EE_PLUGIN_DIR_PATH . 'widgets' . DS); |
|
32 | -define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH . 'payment_methods' . DS); |
|
33 | -define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH . 'caffeinated' . DS); |
|
26 | +define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH.'admin_pages'.DS); |
|
27 | +define('EE_CORE', EE_PLUGIN_DIR_PATH.'core'.DS); |
|
28 | +define('EE_MODULES', EE_PLUGIN_DIR_PATH.'modules'.DS); |
|
29 | +define('EE_PUBLIC', EE_PLUGIN_DIR_PATH.'public'.DS); |
|
30 | +define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH.'shortcodes'.DS); |
|
31 | +define('EE_WIDGETS', EE_PLUGIN_DIR_PATH.'widgets'.DS); |
|
32 | +define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH.'payment_methods'.DS); |
|
33 | +define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH.'caffeinated'.DS); |
|
34 | 34 | // core system paths |
35 | -define('EE_ADMIN', EE_CORE . 'admin' . DS); |
|
36 | -define('EE_CPTS', EE_CORE . 'CPTs' . DS); |
|
37 | -define('EE_CLASSES', EE_CORE . 'db_classes' . DS); |
|
38 | -define('EE_INTERFACES', EE_CORE . 'interfaces' . DS); |
|
39 | -define('EE_BUSINESS', EE_CORE . 'business' . DS); |
|
40 | -define('EE_MODELS', EE_CORE . 'db_models' . DS); |
|
41 | -define('EE_HELPERS', EE_CORE . 'helpers' . DS); |
|
42 | -define('EE_LIBRARIES', EE_CORE . 'libraries' . DS); |
|
43 | -define('EE_TEMPLATES', EE_CORE . 'templates' . DS); |
|
44 | -define('EE_THIRD_PARTY', EE_CORE . 'third_party_libs' . DS); |
|
45 | -define('EE_GLOBAL_ASSETS', EE_TEMPLATES . 'global_assets' . DS); |
|
46 | -define('EE_FORM_SECTIONS', EE_LIBRARIES . 'form_sections' . DS); |
|
35 | +define('EE_ADMIN', EE_CORE.'admin'.DS); |
|
36 | +define('EE_CPTS', EE_CORE.'CPTs'.DS); |
|
37 | +define('EE_CLASSES', EE_CORE.'db_classes'.DS); |
|
38 | +define('EE_INTERFACES', EE_CORE.'interfaces'.DS); |
|
39 | +define('EE_BUSINESS', EE_CORE.'business'.DS); |
|
40 | +define('EE_MODELS', EE_CORE.'db_models'.DS); |
|
41 | +define('EE_HELPERS', EE_CORE.'helpers'.DS); |
|
42 | +define('EE_LIBRARIES', EE_CORE.'libraries'.DS); |
|
43 | +define('EE_TEMPLATES', EE_CORE.'templates'.DS); |
|
44 | +define('EE_THIRD_PARTY', EE_CORE.'third_party_libs'.DS); |
|
45 | +define('EE_GLOBAL_ASSETS', EE_TEMPLATES.'global_assets'.DS); |
|
46 | +define('EE_FORM_SECTIONS', EE_LIBRARIES.'form_sections'.DS); |
|
47 | 47 | // gateways |
48 | -define('EE_GATEWAYS', EE_MODULES . 'gateways' . DS); |
|
49 | -define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL . 'modules' . DS . 'gateways' . DS); |
|
48 | +define('EE_GATEWAYS', EE_MODULES.'gateways'.DS); |
|
49 | +define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL.'modules'.DS.'gateways'.DS); |
|
50 | 50 | // asset URL paths |
51 | -define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'templates' . DS); |
|
52 | -define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL . 'global_assets' . DS); |
|
53 | -define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL . 'images' . DS); |
|
54 | -define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'third_party_libs' . DS); |
|
55 | -define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL . 'core/helpers/assets/'); |
|
56 | -define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL . 'core/libraries/'); |
|
51 | +define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL.'core'.DS.'templates'.DS); |
|
52 | +define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL.'global_assets'.DS); |
|
53 | +define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL.'images'.DS); |
|
54 | +define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL.'core'.DS.'third_party_libs'.DS); |
|
55 | +define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL.'core/helpers/assets/'); |
|
56 | +define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL.'core/libraries/'); |
|
57 | 57 | // define upload paths |
58 | 58 | $uploads = wp_upload_dir(); |
59 | 59 | // define the uploads directory and URL |
60 | -define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'] . DS . 'espresso' . DS); |
|
61 | -define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'] . DS . 'espresso' . DS); |
|
60 | +define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'].DS.'espresso'.DS); |
|
61 | +define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'].DS.'espresso'.DS); |
|
62 | 62 | // define the templates directory and URL |
63 | -define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'] . DS . 'espresso' . DS . 'templates' . DS); |
|
64 | -define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'] . DS . 'espresso' . DS . 'templates' . DS); |
|
63 | +define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'].DS.'espresso'.DS.'templates'.DS); |
|
64 | +define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'].DS.'espresso'.DS.'templates'.DS); |
|
65 | 65 | // define the gateway directory and URL |
66 | -define('EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'] . DS . 'espresso' . DS . 'gateways' . DS); |
|
67 | -define('EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'] . DS . 'espresso' . DS . 'gateways' . DS); |
|
66 | +define('EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'].DS.'espresso'.DS.'gateways'.DS); |
|
67 | +define('EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'].DS.'espresso'.DS.'gateways'.DS); |
|
68 | 68 | // languages folder/path |
69 | -define('EE_LANGUAGES_SAFE_LOC', '..' . DS . 'uploads' . DS . 'espresso' . DS . 'languages' . DS); |
|
70 | -define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages' . DS); |
|
69 | +define('EE_LANGUAGES_SAFE_LOC', '..'.DS.'uploads'.DS.'espresso'.DS.'languages'.DS); |
|
70 | +define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'languages'.DS); |
|
71 | 71 | // check for DOMPDF fonts in uploads |
72 | -if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS)) { |
|
73 | - define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS); |
|
72 | +if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS)) { |
|
73 | + define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS); |
|
74 | 74 | } |
75 | 75 | // ajax constants |
76 | 76 | define( |
@@ -86,10 +86,10 @@ discard block |
||
86 | 86 | // want to change its default value! or find when -1 means infinity |
87 | 87 | define('EE_INF_IN_DB', -1); |
88 | 88 | define('EE_INF', INF > (float) PHP_INT_MAX ? INF : PHP_INT_MAX); |
89 | -if (! defined('EE_DEBUG')) { |
|
89 | +if ( ! defined('EE_DEBUG')) { |
|
90 | 90 | define('EE_DEBUG', false); |
91 | 91 | } |
92 | 92 | // for older WP versions |
93 | -if (! defined('MONTH_IN_SECONDS')) { |
|
93 | +if ( ! defined('MONTH_IN_SECONDS')) { |
|
94 | 94 | define('MONTH_IN_SECONDS', DAY_IN_SECONDS * 30); |
95 | 95 | } |
@@ -38,103 +38,103 @@ |
||
38 | 38 | * @since 4.0 |
39 | 39 | */ |
40 | 40 | if (function_exists('espresso_version')) { |
41 | - if (! function_exists('espresso_duplicate_plugin_error')) { |
|
42 | - /** |
|
43 | - * espresso_duplicate_plugin_error |
|
44 | - * displays if more than one version of EE is activated at the same time |
|
45 | - */ |
|
46 | - function espresso_duplicate_plugin_error() |
|
47 | - { |
|
48 | - ?> |
|
41 | + if (! function_exists('espresso_duplicate_plugin_error')) { |
|
42 | + /** |
|
43 | + * espresso_duplicate_plugin_error |
|
44 | + * displays if more than one version of EE is activated at the same time |
|
45 | + */ |
|
46 | + function espresso_duplicate_plugin_error() |
|
47 | + { |
|
48 | + ?> |
|
49 | 49 | <div class="error"> |
50 | 50 | <p> |
51 | 51 | <?php |
52 | - echo esc_html__( |
|
53 | - 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', |
|
54 | - 'event_espresso' |
|
55 | - ); ?> |
|
52 | + echo esc_html__( |
|
53 | + 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', |
|
54 | + 'event_espresso' |
|
55 | + ); ?> |
|
56 | 56 | </p> |
57 | 57 | </div> |
58 | 58 | <?php |
59 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
60 | - } |
|
61 | - } |
|
62 | - add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
59 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
60 | + } |
|
61 | + } |
|
62 | + add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
63 | 63 | } else { |
64 | - define('EE_MIN_PHP_VER_REQUIRED', '5.4.0'); |
|
65 | - if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
66 | - /** |
|
67 | - * espresso_minimum_php_version_error |
|
68 | - * |
|
69 | - * @return void |
|
70 | - */ |
|
71 | - function espresso_minimum_php_version_error() |
|
72 | - { |
|
73 | - ?> |
|
64 | + define('EE_MIN_PHP_VER_REQUIRED', '5.4.0'); |
|
65 | + if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
66 | + /** |
|
67 | + * espresso_minimum_php_version_error |
|
68 | + * |
|
69 | + * @return void |
|
70 | + */ |
|
71 | + function espresso_minimum_php_version_error() |
|
72 | + { |
|
73 | + ?> |
|
74 | 74 | <div class="error"> |
75 | 75 | <p> |
76 | 76 | <?php |
77 | - printf( |
|
78 | - esc_html__( |
|
79 | - 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
80 | - 'event_espresso' |
|
81 | - ), |
|
82 | - EE_MIN_PHP_VER_REQUIRED, |
|
83 | - PHP_VERSION, |
|
84 | - '<br/>', |
|
85 | - '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
86 | - ); |
|
87 | - ?> |
|
77 | + printf( |
|
78 | + esc_html__( |
|
79 | + 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
80 | + 'event_espresso' |
|
81 | + ), |
|
82 | + EE_MIN_PHP_VER_REQUIRED, |
|
83 | + PHP_VERSION, |
|
84 | + '<br/>', |
|
85 | + '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
86 | + ); |
|
87 | + ?> |
|
88 | 88 | </p> |
89 | 89 | </div> |
90 | 90 | <?php |
91 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
92 | - } |
|
91 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
92 | + } |
|
93 | 93 | |
94 | - add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
95 | - } else { |
|
96 | - define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
97 | - /** |
|
98 | - * espresso_version |
|
99 | - * Returns the plugin version |
|
100 | - * |
|
101 | - * @return string |
|
102 | - */ |
|
103 | - function espresso_version() |
|
104 | - { |
|
105 | - return apply_filters('FHEE__espresso__espresso_version', '4.9.80.rc.086'); |
|
106 | - } |
|
94 | + add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
95 | + } else { |
|
96 | + define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
97 | + /** |
|
98 | + * espresso_version |
|
99 | + * Returns the plugin version |
|
100 | + * |
|
101 | + * @return string |
|
102 | + */ |
|
103 | + function espresso_version() |
|
104 | + { |
|
105 | + return apply_filters('FHEE__espresso__espresso_version', '4.9.80.rc.086'); |
|
106 | + } |
|
107 | 107 | |
108 | - /** |
|
109 | - * espresso_plugin_activation |
|
110 | - * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
111 | - */ |
|
112 | - function espresso_plugin_activation() |
|
113 | - { |
|
114 | - update_option('ee_espresso_activation', true); |
|
115 | - } |
|
108 | + /** |
|
109 | + * espresso_plugin_activation |
|
110 | + * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
111 | + */ |
|
112 | + function espresso_plugin_activation() |
|
113 | + { |
|
114 | + update_option('ee_espresso_activation', true); |
|
115 | + } |
|
116 | 116 | |
117 | - register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
117 | + register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
118 | 118 | |
119 | - require_once __DIR__ . '/core/bootstrap_espresso.php'; |
|
120 | - bootstrap_espresso(); |
|
121 | - } |
|
119 | + require_once __DIR__ . '/core/bootstrap_espresso.php'; |
|
120 | + bootstrap_espresso(); |
|
121 | + } |
|
122 | 122 | } |
123 | 123 | if (! function_exists('espresso_deactivate_plugin')) { |
124 | - /** |
|
125 | - * deactivate_plugin |
|
126 | - * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
127 | - * |
|
128 | - * @access public |
|
129 | - * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
130 | - * @return void |
|
131 | - */ |
|
132 | - function espresso_deactivate_plugin($plugin_basename = '') |
|
133 | - { |
|
134 | - if (! function_exists('deactivate_plugins')) { |
|
135 | - require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
136 | - } |
|
137 | - unset($_GET['activate'], $_REQUEST['activate']); |
|
138 | - deactivate_plugins($plugin_basename); |
|
139 | - } |
|
124 | + /** |
|
125 | + * deactivate_plugin |
|
126 | + * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
127 | + * |
|
128 | + * @access public |
|
129 | + * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
130 | + * @return void |
|
131 | + */ |
|
132 | + function espresso_deactivate_plugin($plugin_basename = '') |
|
133 | + { |
|
134 | + if (! function_exists('deactivate_plugins')) { |
|
135 | + require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
136 | + } |
|
137 | + unset($_GET['activate'], $_REQUEST['activate']); |
|
138 | + deactivate_plugins($plugin_basename); |
|
139 | + } |
|
140 | 140 | } |
@@ -52,11 +52,11 @@ discard block |
||
52 | 52 | protected function _migration_step($num_items = 1) |
53 | 53 | { |
54 | 54 | // if this isn't set then something is really wrong |
55 | - if (! EE_Config::instance()->gateway instanceof EE_Gateway_Config) { |
|
55 | + if ( ! EE_Config::instance()->gateway instanceof EE_Gateway_Config) { |
|
56 | 56 | throw new EE_Error(__('It appears the Event Espresso Core Configuration is not setup correctly.', 'event_espresso')); |
57 | 57 | } |
58 | 58 | $invoice_settings = isset(EE_Config::instance()->gateway->payment_settings['Invoice']) ? EE_Config::instance()->gateway->payment_settings['Invoice'] : null; |
59 | - if (! $invoice_settings) { |
|
59 | + if ( ! $invoice_settings) { |
|
60 | 60 | $this->add_error(__('Could not migrate EE4.4 invoice settings to EE4.5 because they didnt exist', 'event_espresso')); |
61 | 61 | } else { |
62 | 62 | $invoice_settings['template_payment_instructions'] = $invoice_settings['pdf_instructions']; |
@@ -89,8 +89,8 @@ discard block |
||
89 | 89 | ); |
90 | 90 | } |
91 | 91 | $templates_relative_path = 'modules/gateways/Invoice/lib/templates/'; |
92 | - $overridden_invoice_body = EEH_Template::locate_template($templates_relative_path . 'invoice_body.template.php', null, false, false, true); |
|
93 | - $overridden_receipt_body= EEH_Template::locate_template($templates_relative_path . 'receipt_body.template.php', null, false, false, true); |
|
92 | + $overridden_invoice_body = EEH_Template::locate_template($templates_relative_path.'invoice_body.template.php', null, false, false, true); |
|
93 | + $overridden_receipt_body = EEH_Template::locate_template($templates_relative_path.'receipt_body.template.php', null, false, false, true); |
|
94 | 94 | if ($overridden_invoice_body || $overridden_receipt_body) { |
95 | 95 | new PersistentAdminNotice( |
96 | 96 | 'invoice_overriding_templates', |
@@ -15,95 +15,95 @@ |
||
15 | 15 | class EE_DMS_4_5_0_invoice_settings extends EE_Data_Migration_Script_Stage |
16 | 16 | { |
17 | 17 | |
18 | - /** |
|
19 | - * Just initializes the status of the migration |
|
20 | - */ |
|
21 | - public function __construct() |
|
22 | - { |
|
23 | - $this->_pretty_name = __('Update Invoice Gateway Settings', 'event_espresso'); |
|
24 | - parent::__construct(); |
|
25 | - } |
|
18 | + /** |
|
19 | + * Just initializes the status of the migration |
|
20 | + */ |
|
21 | + public function __construct() |
|
22 | + { |
|
23 | + $this->_pretty_name = __('Update Invoice Gateway Settings', 'event_espresso'); |
|
24 | + parent::__construct(); |
|
25 | + } |
|
26 | 26 | |
27 | 27 | |
28 | 28 | |
29 | - /** |
|
30 | - * _count_records_to_migrate |
|
31 | - * Counts the records to migrate; the public version may cache it |
|
32 | - * |
|
33 | - * @access protected |
|
34 | - * @return int |
|
35 | - */ |
|
36 | - protected function _count_records_to_migrate() |
|
37 | - { |
|
38 | - return 1; |
|
39 | - } |
|
29 | + /** |
|
30 | + * _count_records_to_migrate |
|
31 | + * Counts the records to migrate; the public version may cache it |
|
32 | + * |
|
33 | + * @access protected |
|
34 | + * @return int |
|
35 | + */ |
|
36 | + protected function _count_records_to_migrate() |
|
37 | + { |
|
38 | + return 1; |
|
39 | + } |
|
40 | 40 | |
41 | 41 | |
42 | 42 | |
43 | - /** |
|
44 | - * _migration_step |
|
45 | - * |
|
46 | - * @access protected |
|
47 | - * @param int $num_items |
|
48 | - * @throws EE_Error |
|
49 | - * @return int number of items ACTUALLY migrated |
|
50 | - * @throws InvalidDataTypeException |
|
51 | - */ |
|
52 | - protected function _migration_step($num_items = 1) |
|
53 | - { |
|
54 | - // if this isn't set then something is really wrong |
|
55 | - if (! EE_Config::instance()->gateway instanceof EE_Gateway_Config) { |
|
56 | - throw new EE_Error(__('It appears the Event Espresso Core Configuration is not setup correctly.', 'event_espresso')); |
|
57 | - } |
|
58 | - $invoice_settings = isset(EE_Config::instance()->gateway->payment_settings['Invoice']) ? EE_Config::instance()->gateway->payment_settings['Invoice'] : null; |
|
59 | - if (! $invoice_settings) { |
|
60 | - $this->add_error(__('Could not migrate EE4.4 invoice settings to EE4.5 because they didnt exist', 'event_espresso')); |
|
61 | - } else { |
|
62 | - $invoice_settings['template_payment_instructions'] = $invoice_settings['pdf_instructions']; |
|
63 | - $invoice_settings['template_invoice_payee_name'] = $invoice_settings['payable_to']; |
|
64 | - $invoice_settings['template_invoice_address'] = $invoice_settings['payment_address']; |
|
65 | - $invoice_settings['template_invoice_email'] = ''; |
|
66 | - $invoice_settings['template_invoice_tax_number'] = ''; |
|
67 | - unset($invoice_settings['pdf_instructions']); |
|
68 | - unset($invoice_settings['payable_to']); |
|
69 | - unset($invoice_settings['payment_address']); |
|
70 | - EE_Config::instance()->gateway->payment_settings['Invoice'] = $invoice_settings; |
|
71 | - EE_Config::instance()->update_espresso_config(false, false); |
|
43 | + /** |
|
44 | + * _migration_step |
|
45 | + * |
|
46 | + * @access protected |
|
47 | + * @param int $num_items |
|
48 | + * @throws EE_Error |
|
49 | + * @return int number of items ACTUALLY migrated |
|
50 | + * @throws InvalidDataTypeException |
|
51 | + */ |
|
52 | + protected function _migration_step($num_items = 1) |
|
53 | + { |
|
54 | + // if this isn't set then something is really wrong |
|
55 | + if (! EE_Config::instance()->gateway instanceof EE_Gateway_Config) { |
|
56 | + throw new EE_Error(__('It appears the Event Espresso Core Configuration is not setup correctly.', 'event_espresso')); |
|
57 | + } |
|
58 | + $invoice_settings = isset(EE_Config::instance()->gateway->payment_settings['Invoice']) ? EE_Config::instance()->gateway->payment_settings['Invoice'] : null; |
|
59 | + if (! $invoice_settings) { |
|
60 | + $this->add_error(__('Could not migrate EE4.4 invoice settings to EE4.5 because they didnt exist', 'event_espresso')); |
|
61 | + } else { |
|
62 | + $invoice_settings['template_payment_instructions'] = $invoice_settings['pdf_instructions']; |
|
63 | + $invoice_settings['template_invoice_payee_name'] = $invoice_settings['payable_to']; |
|
64 | + $invoice_settings['template_invoice_address'] = $invoice_settings['payment_address']; |
|
65 | + $invoice_settings['template_invoice_email'] = ''; |
|
66 | + $invoice_settings['template_invoice_tax_number'] = ''; |
|
67 | + unset($invoice_settings['pdf_instructions']); |
|
68 | + unset($invoice_settings['payable_to']); |
|
69 | + unset($invoice_settings['payment_address']); |
|
70 | + EE_Config::instance()->gateway->payment_settings['Invoice'] = $invoice_settings; |
|
71 | + EE_Config::instance()->update_espresso_config(false, false); |
|
72 | 72 | |
73 | - // @todo: check 'invoice_css' too because we can't easily affect that so we might need to set a persistent notice |
|
74 | - // (why is it tough to change? because we want to update the receipt and invoice message template, but |
|
75 | - // message templates are only initialized AFTER migrations and those two are new in 4.5. So if we wanted to |
|
76 | - // update them from a DMS, we'd need to have the DMS create the message templates which is quite a lot of code; |
|
77 | - // also we don't want to build a dependency on the messages code because it is likely to change soon |
|
78 | - if (isset($invoice_settings['invoice_css']) |
|
79 | - && ! in_array($invoice_settings['invoice_css'], ['', 'simple.css'])) { |
|
80 | - new PersistentAdminNotice( |
|
81 | - 'invoice_css_not_updated', |
|
82 | - sprintf( |
|
83 | - esc_html__( |
|
84 | - 'You had previously set your Invoice Payment Method\'s stylesheet to be %1$s, but that setting has moved. PDF and HTML Invoices and Receipts are now Messages, which means you can easily modify them from your Wordpress Dashboard instead of using filters or uploading template files. Please visit Messages -> Receipt and Messages -> Invoice to change their stylesheets.', |
|
85 | - 'event_espresso' |
|
86 | - ), |
|
87 | - $invoice_settings['invoice_css'] |
|
88 | - ) |
|
89 | - ); |
|
90 | - } |
|
91 | - $templates_relative_path = 'modules/gateways/Invoice/lib/templates/'; |
|
92 | - $overridden_invoice_body = EEH_Template::locate_template($templates_relative_path . 'invoice_body.template.php', null, false, false, true); |
|
93 | - $overridden_receipt_body= EEH_Template::locate_template($templates_relative_path . 'receipt_body.template.php', null, false, false, true); |
|
94 | - if ($overridden_invoice_body || $overridden_receipt_body) { |
|
95 | - new PersistentAdminNotice( |
|
96 | - 'invoice_overriding_templates', |
|
97 | - esc_html__( |
|
98 | - 'Note: in this version of Event Espresso, PDF and HTML Invoices and Receipts are now Messages and can be changed just like any other messages; however we noticed you had previously overridden the old default Invoice/Receipt templates. Because of this, your old Invoice/Receipt templates will continue to be used INSTEAD of the new Invoice/Receipt message equivalents. We recommend deleting your old Invoice/Receipt templates and modifying the new Invoice and Receipt messages\'s content in Messages -> Invoice and Messages -> Receipt.', |
|
99 | - 'event_espresso' |
|
100 | - ), |
|
101 | - true |
|
102 | - ); |
|
103 | - } |
|
104 | - } |
|
105 | - // regardless of whether it worked or not, we ought to continue the migration |
|
106 | - $this->set_completed(); |
|
107 | - return 1; |
|
108 | - } |
|
73 | + // @todo: check 'invoice_css' too because we can't easily affect that so we might need to set a persistent notice |
|
74 | + // (why is it tough to change? because we want to update the receipt and invoice message template, but |
|
75 | + // message templates are only initialized AFTER migrations and those two are new in 4.5. So if we wanted to |
|
76 | + // update them from a DMS, we'd need to have the DMS create the message templates which is quite a lot of code; |
|
77 | + // also we don't want to build a dependency on the messages code because it is likely to change soon |
|
78 | + if (isset($invoice_settings['invoice_css']) |
|
79 | + && ! in_array($invoice_settings['invoice_css'], ['', 'simple.css'])) { |
|
80 | + new PersistentAdminNotice( |
|
81 | + 'invoice_css_not_updated', |
|
82 | + sprintf( |
|
83 | + esc_html__( |
|
84 | + 'You had previously set your Invoice Payment Method\'s stylesheet to be %1$s, but that setting has moved. PDF and HTML Invoices and Receipts are now Messages, which means you can easily modify them from your Wordpress Dashboard instead of using filters or uploading template files. Please visit Messages -> Receipt and Messages -> Invoice to change their stylesheets.', |
|
85 | + 'event_espresso' |
|
86 | + ), |
|
87 | + $invoice_settings['invoice_css'] |
|
88 | + ) |
|
89 | + ); |
|
90 | + } |
|
91 | + $templates_relative_path = 'modules/gateways/Invoice/lib/templates/'; |
|
92 | + $overridden_invoice_body = EEH_Template::locate_template($templates_relative_path . 'invoice_body.template.php', null, false, false, true); |
|
93 | + $overridden_receipt_body= EEH_Template::locate_template($templates_relative_path . 'receipt_body.template.php', null, false, false, true); |
|
94 | + if ($overridden_invoice_body || $overridden_receipt_body) { |
|
95 | + new PersistentAdminNotice( |
|
96 | + 'invoice_overriding_templates', |
|
97 | + esc_html__( |
|
98 | + 'Note: in this version of Event Espresso, PDF and HTML Invoices and Receipts are now Messages and can be changed just like any other messages; however we noticed you had previously overridden the old default Invoice/Receipt templates. Because of this, your old Invoice/Receipt templates will continue to be used INSTEAD of the new Invoice/Receipt message equivalents. We recommend deleting your old Invoice/Receipt templates and modifying the new Invoice and Receipt messages\'s content in Messages -> Invoice and Messages -> Receipt.', |
|
99 | + 'event_espresso' |
|
100 | + ), |
|
101 | + true |
|
102 | + ); |
|
103 | + } |
|
104 | + } |
|
105 | + // regardless of whether it worked or not, we ought to continue the migration |
|
106 | + $this->set_completed(); |
|
107 | + return 1; |
|
108 | + } |
|
109 | 109 | } |