Completed
Branch BUG-8957-add-countries (d46858)
by
unknown
31:05 queued 15:34
created
core/data_migration_scripts/EE_DMS_Core_4_7_0.dms.php 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -17,13 +17,13 @@  discard block
 block discarded – undo
17 17
 // (all other times it gets resurrected from a wordpress option)
18 18
 $stages = glob(EE_CORE.'data_migration_scripts/4_7_0_stages/*');
19 19
 $class_to_filepath = array();
20
-foreach($stages as $filepath){
20
+foreach ($stages as $filepath) {
21 21
 	$matches = array();
22
-	preg_match('~4_7_0_stages/(.*).dmsstage.php~',$filepath,$matches);
22
+	preg_match('~4_7_0_stages/(.*).dmsstage.php~', $filepath, $matches);
23 23
 	$class_to_filepath[$matches[1]] = $filepath;
24 24
 }
25 25
 //give addons a chance to autoload their stages too
26
-$class_to_filepath = apply_filters('FHEE__EE_DMS_4_7_0__autoloaded_stages',$class_to_filepath);
26
+$class_to_filepath = apply_filters('FHEE__EE_DMS_4_7_0__autoloaded_stages', $class_to_filepath);
27 27
 EEH_Autoloader::register_autoloader($class_to_filepath);
28 28
 
29 29
 
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
  * @since                4.7.0
40 40
  *
41 41
  */
42
-class EE_DMS_Core_4_7_0 extends EE_Data_Migration_Script_Base{
42
+class EE_DMS_Core_4_7_0 extends EE_Data_Migration_Script_Base {
43 43
 
44 44
 	/**
45 45
 	 * return EE_DMS_Core_4_7_0
@@ -47,14 +47,14 @@  discard block
 block discarded – undo
47 47
 	 * @param TableManager  $table_manager
48 48
 	 * @param TableAnalysis $table_analysis
49 49
 	 */
50
-	public function __construct( TableManager $table_manager = null, TableAnalysis $table_analysis = null ) {
50
+	public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) {
51 51
 		$this->_pretty_name = __("Data Migration to Event Espresso 4.7.0.p", "event_espresso");
52 52
 		$this->_priority = 10;
53 53
 		$this->_migration_stages = array(
54 54
 			new EE_DMS_4_7_0_Add_Taxes_To_REG_Final_Price(),
55 55
 			new EE_DMS_4_7_0_Registration_Payments(),
56 56
 		);
57
-		parent::__construct( $table_manager, $table_analysis );
57
+		parent::__construct($table_manager, $table_analysis);
58 58
 	}
59 59
 
60 60
 
@@ -67,18 +67,18 @@  discard block
 block discarded – undo
67 67
 		$version_string = $version_array['Core'];
68 68
 		if (
69 69
 			(
70
-				version_compare( $version_string, '4.7.0', '<=' )
71
-				&& version_compare( $version_string, '4.6.0', '>=' )
70
+				version_compare($version_string, '4.7.0', '<=')
71
+				&& version_compare($version_string, '4.6.0', '>=')
72 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' )
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 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
 		}
@@ -100,16 +100,16 @@  discard block
 block discarded – undo
100 100
 	 */
101 101
 	public function schema_changes_before_migration() {
102 102
 		//relies on 4.1's EEH_Activation::create_table
103
-		require_once( EE_HELPERS . 'EEH_Activation.helper.php' );
104
-		$table_name='esp_answer';
105
-		$sql=" ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
103
+		require_once(EE_HELPERS.'EEH_Activation.helper.php');
104
+		$table_name = 'esp_answer';
105
+		$sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
106 106
 					REG_ID INT UNSIGNED NOT NULL,
107 107
 					QST_ID INT UNSIGNED NOT NULL,
108 108
 					ANS_value TEXT NOT NULL,
109 109
 					PRIMARY KEY  (ANS_ID),
110 110
 					KEY REG_ID (REG_ID),
111 111
 					KEY QST_ID (QST_ID)";
112
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
112
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
113 113
 
114 114
 		$table_name = 'esp_attendee_meta';
115 115
 		$sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 					  CNT_is_EU TINYINT(1) DEFAULT '0',
150 150
 					  CNT_active TINYINT(1) DEFAULT '0',
151 151
 					  PRIMARY KEY  (CNT_ISO)";
152
-		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' );
152
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
153 153
 
154 154
 		$table_name = 'esp_currency';
155 155
 		$sql = "CUR_code VARCHAR(6) COLLATE utf8_bin NOT NULL,
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 				CUR_dec_plc VARCHAR(1) COLLATE utf8_bin NOT NULL DEFAULT '2',
160 160
 				CUR_active TINYINT(1) DEFAULT '0',
161 161
 				PRIMARY KEY  (CUR_code)";
162
-		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' );
162
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
163 163
 
164 164
 
165 165
 		$table_name = 'esp_currency_payment_method';
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 						KEY EVT_ID (EVT_ID),
190 190
 						KEY DTT_is_primary (DTT_is_primary)";
191 191
 
192
-		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' );
192
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
193 193
 
194 194
 		$table_name = 'esp_event_meta';
195 195
 		$sql = "
@@ -208,44 +208,44 @@  discard block
 block discarded – undo
208 208
 			EVT_donations TINYINT(1) NULL,
209 209
 			PRIMARY KEY  (EVTM_ID),
210 210
 			KEY EVT_ID (EVT_ID)";
211
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
211
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
212 212
 
213 213
 
214 214
 
215
-		$table_name='esp_event_question_group';
216
-		$sql="EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
215
+		$table_name = 'esp_event_question_group';
216
+		$sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
217 217
 					EVT_ID BIGINT(20) UNSIGNED NOT NULL,
218 218
 					QSG_ID INT 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');
223
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
224 224
 
225 225
 
226 226
 
227
-		$table_name='esp_event_venue';
228
-		$sql="EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
227
+		$table_name = 'esp_event_venue';
228
+		$sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
229 229
 				EVT_ID BIGINT(20) UNSIGNED NOT NULL,
230 230
 				VNU_ID BIGINT(20) UNSIGNED NOT NULL,
231 231
 				EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
232 232
 				PRIMARY KEY  (EVV_ID)";
233
-		$this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB');
233
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
234 234
 
235 235
 
236 236
 
237
-		$table_name='esp_extra_meta';
238
-		$sql="EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
237
+		$table_name = 'esp_extra_meta';
238
+		$sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
239 239
 				OBJ_ID INT(11) DEFAULT NULL,
240 240
 				EXM_type VARCHAR(45) DEFAULT NULL,
241 241
 				EXM_key VARCHAR(45) DEFAULT NULL,
242 242
 				EXM_value TEXT,
243 243
 				PRIMARY KEY  (EXM_ID),
244 244
 				KEY EXM_type (EXM_type, OBJ_ID, EXM_key(45))";
245
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
245
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
246 246
 
247
-		$table_name='esp_line_item';
248
-		$sql="LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
247
+		$table_name = 'esp_line_item';
248
+		$sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
249 249
 				LIN_code VARCHAR(245) NOT NULL DEFAULT '',
250 250
 				TXN_ID INT(11) DEFAULT NULL,
251 251
 				LIN_name VARCHAR(245) NOT NULL DEFAULT '',
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 				PRIMARY KEY  (LIN_ID),
264 264
 				KEY LIN_code (LIN_code(191)),
265 265
 				KEY TXN_ID (TXN_ID)";
266
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB' );
266
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
267 267
 
268 268
 		$table_name = 'esp_log';
269 269
 		$sql = "LOG_ID INT(11) NOT NULL AUTO_INCREMENT,
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
 					MTP_is_active TINYINT(1) NOT NULL DEFAULT '1',
304 304
 					PRIMARY KEY  (GRP_ID),
305 305
 					KEY MTP_user_id (MTP_user_id)";
306
-		$this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB');
306
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
307 307
 
308 308
 		$table_name = 'esp_event_message_template';
309 309
 		$sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
 					PRIMARY KEY  (EMT_ID),
313 313
 					KEY EVT_ID (EVT_ID),
314 314
 					KEY GRP_ID (GRP_ID)";
315
-		$this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB');
315
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
316 316
 
317 317
 
318 318
 		$table_name = 'esp_payment';
@@ -385,8 +385,8 @@  discard block
 block discarded – undo
385 385
 					  PRIMARY KEY  (TTM_ID)";
386 386
 		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
387 387
 
388
-		$table_name='esp_question';
389
-		$sql='QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
388
+		$table_name = 'esp_question';
389
+		$sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
390 390
 					QST_display_text TEXT NOT NULL,
391 391
 					QST_admin_label VARCHAR(255) NOT NULL,
392 392
 					QST_system VARCHAR(25) DEFAULT NULL,
@@ -399,22 +399,22 @@  discard block
 block discarded – undo
399 399
 					QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0,
400 400
 					PRIMARY KEY  (QST_ID),
401 401
 					KEY QST_order (QST_order)';
402
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
402
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
403 403
 
404
-		$table_name='esp_question_group_question';
405
-		$sql="QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
404
+		$table_name = 'esp_question_group_question';
405
+		$sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
406 406
 					QSG_ID INT UNSIGNED NOT NULL,
407 407
 					QST_ID INT UNSIGNED NOT NULL,
408 408
 					QGQ_order INT UNSIGNED NOT NULL DEFAULT 0,
409 409
 					PRIMARY KEY  (QGQ_ID),
410 410
 					KEY QST_ID (QST_ID),
411 411
 					KEY QSG_ID_order (QSG_ID, QGQ_order)";
412
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
412
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
413 413
 
414 414
 
415 415
 
416
-		$table_name='esp_question_option';
417
-		$sql="QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
416
+		$table_name = 'esp_question_option';
417
+		$sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
418 418
 					QSO_value VARCHAR(255) NOT NULL,
419 419
 					QSO_desc TEXT NOT NULL,
420 420
 					QST_ID INT UNSIGNED NOT NULL,
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
 					PRIMARY KEY  (QSO_ID),
424 424
 					KEY QST_ID (QST_ID),
425 425
 					KEY QSO_order (QSO_order)";
426
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
426
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
427 427
 
428 428
 
429 429
 
@@ -469,8 +469,8 @@  discard block
 block discarded – undo
469 469
 
470 470
 
471 471
 
472
-		$table_name='esp_checkin';
473
-		$sql="CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
472
+		$table_name = 'esp_checkin';
473
+		$sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
474 474
 					REG_ID INT(10) UNSIGNED NOT NULL,
475 475
 					DTT_ID INT(10) UNSIGNED NOT NULL,
476 476
 					CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
@@ -565,7 +565,7 @@  discard block
 block discarded – undo
565 565
 					  PRC_parent INT(10) UNSIGNED DEFAULT 0,
566 566
 					  PRIMARY KEY  (PRC_ID),
567 567
 					  KEY PRT_ID (PRT_ID)";
568
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
568
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
569 569
 
570 570
 		$table_name = "esp_price_type";
571 571
 		$sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -603,10 +603,10 @@  discard block
 block discarded – undo
603 603
 					  TKT_deleted TINYINT(1) NOT NULL DEFAULT '0',
604 604
 					  PRIMARY KEY  (TKT_ID),
605 605
 					  KEY TKT_start_date (TKT_start_date)";
606
-		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' );
606
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
607 607
 
608 608
 		$table_name = 'esp_question_group';
609
-		$sql='QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
609
+		$sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
610 610
 					QSG_name VARCHAR(255) NOT NULL,
611 611
 					QSG_identifier VARCHAR(100) NOT NULL,
612 612
 					QSG_desc TEXT NULL,
@@ -619,7 +619,7 @@  discard block
 block discarded – undo
619 619
 					PRIMARY KEY  (QSG_ID),
620 620
 					UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier),
621 621
 					KEY QSG_order (QSG_order)';
622
-		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' );
622
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
623 623
 
624 624
 		/** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */
625 625
 		$script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
@@ -651,7 +651,7 @@  discard block
 block discarded – undo
651 651
 		return true;
652 652
 	}
653 653
 
654
-	public function migration_page_hooks(){
654
+	public function migration_page_hooks() {
655 655
 
656 656
 	}
657 657
 }
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_DMS_Core_4_2_0.dms.php 1 patch
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -14,18 +14,18 @@  discard block
 block discarded – undo
14 14
 //(all other times it gets resurrected from a wordpress option)
15 15
 $stages = glob(EE_CORE.'data_migration_scripts/4_2_0_stages/*');
16 16
 $class_to_filepath = array();
17
-if ( ! empty( $stages ) ) {
18
-	foreach($stages as $filepath){
17
+if ( ! empty($stages)) {
18
+	foreach ($stages as $filepath) {
19 19
 		$matches = array();
20
-		preg_match('~4_2_0_stages/(.*).dmsstage.php~',$filepath,$matches);
20
+		preg_match('~4_2_0_stages/(.*).dmsstage.php~', $filepath, $matches);
21 21
 		$class_to_filepath[$matches[1]] = $filepath;
22 22
 	}
23 23
 }
24 24
 //give addons a chance to autoload their stages too
25
-$class_to_filepath = apply_filters('FHEE__EE_DMS_4_2_0__autoloaded_stages',$class_to_filepath);
25
+$class_to_filepath = apply_filters('FHEE__EE_DMS_4_2_0__autoloaded_stages', $class_to_filepath);
26 26
 EEH_Autoloader::register_autoloader($class_to_filepath);
27 27
 
28
-class EE_DMS_Core_4_2_0 extends EE_Data_Migration_Script_Base{
28
+class EE_DMS_Core_4_2_0 extends EE_Data_Migration_Script_Base {
29 29
 
30 30
 
31 31
 
@@ -35,26 +35,26 @@  discard block
 block discarded – undo
35 35
 	 * @param TableManager  $table_manager
36 36
 	 * @param TableAnalysis $table_analysis
37 37
 	 */
38
-	public function __construct( TableManager $table_manager = null, TableAnalysis $table_analysis = null ) {
38
+	public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) {
39 39
 		$this->_pretty_name = __("Data Migration to Event Espresso 4.2.0.P", "event_espresso");
40 40
 		$this->_priority = 10;
41 41
 		$this->_migration_stages = array(
42 42
 			new EE_DMS_4_2_0_question_group_questions(),
43 43
 			new EE_DMS_4_2_0_datetime_fields(),
44 44
 		);
45
-		parent::__construct( $table_manager, $table_analysis );
45
+		parent::__construct($table_manager, $table_analysis);
46 46
 	}
47 47
 	public function can_migrate_from_version($version_array) {
48 48
 		$version_string = $version_array['Core'];
49
-		if ( version_compare( $version_string, '4.2.0', '<=' ) && version_compare( $version_string, '4.1.0', '>=' ) ) {
49
+		if (version_compare($version_string, '4.2.0', '<=') && version_compare($version_string, '4.1.0', '>=')) {
50 50
 //			echo "$version_string can be migrated fro";
51 51
 			return true;
52
-		}elseif( ! $version_string ){
52
+		}elseif ( ! $version_string) {
53 53
 //			echo "no version string provided: $version_string";
54 54
 			//no version string provided... this must be pre 4.1
55 55
 			//because since 4.1 we're
56
-			return false;//changed mind. dont want people thinking they should migrate yet because they cant
57
-		}else{
56
+			return false; //changed mind. dont want people thinking they should migrate yet because they cant
57
+		} else {
58 58
 //			echo "$version_string doesnt apply";
59 59
 			return false;
60 60
 		}
@@ -64,14 +64,14 @@  discard block
 block discarded – undo
64 64
 	}
65 65
 	public function schema_changes_before_migration() {
66 66
 		//relies on 4.1's EEH_Activation::create_table
67
-		require_once( EE_HELPERS . 'EEH_Activation.helper.php' );
68
-		$table_name='esp_answer';
69
-		$sql=" ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
67
+		require_once(EE_HELPERS.'EEH_Activation.helper.php');
68
+		$table_name = 'esp_answer';
69
+		$sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
70 70
 					REG_ID INT UNSIGNED NOT NULL,
71 71
 					QST_ID INT UNSIGNED NOT NULL,
72 72
 					ANS_value TEXT NOT NULL,
73 73
 					PRIMARY KEY  (ANS_ID)";
74
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
74
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
75 75
 
76 76
 		$table_name = 'esp_attendee_meta';
77 77
 		$sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 					  CNT_is_EU TINYINT(1) DEFAULT '0',
112 112
 					  CNT_active TINYINT(1) DEFAULT '0',
113 113
 					  PRIMARY KEY  (CNT_ISO)";
114
-		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB' );
114
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
115 115
 
116 116
 
117 117
 
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 
135 135
 
136 136
 
137
-		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB' );
137
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
138 138
 		$table_name = 'esp_event_meta';
139 139
 		$sql = "
140 140
 			EVTM_ID INT NOT NULL AUTO_INCREMENT,
@@ -151,41 +151,41 @@  discard block
 block discarded – undo
151 151
 			EVT_external_URL VARCHAR(200) NULL,
152 152
 			EVT_donations TINYINT(1) NULL,
153 153
 			PRIMARY KEY  (EVTM_ID)";
154
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
154
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
155 155
 
156 156
 
157 157
 
158
-		$table_name='esp_event_question_group';
159
-		$sql="EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
158
+		$table_name = 'esp_event_question_group';
159
+		$sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
160 160
 					EVT_ID BIGINT(20) UNSIGNED NOT NULL,
161 161
 					QSG_ID INT UNSIGNED NOT NULL,
162 162
 					EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
163 163
 					PRIMARY KEY  (EQG_ID)";
164
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
164
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
165 165
 
166 166
 
167 167
 
168
-		$table_name='esp_event_venue';
169
-		$sql="EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
168
+		$table_name = 'esp_event_venue';
169
+		$sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
170 170
 				EVT_ID BIGINT(20) UNSIGNED NOT NULL,
171 171
 				VNU_ID BIGINT(20) UNSIGNED NOT NULL,
172 172
 				EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
173 173
 				PRIMARY KEY  (EVV_ID)";
174
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
174
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
175 175
 
176 176
 
177 177
 
178
-		$table_name='esp_extra_meta';
179
-		$sql="EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
178
+		$table_name = 'esp_extra_meta';
179
+		$sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
180 180
 				OBJ_ID INT(11) DEFAULT NULL,
181 181
 				EXM_type VARCHAR(45) DEFAULT NULL,
182 182
 				EXM_key VARCHAR(45) DEFAULT NULL,
183 183
 				EXM_value TEXT,
184 184
 				PRIMARY KEY  (EXM_ID)";
185
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
185
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
186 186
 
187
-		$table_name='esp_line_item';
188
-		$sql="LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
187
+		$table_name = 'esp_line_item';
188
+		$sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
189 189
 				LIN_code VARCHAR(245) NOT NULL DEFAULT '',
190 190
 				TXN_ID INT(11) DEFAULT NULL,
191 191
 				LIN_name VARCHAR(245) NOT NULL DEFAULT '',
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 				OBJ_ID INT(11) DEFAULT NULL,
202 202
 				OBJ_type VARCHAR(45)DEFAULT NULL,
203 203
 				PRIMARY KEY  (LIN_ID)";
204
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB' );
204
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
205 205
 
206 206
 		$table_name = 'esp_message_template';
207 207
 		$sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 					PRIMARY KEY  (GRP_ID),
229 229
 					KEY EVT_ID (EVT_ID),
230 230
 					KEY MTP_user_id (MTP_user_id)";
231
-		$this->_table_should_exist_previously( $table_name, $sql, 'ENGINE=InnoDB');
231
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
232 232
 
233 233
 
234 234
 
@@ -336,8 +336,8 @@  discard block
 block discarded – undo
336 336
 
337 337
 
338 338
 
339
-		$table_name='esp_question';
340
-		$sql='QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
339
+		$table_name = 'esp_question';
340
+		$sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
341 341
 					QST_display_text TEXT NOT NULL,
342 342
 					QST_admin_label VARCHAR(255) NOT NULL,
343 343
 					QST_system VARCHAR(25) DEFAULT NULL,
@@ -349,12 +349,12 @@  discard block
 block discarded – undo
349 349
 					QST_wp_user BIGINT UNSIGNED NULL,
350 350
 					QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0,
351 351
 					PRIMARY KEY  (QST_ID)';
352
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
352
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
353 353
 
354
-		$this->_get_table_manager()->dropIndex( 'esp_question_group', 'QSG_identifier_UNIQUE' );
354
+		$this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE');
355 355
 
356 356
 		$table_name = 'esp_question_group';
357
-		$sql='QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
357
+		$sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
358 358
 					QSG_name VARCHAR(255) NOT NULL,
359 359
 					QSG_identifier VARCHAR(100) NOT NULL,
360 360
 					QSG_desc TEXT NULL,
@@ -365,28 +365,28 @@  discard block
 block discarded – undo
365 365
 					QSG_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
366 366
 					PRIMARY KEY  (QSG_ID),
367 367
 					UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier ASC)';
368
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
368
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
369 369
 
370 370
 
371 371
 
372
-		$table_name='esp_question_group_question';
373
-		$sql="QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
372
+		$table_name = 'esp_question_group_question';
373
+		$sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
374 374
 					QSG_ID INT UNSIGNED NOT NULL,
375 375
 					QST_ID INT UNSIGNED NOT NULL,
376 376
 					QGQ_order INT UNSIGNED NOT NULL DEFAULT 0,
377 377
 					PRIMARY KEY  (QGQ_ID) ";
378
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
378
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
379 379
 
380 380
 
381 381
 
382
-		$table_name='esp_question_option';
383
-		$sql="QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
382
+		$table_name = 'esp_question_option';
383
+		$sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
384 384
 					QSO_value VARCHAR(255) NOT NULL,
385 385
 					QSO_desc TEXT NOT NULL,
386 386
 					QST_ID INT UNSIGNED NOT NULL,
387 387
 					QSO_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
388 388
 					PRIMARY KEY  (QSO_ID)";
389
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
389
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
390 390
 
391 391
 
392 392
 
@@ -419,8 +419,8 @@  discard block
 block discarded – undo
419 419
 
420 420
 
421 421
 
422
-		$table_name='esp_checkin';
423
-		$sql="CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
422
+		$table_name = 'esp_checkin';
423
+		$sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
424 424
 					REG_ID INT(10) UNSIGNED NOT NULL,
425 425
 					DTT_ID INT(10) UNSIGNED NOT NULL,
426 426
 					CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
 		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
495 495
 
496 496
 
497
-		$script_with_defaults = EE_Registry::instance()->load_dms( 'Core_4_1_0' );
497
+		$script_with_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
498 498
 		//setting up the DEFAULT stats and countries is also essential for the data migrations to run
499 499
 		//(because many need to convert old string states to foreign keys into the states table)
500 500
 		$script_with_defaults->insert_default_states();
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
 		return true;
517 517
 	}
518 518
 
519
-	public function migration_page_hooks(){
519
+	public function migration_page_hooks() {
520 520
 
521 521
 	}
522 522
 }
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_DMS_Core_4_9_0.dms.php 1 patch
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -11,13 +11,13 @@  discard block
 block discarded – undo
11 11
 //(all other times it gets resurrected from a wordpress option)
12 12
 $stages = glob(EE_CORE.'data_migration_scripts/4_9_0_stages/*');
13 13
 $class_to_filepath = array();
14
-foreach($stages as $filepath){
14
+foreach ($stages as $filepath) {
15 15
 	$matches = array();
16
-	preg_match('~4_9_0_stages/(.*).dmsstage.php~',$filepath,$matches);
16
+	preg_match('~4_9_0_stages/(.*).dmsstage.php~', $filepath, $matches);
17 17
 	$class_to_filepath[$matches[1]] = $filepath;
18 18
 }
19 19
 //give addons a chance to autoload their stages too
20
-$class_to_filepath = apply_filters('FHEE__EE_DMS_4_9_0__autoloaded_stages',$class_to_filepath);
20
+$class_to_filepath = apply_filters('FHEE__EE_DMS_4_9_0__autoloaded_stages', $class_to_filepath);
21 21
 EEH_Autoloader::register_autoloader($class_to_filepath);
22 22
 
23 23
 
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
  * @since                4.6.0
34 34
  *
35 35
  */
36
-class EE_DMS_Core_4_9_0 extends EE_Data_Migration_Script_Base{
36
+class EE_DMS_Core_4_9_0 extends EE_Data_Migration_Script_Base {
37 37
 
38 38
 	/**
39 39
 	 * return EE_DMS_Core_4_9_0
@@ -41,14 +41,14 @@  discard block
 block discarded – undo
41 41
 	 * @param TableManager  $table_manager
42 42
 	 * @param TableAnalysis $table_analysis
43 43
 	 */
44
-	public function __construct( TableManager $table_manager = null, TableAnalysis $table_analysis = null ) {
44
+	public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) {
45 45
 		$this->_pretty_name = __("Data Migration to Event Espresso 4.9.0.P", "event_espresso");
46 46
 		$this->_priority = 10;
47 47
 		$this->_migration_stages = array(
48 48
 			new EE_DMS_4_9_0_Email_System_Question(),
49 49
 			new EE_DMS_4_9_0_Answers_With_No_Registration(),
50 50
 		);
51
-		parent::__construct( $table_manager, $table_analysis );
51
+		parent::__construct($table_manager, $table_analysis);
52 52
 	}
53 53
 
54 54
 
@@ -60,14 +60,14 @@  discard block
 block discarded – undo
60 60
 	 */
61 61
 	public function can_migrate_from_version($version_array) {
62 62
 		$version_string = $version_array['Core'];
63
-		if ( version_compare( $version_string, '4.9.0', '<=' ) && version_compare( $version_string, '4.8.0', '>=' ) ) {
63
+		if (version_compare($version_string, '4.9.0', '<=') && version_compare($version_string, '4.8.0', '>=')) {
64 64
 //			echo "$version_string can be migrated from";
65 65
 			return true;
66
-		} elseif( ! $version_string ){
66
+		} elseif ( ! $version_string) {
67 67
 //			echo "no version string provided: $version_string";
68 68
 			//no version string provided... this must be pre 4.3
69
-			return false;//changed mind. dont want people thinking they should migrate yet because they cant
70
-		}else{
69
+			return false; //changed mind. dont want people thinking they should migrate yet because they cant
70
+		} else {
71 71
 //			echo "$version_string doesnt apply";
72 72
 			return false;
73 73
 		}
@@ -88,18 +88,18 @@  discard block
 block discarded – undo
88 88
 	 * @return bool
89 89
 	 */
90 90
 	public function schema_changes_before_migration() {
91
-		require_once( EE_HELPERS . 'EEH_Activation.helper.php' );
92
-		$now_in_mysql = current_time( 'mysql', true );
91
+		require_once(EE_HELPERS.'EEH_Activation.helper.php');
92
+		$now_in_mysql = current_time('mysql', true);
93 93
 
94
-		$table_name='esp_answer';
95
-		$sql=" ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
94
+		$table_name = 'esp_answer';
95
+		$sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
96 96
 					REG_ID int(10) unsigned NOT NULL,
97 97
 					QST_ID int(10) unsigned NOT NULL,
98 98
 					ANS_value text NOT NULL,
99 99
 					PRIMARY KEY  (ANS_ID),
100 100
 					KEY REG_ID (REG_ID),
101 101
 					KEY QST_ID (QST_ID)";
102
-		$this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB');
102
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
103 103
 
104 104
 		$table_name = 'esp_attendee_meta';
105 105
 		$sql = "ATTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 				KEY ATT_fname (ATT_fname)";
122 122
 		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
123 123
 
124
-		$table_name='esp_checkin';
124
+		$table_name = 'esp_checkin';
125 125
 		$sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
126 126
 				REG_ID int(10) unsigned NOT NULL,
127 127
 				DTT_ID int(10) unsigned NOT NULL,
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 				CNT_is_EU tinyint(1) DEFAULT '0',
150 150
 				CNT_active tinyint(1) DEFAULT '0',
151 151
 				PRIMARY KEY  (CNT_ISO)";
152
-		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' );
152
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
153 153
 
154 154
 		$table_name = 'esp_currency';
155 155
 		$sql = "CUR_code varchar(6) collate utf8_bin NOT NULL,
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 				CUR_dec_plc varchar(1) collate utf8_bin NOT NULL DEFAULT '2',
160 160
 				CUR_active tinyint(1) DEFAULT '0',
161 161
 				PRIMARY KEY  (CUR_code)";
162
-		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' );
162
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
163 163
 
164 164
 
165 165
 		$table_name = 'esp_currency_payment_method';
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 				KEY DTT_EVT_start (DTT_EVT_start),
188 188
 				KEY EVT_ID (EVT_ID),
189 189
 				KEY DTT_is_primary (DTT_is_primary)";
190
-		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' );
190
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
191 191
 
192 192
 		$table_name = "esp_datetime_ticket";
193 193
 		$sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 				PRIMARY KEY  (EMT_ID),
206 206
 				KEY EVT_ID (EVT_ID),
207 207
 				KEY GRP_ID (GRP_ID)";
208
-		$this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB');
208
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
209 209
 
210 210
 		$table_name = 'esp_event_meta';
211 211
 		$sql = "EVTM_ID int(10) NOT NULL AUTO_INCREMENT,
@@ -223,9 +223,9 @@  discard block
 block discarded – undo
223 223
 				EVT_donations tinyint(1) NULL,
224 224
 				PRIMARY KEY  (EVTM_ID),
225 225
 				KEY EVT_ID (EVT_ID)";
226
-		$this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB');
226
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
227 227
 
228
-		$table_name='esp_event_question_group';
228
+		$table_name = 'esp_event_question_group';
229 229
 		$sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
230 230
 				EVT_ID bigint(20) unsigned NOT NULL,
231 231
 				QSG_ID int(10) unsigned NOT NULL,
@@ -233,17 +233,17 @@  discard block
 block discarded – undo
233 233
 				PRIMARY KEY  (EQG_ID),
234 234
 				KEY EVT_ID (EVT_ID),
235 235
 				KEY QSG_ID (QSG_ID)";
236
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
236
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
237 237
 
238
-		$table_name='esp_event_venue';
238
+		$table_name = 'esp_event_venue';
239 239
 		$sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT,
240 240
 				EVT_ID bigint(20) unsigned NOT NULL,
241 241
 				VNU_ID bigint(20) unsigned NOT NULL,
242 242
 				EVV_primary tinyint(1) unsigned NOT NULL DEFAULT 0,
243 243
 				PRIMARY KEY  (EVV_ID)";
244
-		$this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB');
244
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
245 245
 
246
-		$table_name='esp_extra_meta';
246
+		$table_name = 'esp_extra_meta';
247 247
 		$sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT,
248 248
 				OBJ_ID int(11) DEFAULT NULL,
249 249
 				EXM_type varchar(45) DEFAULT NULL,
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 				EXM_value text,
252 252
 				PRIMARY KEY  (EXM_ID),
253 253
 				KEY EXM_type (EXM_type,OBJ_ID,EXM_key)";
254
-		$this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB');
254
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
255 255
 
256 256
 		$table_name = 'esp_extra_join';
257 257
 		$sql = "EXJ_ID int(11) NOT NULL AUTO_INCREMENT,
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 				KEY second_model (EXJ_second_model_name,EXJ_second_model_id)";
265 265
 		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
266 266
 
267
-		$table_name='esp_line_item';
267
+		$table_name = 'esp_line_item';
268 268
 		$sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT,
269 269
 				LIN_code varchar(245) NOT NULL DEFAULT '',
270 270
 				TXN_ID int(11) DEFAULT NULL,
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 				PRIMARY KEY  (LIN_ID),
285 285
 				KEY LIN_code (LIN_code(191)),
286 286
 				KEY TXN_ID (TXN_ID)";
287
-		$this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB' );
287
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
288 288
 
289 289
 		$table_name = 'esp_log';
290 290
 		$sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT,
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
 				KEY STS_ID (STS_ID),
334 334
 				KEY MSG_created (MSG_created),
335 335
 				KEY MSG_modified (MSG_modified)";
336
-		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB' );
336
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
337 337
 
338 338
 		$table_name = 'esp_message_template';
339 339
 		$sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
 				MTP_is_active tinyint(1) NOT NULL DEFAULT '1',
359 359
 				PRIMARY KEY  (GRP_ID),
360 360
 				KEY MTP_user_id (MTP_user_id)";
361
-		$this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB');
361
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
362 362
 
363 363
 		$table_name = 'esp_payment';
364 364
 		$sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
 				PRIMARY KEY  (TTM_ID)";
417 417
 		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
418 418
 
419
-		$table_name='esp_question';
419
+		$table_name = 'esp_question';
420 420
 		$sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
421 421
 				QST_display_text text NOT NULL,
422 422
 				QST_admin_label varchar(255) NOT NULL,
@@ -431,9 +431,9 @@  discard block
 block discarded – undo
431 431
 				QST_deleted tinyint(2) unsigned NOT NULL DEFAULT 0,
432 432
 				PRIMARY KEY  (QST_ID),
433 433
 				KEY QST_order (QST_order)';
434
-		$this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB');
434
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
435 435
 
436
-		$table_name='esp_question_group_question';
436
+		$table_name = 'esp_question_group_question';
437 437
 		$sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
438 438
 				QSG_ID int(10) unsigned NOT NULL,
439 439
 				QST_ID int(10) unsigned NOT NULL,
@@ -441,9 +441,9 @@  discard block
 block discarded – undo
441 441
 				PRIMARY KEY  (QGQ_ID),
442 442
 				KEY QST_ID (QST_ID),
443 443
 				KEY QSG_ID_order (QSG_ID,QGQ_order)";
444
-		$this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB');
444
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
445 445
 
446
-		$table_name='esp_question_option';
446
+		$table_name = 'esp_question_option';
447 447
 		$sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
448 448
 				QSO_value varchar(255) NOT NULL,
449 449
 				QSO_desc text NOT NULL,
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
 				PRIMARY KEY  (QSO_ID),
455 455
 				KEY QST_ID (QST_ID),
456 456
 				KEY QSO_order (QSO_order)";
457
-		$this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB');
457
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
458 458
 
459 459
 		$table_name = 'esp_registration';
460 460
 		$sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
@@ -567,7 +567,7 @@  discard block
 block discarded – undo
567 567
 				PRC_parent int(10) unsigned DEFAULT 0,
568 568
 				PRIMARY KEY  (PRC_ID),
569 569
 				KEY PRT_ID (PRT_ID)";
570
-		$this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB');
570
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
571 571
 
572 572
 		$table_name = "esp_price_type";
573 573
 		$sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
@@ -604,7 +604,7 @@  discard block
 block discarded – undo
604 604
 				TKT_deleted tinyint(1) NOT NULL DEFAULT '0',
605 605
 				PRIMARY KEY  (TKT_ID),
606 606
 				KEY TKT_start_date (TKT_start_date)";
607
-		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' );
607
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
608 608
 
609 609
 		$table_name = 'esp_question_group';
610 610
 		$sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
@@ -620,7 +620,7 @@  discard block
 block discarded – undo
620 620
 				PRIMARY KEY  (QSG_ID),
621 621
 				UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier),
622 622
 				KEY QSG_order (QSG_order)';
623
-		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' );
623
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
624 624
 
625 625
 		/** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */
626 626
 		$script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
@@ -654,5 +654,5 @@  discard block
 block discarded – undo
654 654
 		return true;
655 655
 	}
656 656
 
657
-	public function migration_page_hooks(){}
657
+	public function migration_page_hooks() {}
658 658
 }
659 659
\ No newline at end of file
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_DMS_Core_4_3_0.dms.php 1 patch
Spacing   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -13,18 +13,18 @@  discard block
 block discarded – undo
13 13
 //(all other times it gets resurrected from a wordpress option)
14 14
 $stages = glob(EE_CORE.'data_migration_scripts/4_3_0_stages/*');
15 15
 $class_to_filepath = array();
16
-if ( ! empty( $stages ) ) {
17
-	foreach($stages as $filepath){
16
+if ( ! empty($stages)) {
17
+	foreach ($stages as $filepath) {
18 18
 		$matches = array();
19
-		preg_match('~4_3_0_stages/(.*).dmsstage.php~',$filepath,$matches);
19
+		preg_match('~4_3_0_stages/(.*).dmsstage.php~', $filepath, $matches);
20 20
 		$class_to_filepath[$matches[1]] = $filepath;
21 21
 	}
22 22
 }
23 23
 //give addons a chance to autoload their stages too
24
-$class_to_filepath = apply_filters('FHEE__EE_DMS_4_3_0__autoloaded_stages',$class_to_filepath);
24
+$class_to_filepath = apply_filters('FHEE__EE_DMS_4_3_0__autoloaded_stages', $class_to_filepath);
25 25
 EEH_Autoloader::register_autoloader($class_to_filepath);
26 26
 
27
-class EE_DMS_Core_4_3_0 extends EE_Data_Migration_Script_Base{
27
+class EE_DMS_Core_4_3_0 extends EE_Data_Migration_Script_Base {
28 28
 
29 29
 
30 30
 
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	 * @param TableManager  $table_manager
35 35
 	 * @param TableAnalysis $table_analysis
36 36
 	 */
37
-	public function __construct( TableManager $table_manager = null, TableAnalysis $table_analysis = null ) {
37
+	public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) {
38 38
 		$this->_pretty_name = __("Data Migration to Event Espresso 4.3.0.P", "event_espresso");
39 39
 		$this->_priority = 10;
40 40
 		$this->_migration_stages = array(
@@ -42,18 +42,18 @@  discard block
 block discarded – undo
42 42
 			new EE_DMS_4_3_0_event_message_templates(),
43 43
 			new EE_DMS_4_3_0_critical_page_shortcode_tracking()
44 44
 		);
45
-		parent::__construct( $table_manager, $table_analysis );
45
+		parent::__construct($table_manager, $table_analysis);
46 46
 	}
47 47
 	public function can_migrate_from_version($version_array) {
48 48
 		$version_string = $version_array['Core'];
49
-		if ( version_compare( $version_string, '4.3.0', '<=' ) && version_compare( $version_string, '4.2.0', '>=' ) ) {
49
+		if (version_compare($version_string, '4.3.0', '<=') && version_compare($version_string, '4.2.0', '>=')) {
50 50
 //			echo "$version_string can be migrated fro";
51 51
 			return true;
52
-		}elseif( ! $version_string ){
52
+		}elseif ( ! $version_string) {
53 53
 //			echo "no version string provided: $version_string";
54 54
 			//no version string provided... this must be pre 4.2
55
-			return false;//changed mind. dont want people thinking they should migrate yet because they cant
56
-		}else{
55
+			return false; //changed mind. dont want people thinking they should migrate yet because they cant
56
+		} else {
57 57
 //			echo "$version_string doesnt apply";
58 58
 			return false;
59 59
 		}
@@ -63,14 +63,14 @@  discard block
 block discarded – undo
63 63
 	}
64 64
 	public function schema_changes_before_migration() {
65 65
 		//relies on 4.1's EEH_Activation::create_table
66
-		require_once( EE_HELPERS . 'EEH_Activation.helper.php' );
67
-		$table_name='esp_answer';
68
-		$sql=" ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
66
+		require_once(EE_HELPERS.'EEH_Activation.helper.php');
67
+		$table_name = 'esp_answer';
68
+		$sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
69 69
 					REG_ID INT UNSIGNED NOT NULL,
70 70
 					QST_ID INT UNSIGNED NOT NULL,
71 71
 					ANS_value TEXT NOT NULL,
72 72
 					PRIMARY KEY  (ANS_ID)";
73
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
73
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
74 74
 
75 75
 		$table_name = 'esp_attendee_meta';
76 76
 		$sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 					  CNT_is_EU TINYINT(1) DEFAULT '0',
110 110
 					  CNT_active TINYINT(1) DEFAULT '0',
111 111
 					  PRIMARY KEY  (CNT_ISO)";
112
-		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB' );
112
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
113 113
 
114 114
 
115 115
 
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 
133 133
 
134 134
 
135
-		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB' );
135
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
136 136
 		$table_name = 'esp_event_meta';
137 137
 		$sql = "
138 138
 			EVTM_ID INT NOT NULL AUTO_INCREMENT,
@@ -149,41 +149,41 @@  discard block
 block discarded – undo
149 149
 			EVT_external_URL VARCHAR(200) NULL,
150 150
 			EVT_donations TINYINT(1) NULL,
151 151
 			PRIMARY KEY  (EVTM_ID)";
152
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
152
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
153 153
 
154 154
 
155 155
 
156
-		$table_name='esp_event_question_group';
157
-		$sql="EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
156
+		$table_name = 'esp_event_question_group';
157
+		$sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
158 158
 					EVT_ID BIGINT(20) UNSIGNED NOT NULL,
159 159
 					QSG_ID INT UNSIGNED NOT NULL,
160 160
 					EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
161 161
 					PRIMARY KEY  (EQG_ID)";
162
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
162
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
163 163
 
164 164
 
165 165
 
166
-		$table_name='esp_event_venue';
167
-		$sql="EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
166
+		$table_name = 'esp_event_venue';
167
+		$sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
168 168
 				EVT_ID BIGINT(20) UNSIGNED NOT NULL,
169 169
 				VNU_ID BIGINT(20) UNSIGNED NOT NULL,
170 170
 				EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
171 171
 				PRIMARY KEY  (EVV_ID)";
172
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
172
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
173 173
 
174 174
 
175 175
 
176
-		$table_name='esp_extra_meta';
177
-		$sql="EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
176
+		$table_name = 'esp_extra_meta';
177
+		$sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
178 178
 				OBJ_ID INT(11) DEFAULT NULL,
179 179
 				EXM_type VARCHAR(45) DEFAULT NULL,
180 180
 				EXM_key VARCHAR(45) DEFAULT NULL,
181 181
 				EXM_value TEXT,
182 182
 				PRIMARY KEY  (EXM_ID)";
183
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
183
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
184 184
 
185
-		$table_name='esp_line_item';
186
-		$sql="LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
185
+		$table_name = 'esp_line_item';
186
+		$sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
187 187
 				LIN_code VARCHAR(245) NOT NULL DEFAULT '',
188 188
 				TXN_ID INT(11) DEFAULT NULL,
189 189
 				LIN_name VARCHAR(245) NOT NULL DEFAULT '',
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 				OBJ_ID INT(11) DEFAULT NULL,
200 200
 				OBJ_type VARCHAR(45)DEFAULT NULL,
201 201
 				PRIMARY KEY  (LIN_ID)";
202
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB' );
202
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
203 203
 
204 204
 		$table_name = 'esp_message_template';
205 205
 		$sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 					KEY GRP_ID (GRP_ID)";
212 212
 		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
213 213
 
214
-		$this->_get_table_manager()->dropIndex( 'esp_message_template_group', 'EVT_ID' );
214
+		$this->_get_table_manager()->dropIndex('esp_message_template_group', 'EVT_ID');
215 215
 
216 216
 		$table_name = 'esp_message_template_group';
217 217
 		$sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 					MTP_is_active TINYINT(1) NOT NULL DEFAULT '1',
227 227
 					PRIMARY KEY  (GRP_ID),
228 228
 					KEY MTP_user_id (MTP_user_id)";
229
-		$this->_table_should_exist_previously( $table_name, $sql, 'ENGINE=InnoDB');
229
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
230 230
 
231 231
 		$table_name = 'esp_event_message_template';
232 232
 		$sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 					PRIMARY KEY  (EMT_ID),
236 236
 					KEY EVT_ID (EVT_ID),
237 237
 					KEY GRP_ID (GRP_ID)";
238
-		$this->_table_is_new_in_this_version( $table_name, $sql, 'ENGINE=InnoDB');
238
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
239 239
 
240 240
 
241 241
 
@@ -344,8 +344,8 @@  discard block
 block discarded – undo
344 344
 
345 345
 
346 346
 
347
-		$table_name='esp_question';
348
-		$sql='QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
347
+		$table_name = 'esp_question';
348
+		$sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
349 349
 					QST_display_text TEXT NOT NULL,
350 350
 					QST_admin_label VARCHAR(255) NOT NULL,
351 351
 					QST_system VARCHAR(25) DEFAULT NULL,
@@ -357,12 +357,12 @@  discard block
 block discarded – undo
357 357
 					QST_wp_user BIGINT UNSIGNED NULL,
358 358
 					QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0,
359 359
 					PRIMARY KEY  (QST_ID)';
360
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
360
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
361 361
 
362
-		$this->_get_table_manager()->dropIndex( 'esp_question_group', 'QSG_identifier_UNIQUE' );
362
+		$this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE');
363 363
 
364 364
 		$table_name = 'esp_question_group';
365
-		$sql='QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
365
+		$sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
366 366
 					QSG_name VARCHAR(255) NOT NULL,
367 367
 					QSG_identifier VARCHAR(100) NOT NULL,
368 368
 					QSG_desc TEXT NULL,
@@ -373,29 +373,29 @@  discard block
 block discarded – undo
373 373
 					QSG_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
374 374
 					PRIMARY KEY  (QSG_ID),
375 375
 					UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier ASC)';
376
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
376
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
377 377
 
378 378
 
379 379
 
380
-		$table_name='esp_question_group_question';
381
-		$sql="QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
380
+		$table_name = 'esp_question_group_question';
381
+		$sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
382 382
 					QSG_ID INT UNSIGNED NOT NULL,
383 383
 					QST_ID INT UNSIGNED NOT NULL,
384 384
 					QGQ_order INT UNSIGNED NOT NULL DEFAULT 0,
385 385
 					PRIMARY KEY  (QGQ_ID) ";
386
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
386
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
387 387
 
388 388
 
389 389
 
390
-		$table_name='esp_question_option';
391
-		$sql="QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
390
+		$table_name = 'esp_question_option';
391
+		$sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
392 392
 					QSO_value VARCHAR(255) NOT NULL,
393 393
 					QSO_desc TEXT NOT NULL,
394 394
 					QST_ID INT UNSIGNED NOT NULL,
395 395
 					QSO_order INT UNSIGNED NOT NULL DEFAULT 0,
396 396
 					QSO_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
397 397
 					PRIMARY KEY  (QSO_ID)";
398
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
398
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
399 399
 
400 400
 
401 401
 
@@ -428,8 +428,8 @@  discard block
 block discarded – undo
428 428
 
429 429
 
430 430
 
431
-		$table_name='esp_checkin';
432
-		$sql="CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
431
+		$table_name = 'esp_checkin';
432
+		$sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
433 433
 					REG_ID INT(10) UNSIGNED NOT NULL,
434 434
 					DTT_ID INT(10) UNSIGNED NOT NULL,
435 435
 					CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
 		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
504 504
 
505 505
 
506
-		$script_with_defaults = EE_Registry::instance()->load_dms( 'Core_4_1_0' );
506
+		$script_with_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
507 507
 		//setting up the DEFAULT stats and countries is also essential for the data migrations to run
508 508
 		//(because many need to convert old string states to foreign keys into the states table)
509 509
 		$script_with_defaults->insert_default_states();
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
 		return true;
526 526
 	}
527 527
 
528
-	public function migration_page_hooks(){
528
+	public function migration_page_hooks() {
529 529
 
530 530
 	}
531 531
 
@@ -541,34 +541,34 @@  discard block
 block discarded – undo
541 541
 
542 542
 		global $wpdb;
543 543
 		$ticket_table = $wpdb->prefix."esp_ticket";
544
-		if ( $this->_get_table_analysis()->tableExists( $ticket_table ) ) {
544
+		if ($this->_get_table_analysis()->tableExists($ticket_table)) {
545 545
 
546
-			$SQL = 'SELECT COUNT(TKT_ID) FROM ' . $ticket_table;
546
+			$SQL = 'SELECT COUNT(TKT_ID) FROM '.$ticket_table;
547 547
 			$tickets_exist = $wpdb->get_var($SQL);
548 548
 
549
-			if ( ! $tickets_exist ) {
549
+			if ( ! $tickets_exist) {
550 550
 				$SQL = "INSERT INTO $ticket_table
551 551
 					( TKT_ID, TTM_ID, TKT_name, TKT_description, TKT_qty, TKT_sold, TKT_uses, TKT_required, TKT_min, TKT_max, TKT_price, TKT_start_date, TKT_end_date, TKT_taxable, TKT_order, TKT_row, TKT_is_default, TKT_parent, TKT_deleted ) VALUES
552
-					( 1, 0, '" . __("Free Ticket", "event_espresso") . "', '', 100, 0, -1, 0, 0, -1, 0.00, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, 0, 1, 1, 0, 0);";
553
-				$SQL = apply_filters( 'FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL', $SQL );
552
+					( 1, 0, '".__("Free Ticket", "event_espresso")."', '', 100, 0, -1, 0, 0, -1, 0.00, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, 0, 1, 1, 0, 0);";
553
+				$SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL', $SQL);
554 554
 				$wpdb->query($SQL);
555 555
 			}
556 556
 		}
557 557
 		$ticket_price_table = $wpdb->prefix."esp_ticket_price";
558 558
 
559
-		if ( $this->_get_table_analysis()->tableExists( $ticket_price_table ) ) {
559
+		if ($this->_get_table_analysis()->tableExists($ticket_price_table)) {
560 560
 
561
-			$SQL = 'SELECT COUNT(TKP_ID) FROM ' . $ticket_price_table;
561
+			$SQL = 'SELECT COUNT(TKP_ID) FROM '.$ticket_price_table;
562 562
 			$ticket_prc_exist = $wpdb->get_var($SQL);
563 563
 
564
-			if ( ! $ticket_prc_exist ) {
564
+			if ( ! $ticket_prc_exist) {
565 565
 
566 566
 				$SQL = "INSERT INTO $ticket_price_table
567 567
 				( TKP_ID, TKT_ID, PRC_ID ) VALUES
568 568
 				( 1, 1, 1 )
569 569
 				";
570 570
 
571
-				$SQL = apply_filters( 'FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL__ticket_price', $SQL );
571
+				$SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL__ticket_price', $SQL);
572 572
 				$wpdb->query($SQL);
573 573
 			}
574 574
 		}
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_DMS_Core_4_5_0.dms.php 1 patch
Spacing   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -15,16 +15,16 @@  discard block
 block discarded – undo
15 15
 //(all other times it gets resurrected from a wordpress option)
16 16
 $stages = glob(EE_CORE.'data_migration_scripts/4_5_0_stages/*');
17 17
 $class_to_filepath = array();
18
-foreach($stages as $filepath){
18
+foreach ($stages as $filepath) {
19 19
 	$matches = array();
20
-	preg_match('~4_5_0_stages/(.*).dmsstage.php~',$filepath,$matches);
20
+	preg_match('~4_5_0_stages/(.*).dmsstage.php~', $filepath, $matches);
21 21
 	$class_to_filepath[$matches[1]] = $filepath;
22 22
 }
23 23
 //give addons a chance to autoload their stages too
24
-$class_to_filepath = apply_filters('FHEE__EE_DMS_4_5_0__autoloaded_stages',$class_to_filepath);
24
+$class_to_filepath = apply_filters('FHEE__EE_DMS_4_5_0__autoloaded_stages', $class_to_filepath);
25 25
 EEH_Autoloader::register_autoloader($class_to_filepath);
26 26
 
27
-class EE_DMS_Core_4_5_0 extends EE_Data_Migration_Script_Base{
27
+class EE_DMS_Core_4_5_0 extends EE_Data_Migration_Script_Base {
28 28
 
29 29
 
30 30
 
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	 * @param TableManager  $table_manager
35 35
 	 * @param TableAnalysis $table_analysis
36 36
 	 */
37
-	public function __construct( TableManager $table_manager = null, TableAnalysis $table_analysis = null ) {
37
+	public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) {
38 38
 		$this->_pretty_name = __("Data Migration to Event Espresso 4.5.0.P", "event_espresso");
39 39
 		$this->_priority = 10;
40 40
 		$this->_migration_stages = array(
@@ -44,21 +44,21 @@  discard block
 block discarded – undo
44 44
 			new EE_DMS_4_5_0_update_wp_user_for_question_groups(),
45 45
 			new EE_DMS_4_5_0_invoice_settings(),
46 46
 			);
47
-		parent::__construct( $table_manager, $table_analysis );
47
+		parent::__construct($table_manager, $table_analysis);
48 48
 	}
49 49
 
50 50
 
51 51
 
52 52
 	public function can_migrate_from_version($version_array) {
53 53
 		$version_string = $version_array['Core'];
54
-		if ( version_compare( $version_string, '4.5.0', '<=' ) && version_compare( $version_string, '4.3.0', '>=' ) ) {
54
+		if (version_compare($version_string, '4.5.0', '<=') && version_compare($version_string, '4.3.0', '>=')) {
55 55
 //			echo "$version_string can be migrated from";
56 56
 			return true;
57
-		}elseif( ! $version_string ){
57
+		}elseif ( ! $version_string) {
58 58
 //			echo "no version string provided: $version_string";
59 59
 			//no version string provided... this must be pre 4.3
60
-			return false;//changed mind. dont want people thinking they should migrate yet because they cant
61
-		}else{
60
+			return false; //changed mind. dont want people thinking they should migrate yet because they cant
61
+		} else {
62 62
 //			echo "$version_string doesnt apply";
63 63
 			return false;
64 64
 		}
@@ -68,14 +68,14 @@  discard block
 block discarded – undo
68 68
 	}
69 69
 	public function schema_changes_before_migration() {
70 70
 		//relies on 4.1's EEH_Activation::create_table
71
-		require_once( EE_HELPERS . 'EEH_Activation.helper.php' );
72
-		$table_name='esp_answer';
73
-		$sql=" ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
71
+		require_once(EE_HELPERS.'EEH_Activation.helper.php');
72
+		$table_name = 'esp_answer';
73
+		$sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
74 74
 					REG_ID INT UNSIGNED NOT NULL,
75 75
 					QST_ID INT UNSIGNED NOT NULL,
76 76
 					ANS_value TEXT NOT NULL,
77 77
 					PRIMARY KEY  (ANS_ID)";
78
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
78
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
79 79
 
80 80
 		$table_name = 'esp_attendee_meta';
81 81
 		$sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 					  CNT_is_EU TINYINT(1) DEFAULT '0',
115 115
 					  CNT_active TINYINT(1) DEFAULT '0',
116 116
 					  PRIMARY KEY  (CNT_ISO)";
117
-		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB' );
117
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
118 118
 
119 119
 		$table_name = 'esp_datetime';
120 120
 		$sql = "DTT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 
136 136
 
137 137
 
138
-		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB' );
138
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
139 139
 		$table_name = 'esp_event_meta';
140 140
 		$sql = "
141 141
 			EVTM_ID INT NOT NULL AUTO_INCREMENT,
@@ -152,41 +152,41 @@  discard block
 block discarded – undo
152 152
 			EVT_external_URL VARCHAR(200) NULL,
153 153
 			EVT_donations TINYINT(1) NULL,
154 154
 			PRIMARY KEY  (EVTM_ID)";
155
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
155
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
156 156
 
157 157
 
158 158
 
159
-		$table_name='esp_event_question_group';
160
-		$sql="EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
159
+		$table_name = 'esp_event_question_group';
160
+		$sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
161 161
 					EVT_ID BIGINT(20) UNSIGNED NOT NULL,
162 162
 					QSG_ID INT UNSIGNED NOT NULL,
163 163
 					EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
164 164
 					PRIMARY KEY  (EQG_ID)";
165
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
165
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
166 166
 
167 167
 
168 168
 
169
-		$table_name='esp_event_venue';
170
-		$sql="EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
169
+		$table_name = 'esp_event_venue';
170
+		$sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
171 171
 				EVT_ID BIGINT(20) UNSIGNED NOT NULL,
172 172
 				VNU_ID BIGINT(20) UNSIGNED NOT NULL,
173 173
 				EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
174 174
 				PRIMARY KEY  (EVV_ID)";
175
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
175
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
176 176
 
177 177
 
178 178
 
179
-		$table_name='esp_extra_meta';
180
-		$sql="EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
179
+		$table_name = 'esp_extra_meta';
180
+		$sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
181 181
 				OBJ_ID INT(11) DEFAULT NULL,
182 182
 				EXM_type VARCHAR(45) DEFAULT NULL,
183 183
 				EXM_key VARCHAR(45) DEFAULT NULL,
184 184
 				EXM_value TEXT,
185 185
 				PRIMARY KEY  (EXM_ID)";
186
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
186
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
187 187
 
188
-		$table_name='esp_line_item';
189
-		$sql="LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
188
+		$table_name = 'esp_line_item';
189
+		$sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
190 190
 				LIN_code VARCHAR(245) NOT NULL DEFAULT '',
191 191
 				TXN_ID INT(11) DEFAULT NULL,
192 192
 				LIN_name VARCHAR(245) NOT NULL DEFAULT '',
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 				OBJ_ID INT(11) DEFAULT NULL,
203 203
 				OBJ_type VARCHAR(45)DEFAULT NULL,
204 204
 				PRIMARY KEY  (LIN_ID)";
205
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB' );
205
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
206 206
 
207 207
 		$table_name = 'esp_message_template';
208 208
 		$sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 					KEY GRP_ID (GRP_ID)";
215 215
 		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
216 216
 
217
-		$this->_get_table_manager()->dropIndex( 'esp_message_template_group', 'EVT_ID' );
217
+		$this->_get_table_manager()->dropIndex('esp_message_template_group', 'EVT_ID');
218 218
 
219 219
 		$table_name = 'esp_message_template_group';
220 220
 		$sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 					MTP_is_active TINYINT(1) NOT NULL DEFAULT '1',
230 230
 					PRIMARY KEY  (GRP_ID),
231 231
 					KEY MTP_user_id (MTP_user_id)";
232
-		$this->_table_should_exist_previously( $table_name, $sql, 'ENGINE=InnoDB');
232
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
233 233
 
234 234
 		$table_name = 'esp_event_message_template';
235 235
 		$sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 					PRIMARY KEY  (EMT_ID),
239 239
 					KEY EVT_ID (EVT_ID),
240 240
 					KEY GRP_ID (GRP_ID)";
241
-		$this->_table_should_exist_previously( $table_name, $sql, 'ENGINE=InnoDB');
241
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
242 242
 
243 243
 
244 244
 		$table_name = 'esp_payment';
@@ -288,8 +288,8 @@  discard block
 block discarded – undo
288 288
 					  PRIMARY KEY  (TTM_ID)";
289 289
 		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
290 290
 
291
-		$table_name='esp_question';
292
-		$sql='QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
291
+		$table_name = 'esp_question';
292
+		$sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
293 293
 					QST_display_text TEXT NOT NULL,
294 294
 					QST_admin_label VARCHAR(255) NOT NULL,
295 295
 					QST_system VARCHAR(25) DEFAULT NULL,
@@ -301,27 +301,27 @@  discard block
 block discarded – undo
301 301
 					QST_wp_user BIGINT UNSIGNED NULL,
302 302
 					QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0,
303 303
 					PRIMARY KEY  (QST_ID)';
304
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
304
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
305 305
 
306
-		$table_name='esp_question_group_question';
307
-		$sql="QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
306
+		$table_name = 'esp_question_group_question';
307
+		$sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
308 308
 					QSG_ID INT UNSIGNED NOT NULL,
309 309
 					QST_ID INT UNSIGNED NOT NULL,
310 310
 					QGQ_order INT UNSIGNED NOT NULL DEFAULT 0,
311 311
 					PRIMARY KEY  (QGQ_ID) ";
312
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
312
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
313 313
 
314 314
 
315 315
 
316
-		$table_name='esp_question_option';
317
-		$sql="QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
316
+		$table_name = 'esp_question_option';
317
+		$sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
318 318
 					QSO_value VARCHAR(255) NOT NULL,
319 319
 					QSO_desc TEXT NOT NULL,
320 320
 					QST_ID INT UNSIGNED NOT NULL,
321 321
 					QSO_order INT UNSIGNED NOT NULL DEFAULT 0,
322 322
 					QSO_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
323 323
 					PRIMARY KEY  (QSO_ID)";
324
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
324
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
325 325
 
326 326
 
327 327
 
@@ -354,8 +354,8 @@  discard block
 block discarded – undo
354 354
 
355 355
 
356 356
 
357
-		$table_name='esp_checkin';
358
-		$sql="CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
357
+		$table_name = 'esp_checkin';
358
+		$sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
359 359
 					REG_ID INT(10) UNSIGNED NOT NULL,
360 360
 					DTT_ID INT(10) UNSIGNED NOT NULL,
361 361
 					CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
 					  PRC_wp_user BIGINT UNSIGNED NULL,
444 444
 					  PRC_parent INT(10) UNSIGNED DEFAULT 0,
445 445
 					  PRIMARY KEY  (PRC_ID)";
446
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
446
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
447 447
 
448 448
 		$table_name = "esp_price_type";
449 449
 		$sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -480,12 +480,12 @@  discard block
 block discarded – undo
480 480
 					  TKT_parent INT(10) UNSIGNED DEFAULT '0',
481 481
 					  TKT_deleted TINYINT(1) NOT NULL DEFAULT '0',
482 482
 					  PRIMARY KEY  (TKT_ID)";
483
-		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB' );
483
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
484 484
 
485
-		$this->_get_table_manager()->dropIndex( 'esp_question_group', 'QSG_identifier_UNIQUE' );
485
+		$this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE');
486 486
 
487 487
 		$table_name = 'esp_question_group';
488
-		$sql='QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
488
+		$sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
489 489
 					QSG_name VARCHAR(255) NOT NULL,
490 490
 					QSG_identifier VARCHAR(100) NOT NULL,
491 491
 					QSG_desc TEXT NULL,
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
 					QSG_wp_user BIGINT UNSIGNED NULL,
498 498
 					PRIMARY KEY  (QSG_ID),
499 499
 					UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier ASC)';
500
-		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB' );
500
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
501 501
 
502 502
 		$script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
503 503
 
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
 		return true;
522 522
 	}
523 523
 
524
-	public function migration_page_hooks(){
524
+	public function migration_page_hooks() {
525 525
 
526 526
 	}
527 527
 
@@ -535,21 +535,21 @@  discard block
 block discarded – undo
535 535
 		global $wpdb;
536 536
 		$price_type_table = $wpdb->prefix."esp_price_type";
537 537
 
538
-		if ( $this->_get_table_analysis()->tableExists( $price_type_table ) ) {
538
+		if ($this->_get_table_analysis()->tableExists($price_type_table)) {
539 539
 
540
-			$SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table;
541
-			$price_types_exist = $wpdb->get_var( $SQL );
540
+			$SQL = 'SELECT COUNT(PRT_ID) FROM '.$price_type_table;
541
+			$price_types_exist = $wpdb->get_var($SQL);
542 542
 
543
-			if ( ! $price_types_exist ) {
543
+			if ( ! $price_types_exist) {
544 544
 				$user_id = EEH_Activation::get_default_creator_id();
545 545
 				$SQL = "INSERT INTO $price_type_table ( PRT_ID, PRT_name, PBT_ID, PRT_is_percent, PRT_order, PRT_wp_user, PRT_deleted ) VALUES
546
-							(1, '" . __('Base Price', 'event_espresso') . "', 1,  0, 0, $user_id, 0),
547
-							(2, '" . __('Percent Discount', 'event_espresso') . "', 2,  1, 20, $user_id, 0),
548
-							(3, '" . __('Dollar Discount', 'event_espresso') . "', 2,  0, 30, $user_id, 0),
549
-							(4, '" . __('Percent Surcharge', 'event_espresso') . "', 3,  1, 40, $user_id,  0),
550
-							(5, '" . __('Dollar Surcharge', 'event_espresso') . "', 3,  0, 50, $user_id, 0);";
551
-				$SQL = apply_filters( 'FHEE__EE_DMS_4_5_0__insert_default_price_types__SQL', $SQL );
552
-				$wpdb->query( $SQL );
546
+							(1, '".__('Base Price', 'event_espresso')."', 1,  0, 0, $user_id, 0),
547
+							(2, '".__('Percent Discount', 'event_espresso')."', 2,  1, 20, $user_id, 0),
548
+							(3, '".__('Dollar Discount', 'event_espresso')."', 2,  0, 30, $user_id, 0),
549
+							(4, '".__('Percent Surcharge', 'event_espresso')."', 3,  1, 40, $user_id,  0),
550
+							(5, '".__('Dollar Surcharge', 'event_espresso')."', 3,  0, 50, $user_id, 0);";
551
+				$SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_price_types__SQL', $SQL);
552
+				$wpdb->query($SQL);
553 553
 			}
554 554
 		}
555 555
 	}
@@ -569,17 +569,17 @@  discard block
 block discarded – undo
569 569
 		global $wpdb;
570 570
 		$price_table = $wpdb->prefix."esp_price";
571 571
 
572
-		if ( $this->_get_table_analysis()->tableExists( $price_table ) ) {
572
+		if ($this->_get_table_analysis()->tableExists($price_table)) {
573 573
 
574
-			$SQL = 'SELECT COUNT(PRC_ID) FROM ' .$price_table;
575
-			$prices_exist = $wpdb->get_var( $SQL );
574
+			$SQL = 'SELECT COUNT(PRC_ID) FROM '.$price_table;
575
+			$prices_exist = $wpdb->get_var($SQL);
576 576
 
577
-			if ( ! $prices_exist ) {
577
+			if ( ! $prices_exist) {
578 578
 				$user_id = EEH_Activation::get_default_creator_id();
579 579
 				$SQL = "INSERT INTO $price_table
580 580
 							(PRC_ID, PRT_ID, PRC_amount, PRC_name, PRC_desc,  PRC_is_default, PRC_overrides, PRC_wp_user, PRC_order, PRC_deleted, PRC_parent ) VALUES
581 581
 							(1, 1, '0.00', 'Free Admission', '', 1, NULL, $user_id, 0, 0, 0);";
582
-				$SQL = apply_filters( 'FHEE__EE_DMS_4_5_0__insert_default_prices__SQL', $SQL );
582
+				$SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_prices__SQL', $SQL);
583 583
 				$wpdb->query($SQL);
584 584
 			}
585 585
 		}
@@ -597,35 +597,35 @@  discard block
 block discarded – undo
597 597
 
598 598
 		global $wpdb;
599 599
 		$ticket_table = $wpdb->prefix."esp_ticket";
600
-		if ( $this->_get_table_analysis()->tableExists( $ticket_table ) ) {
600
+		if ($this->_get_table_analysis()->tableExists($ticket_table)) {
601 601
 
602
-			$SQL = 'SELECT COUNT(TKT_ID) FROM ' . $ticket_table;
602
+			$SQL = 'SELECT COUNT(TKT_ID) FROM '.$ticket_table;
603 603
 			$tickets_exist = $wpdb->get_var($SQL);
604 604
 
605
-			if ( ! $tickets_exist ) {
605
+			if ( ! $tickets_exist) {
606 606
 				$user_id = EEH_Activation::get_default_creator_id();
607 607
 				$SQL = "INSERT INTO $ticket_table
608 608
 					( TKT_ID, TTM_ID, TKT_name, TKT_description, TKT_qty, TKT_sold, TKT_uses, TKT_required, TKT_min, TKT_max, TKT_price, TKT_start_date, TKT_end_date, TKT_taxable, TKT_order, TKT_row, TKT_is_default, TKT_parent, TKT_wp_user, TKT_deleted ) VALUES
609
-					( 1, 0, '" . __("Free Ticket", "event_espresso") . "', '', 100, 0, -1, 0, 0, -1, 0.00, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, 0, 1, 1, 0, $user_id, 0);";
610
-				$SQL = apply_filters( 'FHEE__EE_DMS_4_5_0__insert_default_tickets__SQL', $SQL );
609
+					( 1, 0, '".__("Free Ticket", "event_espresso")."', '', 100, 0, -1, 0, 0, -1, 0.00, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, 0, 1, 1, 0, $user_id, 0);";
610
+				$SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_tickets__SQL', $SQL);
611 611
 				$wpdb->query($SQL);
612 612
 			}
613 613
 		}
614 614
 		$ticket_price_table = $wpdb->prefix."esp_ticket_price";
615 615
 
616
-		if ( $this->_get_table_analysis()->tableExists( $ticket_price_table ) ) {
616
+		if ($this->_get_table_analysis()->tableExists($ticket_price_table)) {
617 617
 
618
-			$SQL = 'SELECT COUNT(TKP_ID) FROM ' . $ticket_price_table;
618
+			$SQL = 'SELECT COUNT(TKP_ID) FROM '.$ticket_price_table;
619 619
 			$ticket_prc_exist = $wpdb->get_var($SQL);
620 620
 
621
-			if ( ! $ticket_prc_exist ) {
621
+			if ( ! $ticket_prc_exist) {
622 622
 
623 623
 				$SQL = "INSERT INTO $ticket_price_table
624 624
 				( TKP_ID, TKT_ID, PRC_ID ) VALUES
625 625
 				( 1, 1, 1 )
626 626
 				";
627 627
 
628
-				$SQL = apply_filters( 'FHEE__EE_DMS_4_5_0__insert_default_tickets__SQL__ticket_price', $SQL );
628
+				$SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_tickets__SQL__ticket_price', $SQL);
629 629
 				$wpdb->query($SQL);
630 630
 			}
631 631
 		}
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_DMS_Core_4_1_0.dms.php 1 patch
Spacing   +206 added lines, -206 removed lines patch added patch discarded remove patch
@@ -11,15 +11,15 @@  discard block
 block discarded – undo
11 11
 //(all other times it gets resurrected from a wordpress option)
12 12
 $stages = glob(EE_CORE.'data_migration_scripts/4_1_0_stages/*');
13 13
 $class_to_filepath = array();
14
-if ( ! empty( $stages ) ) {
15
-	foreach($stages as $filepath){
14
+if ( ! empty($stages)) {
15
+	foreach ($stages as $filepath) {
16 16
 		$matches = array();
17
-		preg_match('~4_1_0_stages/(.*).dmsstage.php~',$filepath,$matches);
17
+		preg_match('~4_1_0_stages/(.*).dmsstage.php~', $filepath, $matches);
18 18
 		$class_to_filepath[$matches[1]] = $filepath;
19 19
 	}
20 20
 }
21 21
 //give addons a chance to autoload their stages too
22
-$class_to_filepath = apply_filters('FHEE__EE_DMS_4_1_0__autoloaded_stages',$class_to_filepath);
22
+$class_to_filepath = apply_filters('FHEE__EE_DMS_4_1_0__autoloaded_stages', $class_to_filepath);
23 23
 EEH_Autoloader::register_autoloader($class_to_filepath);
24 24
 
25 25
 /**
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
  * --a function named update_espresso_config() which saves the EE_Config object to the database
38 38
  * --...and all its subclasses... really, you're best off copying the whole thing when 4.1 is released into this file and wrapping its declaration in if( ! class_exists()){...}
39 39
  */
40
-class EE_DMS_Core_4_1_0 extends EE_Data_Migration_Script_Base{
40
+class EE_DMS_Core_4_1_0 extends EE_Data_Migration_Script_Base {
41 41
 
42 42
 
43 43
 
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 	 * @param TableManager  $table_manager
48 48
 	 * @param TableAnalysis $table_analysis
49 49
 	 */
50
-	public function __construct( TableManager $table_manager = null, TableAnalysis $table_analysis = null ) {
50
+	public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) {
51 51
 		$this->_pretty_name = __("Data Migration to Event Espresso 4.1.0P", "event_espresso");
52 52
 		$this->_priority = 10;
53 53
 		$this->_migration_stages = array(
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 			new EE_DMS_4_1_0_answers(),
70 70
 			new EE_DMS_4_1_0_checkins(),
71 71
 		);
72
-		parent::__construct( $table_manager, $table_analysis );
72
+		parent::__construct($table_manager, $table_analysis);
73 73
 	}
74 74
 	/**
75 75
 	 * Checks if this 3.1 Check-in table exists. If it doesn't we can't migrate Check-ins
@@ -77,27 +77,27 @@  discard block
 block discarded – undo
77 77
 	 * @global wpdb $wpdb
78 78
 	 * @return boolean
79 79
 	 */
80
-	private function _checkin_table_exists(){
80
+	private function _checkin_table_exists() {
81 81
 		global $wpdb;
82 82
 		$results = $wpdb->get_results("SHOW TABLES LIKE '".$wpdb->prefix."events_attendee_checkin"."'");
83
-		if($results){
83
+		if ($results) {
84 84
 			return true;
85
-		}else{
85
+		} else {
86 86
 			return false;
87 87
 		}
88 88
 	}
89 89
 
90 90
 	public function can_migrate_from_version($version_array) {
91 91
 		$version_string = $version_array['Core'];
92
-		if ( version_compare( $version_string, '4.0.0', '<=' ) && version_compare( $version_string, '3.1.26', '>=' ) ) {
92
+		if (version_compare($version_string, '4.0.0', '<=') && version_compare($version_string, '3.1.26', '>=')) {
93 93
 //			echo "$version_string can be migrated fro";
94 94
 			return true;
95
-		}elseif( ! $version_string ){
95
+		}elseif ( ! $version_string) {
96 96
 //			echo "no version string provided: $version_string";
97 97
 			//no version string provided... this must be pre 4.1
98 98
 			//because since 4.1 we're
99
-			return false;//changed mind. dont want people thinking they should migrate yet because they cant
100
-		}else{
99
+			return false; //changed mind. dont want people thinking they should migrate yet because they cant
100
+		} else {
101 101
 //			echo "$version_string doesnt apply";
102 102
 			return false;
103 103
 		}
@@ -107,15 +107,15 @@  discard block
 block discarded – undo
107 107
 	}
108 108
 	public function schema_changes_before_migration() {
109 109
 		//relies on 4.1's EEH_Activation::create_table
110
-		require_once( EE_HELPERS . 'EEH_Activation.helper.php' );
110
+		require_once(EE_HELPERS.'EEH_Activation.helper.php');
111 111
 
112
-		$table_name='esp_answer';
113
-		$sql=" ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
112
+		$table_name = 'esp_answer';
113
+		$sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
114 114
 					REG_ID INT UNSIGNED NOT NULL,
115 115
 					QST_ID INT UNSIGNED NOT NULL,
116 116
 					ANS_value TEXT NOT NULL,
117 117
 					PRIMARY KEY  (ANS_ID)";
118
-		$this->_table_is_new_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
118
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
119 119
 
120 120
 		$table_name = 'esp_attendee_meta';
121 121
 		$sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 					  CNT_is_EU TINYINT(1) DEFAULT '0',
156 156
 					  CNT_active TINYINT(1) DEFAULT '0',
157 157
 					  PRIMARY KEY  (CNT_ISO)";
158
-		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB' );
158
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
159 159
 
160 160
 
161 161
 
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 
177 177
 
178 178
 
179
-		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB' );
179
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
180 180
 		$table_name = 'esp_event_meta';
181 181
 		$sql = "
182 182
 			EVTM_ID INT NOT NULL AUTO_INCREMENT,
@@ -193,41 +193,41 @@  discard block
 block discarded – undo
193 193
 			EVT_external_URL VARCHAR(200) NULL,
194 194
 			EVT_donations TINYINT(1) NULL,
195 195
 			PRIMARY KEY  (EVTM_ID)";
196
-		$this->_table_is_new_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
196
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
197 197
 
198 198
 
199 199
 
200
-		$table_name='esp_event_question_group';
201
-		$sql="EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
200
+		$table_name = 'esp_event_question_group';
201
+		$sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
202 202
 					EVT_ID BIGINT(20) UNSIGNED NOT NULL,
203 203
 					QSG_ID INT UNSIGNED NOT NULL,
204 204
 					EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
205 205
 					PRIMARY KEY  (EQG_ID)";
206
-		$this->_table_is_new_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
206
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
207 207
 
208 208
 
209 209
 
210
-		$table_name='esp_event_venue';
211
-		$sql="EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
210
+		$table_name = 'esp_event_venue';
211
+		$sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
212 212
 				EVT_ID BIGINT(20) UNSIGNED NOT NULL,
213 213
 				VNU_ID BIGINT(20) UNSIGNED NOT NULL,
214 214
 				EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
215 215
 				PRIMARY KEY  (EVV_ID)";
216
-		$this->_table_is_new_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
216
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
217 217
 
218 218
 
219 219
 
220
-		$table_name='esp_extra_meta';
221
-		$sql="EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
220
+		$table_name = 'esp_extra_meta';
221
+		$sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
222 222
 				OBJ_ID INT(11) DEFAULT NULL,
223 223
 				EXM_type VARCHAR(45) DEFAULT NULL,
224 224
 				EXM_key VARCHAR(45) DEFAULT NULL,
225 225
 				EXM_value TEXT,
226 226
 				PRIMARY KEY  (EXM_ID)";
227
-		$this->_table_is_new_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
227
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
228 228
 
229
-		$table_name='esp_line_item';
230
-		$sql="LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
229
+		$table_name = 'esp_line_item';
230
+		$sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
231 231
 				LIN_code VARCHAR(245) NOT NULL DEFAULT '',
232 232
 				TXN_ID INT(11) DEFAULT NULL,
233 233
 				LIN_name VARCHAR(245) NOT NULL DEFAULT '',
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 				OBJ_ID INT(11) DEFAULT NULL,
244 244
 				OBJ_type VARCHAR(45)DEFAULT NULL,
245 245
 				PRIMARY KEY  (LIN_ID)";
246
-		$this->_table_is_new_in_this_version($table_name,$sql, 'ENGINE=InnoDB' );
246
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
247 247
 
248 248
 		$table_name = 'esp_message_template';
249 249
 		$sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 					PRIMARY KEY  (GRP_ID),
271 271
 					KEY EVT_ID (EVT_ID),
272 272
 					KEY MTP_user_id (MTP_user_id)";
273
-		$this->_table_is_new_in_this_version( $table_name, $sql, 'ENGINE=InnoDB');
273
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
274 274
 
275 275
 
276 276
 
@@ -378,8 +378,8 @@  discard block
 block discarded – undo
378 378
 
379 379
 
380 380
 
381
-		$table_name='esp_question';
382
-		$sql='QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
381
+		$table_name = 'esp_question';
382
+		$sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
383 383
 					QST_display_text TEXT NOT NULL,
384 384
 					QST_admin_label VARCHAR(255) NOT NULL,
385 385
 					QST_system VARCHAR(25) DEFAULT NULL,
@@ -391,12 +391,12 @@  discard block
 block discarded – undo
391 391
 					QST_wp_user BIGINT UNSIGNED NULL,
392 392
 					QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0,
393 393
 					PRIMARY KEY  (QST_ID)';
394
-		$this->_table_is_new_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
394
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
395 395
 
396
-		$this->_get_table_manager()->dropIndex( 'esp_question_group', 'QSG_identifier_UNIQUE' );
396
+		$this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE');
397 397
 
398 398
 		$table_name = 'esp_question_group';
399
-		$sql='QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
399
+		$sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
400 400
 					QSG_name VARCHAR(255) NOT NULL,
401 401
 					QSG_identifier VARCHAR(100) NOT NULL,
402 402
 					QSG_desc TEXT NULL,
@@ -407,27 +407,27 @@  discard block
 block discarded – undo
407 407
 					QSG_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
408 408
 					PRIMARY KEY  (QSG_ID),
409 409
 					UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier ASC)';
410
-		$this->_table_is_new_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
410
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
411 411
 
412 412
 
413 413
 
414
-		$table_name='esp_question_group_question';
415
-		$sql="QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
414
+		$table_name = 'esp_question_group_question';
415
+		$sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
416 416
 					QSG_ID INT UNSIGNED NOT NULL,
417 417
 					QST_ID INT UNSIGNED NOT NULL,
418 418
 					PRIMARY KEY  (QGQ_ID) ";
419
-		$this->_table_is_new_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
419
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
420 420
 
421 421
 
422 422
 
423
-		$table_name='esp_question_option';
424
-		$sql="QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
423
+		$table_name = 'esp_question_option';
424
+		$sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
425 425
 					QSO_value VARCHAR(255) NOT NULL,
426 426
 					QSO_desc TEXT NOT NULL,
427 427
 					QST_ID INT UNSIGNED NOT NULL,
428 428
 					QSO_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
429 429
 					PRIMARY KEY  (QSO_ID)";
430
-		$this->_table_is_new_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
430
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
431 431
 
432 432
 
433 433
 
@@ -460,8 +460,8 @@  discard block
 block discarded – undo
460 460
 
461 461
 
462 462
 
463
-		$table_name='esp_checkin';
464
-		$sql="CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
463
+		$table_name = 'esp_checkin';
464
+		$sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
465 465
 					REG_ID INT(10) UNSIGNED NOT NULL,
466 466
 					DTT_ID INT(10) UNSIGNED NOT NULL,
467 467
 					CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
@@ -568,12 +568,12 @@  discard block
 block discarded – undo
568 568
 
569 569
 		global $wpdb;
570 570
 		$state_table = $wpdb->prefix."esp_state";
571
-		if ( $this->_get_table_analysis()->tableExists( $state_table ) ) {
571
+		if ($this->_get_table_analysis()->tableExists($state_table)) {
572 572
 
573
-			$SQL = "SELECT COUNT('STA_ID') FROM " . $state_table;
573
+			$SQL = "SELECT COUNT('STA_ID') FROM ".$state_table;
574 574
 			$states = $wpdb->get_var($SQL);
575
-			if ( ! $states ) {
576
-				$SQL = "INSERT INTO " . $state_table . "
575
+			if ( ! $states) {
576
+				$SQL = "INSERT INTO ".$state_table."
577 577
 				(STA_ID, CNT_ISO, STA_abbrev, STA_name, STA_active) VALUES
578 578
 				(1, 'US', 'AK', 'Alaska', 1),
579 579
 				(2, 'US', 'AL', 'Alabama', 1),
@@ -660,12 +660,12 @@  discard block
 block discarded – undo
660 660
 
661 661
 		global $wpdb;
662 662
 		$country_table = $wpdb->prefix."esp_country";
663
-		if ( $this->_get_table_analysis()->tableExists( $country_table ) ) {
663
+		if ($this->_get_table_analysis()->tableExists($country_table)) {
664 664
 
665
-			$SQL = "SELECT COUNT('CNT_ISO') FROM " . $country_table;
665
+			$SQL = "SELECT COUNT('CNT_ISO') FROM ".$country_table;
666 666
 			$countries = $wpdb->get_var($SQL);
667
-			if ( ! $countries ) {
668
-				$SQL = "INSERT INTO " . $country_table . "
667
+			if ( ! $countries) {
668
+				$SQL = "INSERT INTO ".$country_table."
669 669
 				(CNT_ISO, CNT_ISO3, RGN_ID, CNT_name, CNT_cur_code, CNT_cur_single, CNT_cur_plural, CNT_cur_sign, CNT_cur_sign_b4, CNT_cur_dec_plc, CNT_tel_code, CNT_is_EU, CNT_active) VALUES
670 670
 				('AD', 'AND', 0, 'Andorra', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+376', 0, 0),
671 671
 				('AE', 'ARE', 0, 'United Arab Emirates', 'AED', 'Dirham', 'Dirhams', 'د.إ', 1, 2, '+971', 0, 0),
@@ -912,20 +912,20 @@  discard block
 block discarded – undo
912 912
 		global $wpdb;
913 913
 		$price_type_table = $wpdb->prefix."esp_price_type";
914 914
 
915
-		if ( $this->_get_table_analysis()->tableExists( $price_type_table ) ) {
915
+		if ($this->_get_table_analysis()->tableExists($price_type_table)) {
916 916
 
917
-			$SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table;
918
-			$price_types_exist = $wpdb->get_var( $SQL );
917
+			$SQL = 'SELECT COUNT(PRT_ID) FROM '.$price_type_table;
918
+			$price_types_exist = $wpdb->get_var($SQL);
919 919
 
920
-			if ( ! $price_types_exist ) {
920
+			if ( ! $price_types_exist) {
921 921
 				$SQL = "INSERT INTO $price_type_table ( PRT_ID, PRT_name, PBT_ID, PRT_is_percent, PRT_order, PRT_deleted ) VALUES
922
-							(1, '" . __('Base Price', 'event_espresso') . "', 1,  0, 0, 0),
923
-							(2, '" . __('Percent Discount', 'event_espresso') . "', 2,  1, 20, 0),
924
-							(3, '" . __('Fixed Discount', 'event_espresso') . "', 2,  0, 30, 0),
925
-							(4, '" . __('Percent Surcharge', 'event_espresso') . "', 3,  1, 40, 0),
926
-							(5, '" . __('Fixed Surcharge', 'event_espresso') . "', 3,  0, 50, 0);";
927
-				$SQL = apply_filters( 'FHEE__EE_DMS_4_1_0__insert_default_price_types__SQL', $SQL );
928
-				$wpdb->query( $SQL );
922
+							(1, '".__('Base Price', 'event_espresso')."', 1,  0, 0, 0),
923
+							(2, '" . __('Percent Discount', 'event_espresso')."', 2,  1, 20, 0),
924
+							(3, '" . __('Fixed Discount', 'event_espresso')."', 2,  0, 30, 0),
925
+							(4, '" . __('Percent Surcharge', 'event_espresso')."', 3,  1, 40, 0),
926
+							(5, '" . __('Fixed Surcharge', 'event_espresso')."', 3,  0, 50, 0);";
927
+				$SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_price_types__SQL', $SQL);
928
+				$wpdb->query($SQL);
929 929
 			}
930 930
 		}
931 931
 	}
@@ -945,16 +945,16 @@  discard block
 block discarded – undo
945 945
 		global $wpdb;
946 946
 		$price_table = $wpdb->prefix."esp_price";
947 947
 
948
-		if ( $this->_get_table_analysis()->tableExists(  $price_table ) ) {
948
+		if ($this->_get_table_analysis()->tableExists($price_table)) {
949 949
 
950
-			$SQL = 'SELECT COUNT(PRC_ID) FROM ' .$price_table;
951
-			$prices_exist = $wpdb->get_var( $SQL );
950
+			$SQL = 'SELECT COUNT(PRC_ID) FROM '.$price_table;
951
+			$prices_exist = $wpdb->get_var($SQL);
952 952
 
953
-			if ( ! $prices_exist ) {
953
+			if ( ! $prices_exist) {
954 954
 				$SQL = "INSERT INTO $price_table
955 955
 							(PRC_ID, PRT_ID, PRC_amount, PRC_name, PRC_desc,  PRC_is_default, PRC_overrides, PRC_order, PRC_deleted, PRC_parent ) VALUES
956 956
 							(1, 1, '0.00', 'Free Admission', '', 1, NULL, 0, 0, 0);";
957
-				$SQL = apply_filters( 'FHEE__EE_DMS_4_1_0__insert_default_prices__SQL', $SQL );
957
+				$SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_prices__SQL', $SQL);
958 958
 				$wpdb->query($SQL);
959 959
 			}
960 960
 		}
@@ -971,34 +971,34 @@  discard block
 block discarded – undo
971 971
 
972 972
 		global $wpdb;
973 973
 		$ticket_table = $wpdb->prefix."esp_ticket";
974
-		if ( $this->_get_table_analysis()->tableExists( $ticket_table ) ) {
974
+		if ($this->_get_table_analysis()->tableExists($ticket_table)) {
975 975
 
976
-			$SQL = 'SELECT COUNT(TKT_ID) FROM ' . $ticket_table;
976
+			$SQL = 'SELECT COUNT(TKT_ID) FROM '.$ticket_table;
977 977
 			$tickets_exist = $wpdb->get_var($SQL);
978 978
 
979
-			if ( ! $tickets_exist ) {
979
+			if ( ! $tickets_exist) {
980 980
 				$SQL = "INSERT INTO $ticket_table
981 981
 					( TKT_ID, TTM_ID, TKT_name, TKT_description, TKT_qty, TKT_sold, TKT_uses, TKT_min, TKT_max, TKT_price, TKT_start_date, TKT_end_date, TKT_taxable, TKT_order, TKT_row, TKT_is_default, TKT_parent, TKT_deleted ) VALUES
982
-					( 1, 0, '" . __("Free Ticket", "event_espresso") . "', '', 100, 0, -1, 0, -1, 0.00, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, 0, 1, 1, 0, 0);";
983
-				$SQL = apply_filters( 'FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL', $SQL );
982
+					( 1, 0, '".__("Free Ticket", "event_espresso")."', '', 100, 0, -1, 0, -1, 0.00, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, 0, 1, 1, 0, 0);";
983
+				$SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL', $SQL);
984 984
 				$wpdb->query($SQL);
985 985
 			}
986 986
 		}
987 987
 		$ticket_price_table = $wpdb->prefix."esp_ticket_price";
988 988
 
989
-		if ( $this->_get_table_analysis()->tableExists( $ticket_price_table ) ) {
989
+		if ($this->_get_table_analysis()->tableExists($ticket_price_table)) {
990 990
 
991
-			$SQL = 'SELECT COUNT(TKP_ID) FROM ' . $ticket_price_table;
991
+			$SQL = 'SELECT COUNT(TKP_ID) FROM '.$ticket_price_table;
992 992
 			$ticket_prc_exist = $wpdb->get_var($SQL);
993 993
 
994
-			if ( ! $ticket_prc_exist ) {
994
+			if ( ! $ticket_prc_exist) {
995 995
 
996 996
 				$SQL = "INSERT INTO $ticket_price_table
997 997
 				( TKP_ID, TKT_ID, PRC_ID ) VALUES
998 998
 				( 1, 1, 1 )
999 999
 				";
1000 1000
 
1001
-				$SQL = apply_filters( 'FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL__ticket_price', $SQL );
1001
+				$SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL__ticket_price', $SQL);
1002 1002
 				$wpdb->query($SQL);
1003 1003
 			}
1004 1004
 		}
@@ -1011,20 +1011,20 @@  discard block
 block discarded – undo
1011 1011
 	 * @param string $country_name
1012 1012
 	 * @return array where keys are columns, values are column values
1013 1013
 	 */
1014
-	public function get_or_create_country($country_name){
1015
-		if( ! $country_name ){
1014
+	public function get_or_create_country($country_name) {
1015
+		if ( ! $country_name) {
1016 1016
 			throw new EE_Error(__("Could not get a country because country name is blank", "event_espresso"));
1017 1017
 		}
1018 1018
 		global $wpdb;
1019 1019
 		$country_table = $wpdb->prefix."esp_country";
1020
-		if(is_int($country_name)){
1020
+		if (is_int($country_name)) {
1021 1021
 			$country_name = $this->get_iso_from_3_1_country_id($country_name);
1022 1022
 		}
1023 1023
 		$country = $wpdb->get_row($wpdb->prepare("SELECT * FROM $country_table WHERE
1024 1024
 			CNT_ISO LIKE %s OR
1025 1025
 			CNT_ISO3 LIKE %s OR
1026
-			CNT_name LIKE %s LIMIT 1",$country_name,$country_name,$country_name),ARRAY_A);
1027
-		if( ! $country ){
1026
+			CNT_name LIKE %s LIMIT 1", $country_name, $country_name, $country_name), ARRAY_A);
1027
+		if ( ! $country) {
1028 1028
 			//insert a new one then
1029 1029
 			$cols_n_values = array(
1030 1030
 				'CNT_ISO'=> $this->_find_available_country_iso(2),
@@ -1044,26 +1044,26 @@  discard block
 block discarded – undo
1044 1044
 				'CNT_active'=>true
1045 1045
 			);
1046 1046
 			$data_types = array(
1047
-				'%s',//CNT_ISO
1048
-				'%s',//CNT_ISO3
1049
-				'%d',//RGN_ID
1050
-				'%s',//CNT_name
1051
-				'%s',//CNT_cur_code
1052
-				'%s',//CNT_cur_single
1053
-				'%s',//CNT_cur_plural
1054
-				'%s',//CNT_cur_sign
1055
-				'%d',//CNT_cur_sign_b4
1056
-				'%d',//CNT_cur_dec_plc
1057
-				'%s',//CNT_cur_dec_mrk
1058
-				'%s',//CNT_cur_thsnds
1059
-				'%s',//CNT_tel_code
1060
-				'%d',//CNT_is_EU
1061
-				'%d',//CNT_active
1047
+				'%s', //CNT_ISO
1048
+				'%s', //CNT_ISO3
1049
+				'%d', //RGN_ID
1050
+				'%s', //CNT_name
1051
+				'%s', //CNT_cur_code
1052
+				'%s', //CNT_cur_single
1053
+				'%s', //CNT_cur_plural
1054
+				'%s', //CNT_cur_sign
1055
+				'%d', //CNT_cur_sign_b4
1056
+				'%d', //CNT_cur_dec_plc
1057
+				'%s', //CNT_cur_dec_mrk
1058
+				'%s', //CNT_cur_thsnds
1059
+				'%s', //CNT_tel_code
1060
+				'%d', //CNT_is_EU
1061
+				'%d', //CNT_active
1062 1062
 			);
1063 1063
 			$success = $wpdb->insert($country_table,
1064 1064
 					$cols_n_values,
1065 1065
 					$data_types);
1066
-			if( ! $success){
1066
+			if ( ! $success) {
1067 1067
 				throw new EE_Error($this->_create_error_message_for_db_insertion('N/A', array('country_id'=>$country_name), $country_table, $cols_n_values, $data_types));
1068 1068
 			}
1069 1069
 			$country = $cols_n_values;
@@ -1075,13 +1075,13 @@  discard block
 block discarded – undo
1075 1075
 	 * @global type $wpdb
1076 1076
 	 * @return string
1077 1077
 	 */
1078
-	private function _find_available_country_iso($num_letters = 2){
1078
+	private function _find_available_country_iso($num_letters = 2) {
1079 1079
 		global $wpdb;
1080 1080
 		$country_table = $wpdb->prefix."esp_country";
1081
-		do{
1081
+		do {
1082 1082
 			$current_iso = strtoupper(wp_generate_password($num_letters, false));
1083
-			$country_with_that_iso = $wpdb->get_var($wpdb->prepare("SELECT count(CNT_ISO) FROM ".$country_table." WHERE CNT_ISO=%s",$current_iso));
1084
-		}while(intval($country_with_that_iso));
1083
+			$country_with_that_iso = $wpdb->get_var($wpdb->prepare("SELECT count(CNT_ISO) FROM ".$country_table." WHERE CNT_ISO=%s", $current_iso));
1084
+		}while (intval($country_with_that_iso));
1085 1085
 		return $current_iso;
1086 1086
 	}
1087 1087
 
@@ -1092,14 +1092,14 @@  discard block
 block discarded – undo
1092 1092
 	 * @param string $state_name
1093 1093
 	 * @return array where keys are columns, values are column values
1094 1094
 	 */
1095
-	public function get_or_create_state($state_name,$country_name = ''){
1096
-		if( ! $state_name ){
1095
+	public function get_or_create_state($state_name, $country_name = '') {
1096
+		if ( ! $state_name) {
1097 1097
 			throw new EE_Error(__("Could not get-or-create state because no state name was provided", "event_espresso"));
1098 1098
 		}
1099
-		try{
1099
+		try {
1100 1100
 			$country = $this->get_or_create_country($country_name);
1101 1101
 			$country_iso = $country['CNT_ISO'];
1102
-		}catch(EE_Error $e){
1102
+		} catch (EE_Error $e) {
1103 1103
 			$country_iso = $this->get_default_country_iso();
1104 1104
 		}
1105 1105
 		global $wpdb;
@@ -1107,24 +1107,24 @@  discard block
 block discarded – undo
1107 1107
 		$state = $wpdb->get_row($wpdb->prepare("SELECT * FROM $state_table WHERE
1108 1108
 			(STA_abbrev LIKE %s OR
1109 1109
 			STA_name LIKE %s) AND
1110
-			CNT_ISO LIKE %s LIMIT 1",$state_name,$state_name,$country_iso),ARRAY_A);
1111
-		if ( ! $state){
1110
+			CNT_ISO LIKE %s LIMIT 1", $state_name, $state_name, $country_iso), ARRAY_A);
1111
+		if ( ! $state) {
1112 1112
 			//insert a new one then
1113 1113
 			$cols_n_values = array(
1114 1114
 				'CNT_ISO'=>$country_iso,
1115
-				'STA_abbrev'=>substr($state_name,0,6),
1115
+				'STA_abbrev'=>substr($state_name, 0, 6),
1116 1116
 				'STA_name'=>$state_name,
1117 1117
 				'STA_active'=>true
1118 1118
 			);
1119 1119
 			$data_types = array(
1120
-				'%s',//CNT_ISO
1121
-				'%s',//STA_abbrev
1122
-				'%s',//STA_name
1123
-				'%d',//STA_active
1120
+				'%s', //CNT_ISO
1121
+				'%s', //STA_abbrev
1122
+				'%s', //STA_name
1123
+				'%d', //STA_active
1124 1124
 			);
1125
-			$success = $wpdb->insert($state_table,$cols_n_values,$data_types);
1126
-			if ( ! $success ){
1127
-				throw new EE_Error($this->_create_error_message_for_db_insertion('N/A', array('state'=>$state_name,'country_id'=>$country_name), $state_table, $cols_n_values, $data_types));
1125
+			$success = $wpdb->insert($state_table, $cols_n_values, $data_types);
1126
+			if ( ! $success) {
1127
+				throw new EE_Error($this->_create_error_message_for_db_insertion('N/A', array('state'=>$state_name, 'country_id'=>$country_name), $state_table, $cols_n_values, $data_types));
1128 1128
 			}
1129 1129
 			$state = $cols_n_values;
1130 1130
 			$state['STA_ID'] = $wpdb->insert_id;
@@ -1137,21 +1137,21 @@  discard block
 block discarded – undo
1137 1137
 	 * @param type $timeString
1138 1138
 	 * @return string in the php DATETIME format: "G:i" (24-hour format hour with leading zeros, a colon, and minutes with leading zeros)
1139 1139
 	 */
1140
-	public function convertTimeFromAMPM($timeString){
1140
+	public function convertTimeFromAMPM($timeString) {
1141 1141
 		$matches = array();
1142
-		preg_match("~(\\d*):(\\d*)~",$timeString,$matches);
1143
-		if( ! $matches || count($matches)<3){
1142
+		preg_match("~(\\d*):(\\d*)~", $timeString, $matches);
1143
+		if ( ! $matches || count($matches) < 3) {
1144 1144
 			$hour = '00';
1145 1145
 			$minutes = '00';
1146
-		}else{
1146
+		} else {
1147 1147
 			$hour = intval($matches[1]);
1148 1148
 			$minutes = $matches[2];
1149 1149
 		}
1150
-		if(strpos($timeString, 'PM') || strpos($timeString, 'pm')){
1150
+		if (strpos($timeString, 'PM') || strpos($timeString, 'pm')) {
1151 1151
 			$hour = intval($hour) + 12;
1152 1152
 		}
1153
-		$hour = str_pad( "$hour", 2, '0',STR_PAD_LEFT);
1154
-		$minutes = str_pad( "$minutes", 2, '0',STR_PAD_LEFT);
1153
+		$hour = str_pad("$hour", 2, '0', STR_PAD_LEFT);
1154
+		$minutes = str_pad("$minutes", 2, '0', STR_PAD_LEFT);
1155 1155
 		return "$hour:$minutes";
1156 1156
 	}
1157 1157
 
@@ -1160,7 +1160,7 @@  discard block
 block discarded – undo
1160 1160
 	 * @param int $country_id
1161 1161
 	 * @return string the country's ISO3 code
1162 1162
 	 */
1163
-	public function get_iso_from_3_1_country_id($country_id){
1163
+	public function get_iso_from_3_1_country_id($country_id) {
1164 1164
 		$old_countries = array(
1165 1165
 			array(64, 'United States', 'US', 'USA', 1),
1166 1166
 			array(15, 'Australia', 'AU', 'AUS', 1),
@@ -1386,9 +1386,9 @@  discard block
 block discarded – undo
1386 1386
 			array(226, 'Zimbabwe', 'ZW', 'ZWE', 1));
1387 1387
 
1388 1388
 		$country_iso = 'US';
1389
-		foreach($old_countries as $country_array){
1389
+		foreach ($old_countries as $country_array) {
1390 1390
 			//note: index 0 is the 3.1 country ID
1391
-			if($country_array[0] == $country_id){
1391
+			if ($country_array[0] == $country_id) {
1392 1392
 				//note: index 2 is the ISO
1393 1393
 				$country_iso = $country_array[2];
1394 1394
 				break;
@@ -1401,8 +1401,8 @@  discard block
 block discarded – undo
1401 1401
 	 * Gets the ISO3 for the
1402 1402
 	 * @return string
1403 1403
 	 */
1404
-	public function get_default_country_iso(){
1405
-		$old_org_options= get_option('events_organization_settings');
1404
+	public function get_default_country_iso() {
1405
+		$old_org_options = get_option('events_organization_settings');
1406 1406
 		$iso = $this->get_iso_from_3_1_country_id($old_org_options['organization_country']);
1407 1407
 		return $iso;
1408 1408
 	}
@@ -1414,13 +1414,13 @@  discard block
 block discarded – undo
1414 1414
 	 * the event's DEFAULT payment status, or the attendee's payment status) required pre-approval.
1415 1415
 	 * @return string STS_ID for use in 4.1
1416 1416
 	 */
1417
-	public function convert_3_1_payment_status_to_4_1_STS_ID($payment_status, $this_thing_required_pre_approval = false){
1417
+	public function convert_3_1_payment_status_to_4_1_STS_ID($payment_status, $this_thing_required_pre_approval = false) {
1418 1418
 
1419 1419
 		//EE team can read the related discussion: https://app.asana.com/0/2400967562914/9418495544455
1420
-		if($this_thing_required_pre_approval){
1420
+		if ($this_thing_required_pre_approval) {
1421 1421
 				return 'RNA';
1422
-		}else{
1423
-				$mapping = $default_reg_stati_conversions=array(
1422
+		} else {
1423
+				$mapping = $default_reg_stati_conversions = array(
1424 1424
 			'Completed'=>'RAP',
1425 1425
 			''=>'RPP',
1426 1426
 			'Incomplete'=>'RPP',
@@ -1450,22 +1450,22 @@  discard block
 block discarded – undo
1450 1450
 	 * @param  EE_Data_Migration_Script_Stage $migration_stage the stage which called this, where errors should be added
1451 1451
 	 * @return boolean whether or not we had to do the big job of creating an image attachment
1452 1452
 	 */
1453
-	public function convert_image_url_to_attachment_and_attach_to_post($guid,$new_cpt_id,  EE_Data_Migration_Script_Stage $migration_stage){
1453
+	public function convert_image_url_to_attachment_and_attach_to_post($guid, $new_cpt_id, EE_Data_Migration_Script_Stage $migration_stage) {
1454 1454
 		$created_attachment_post = false;
1455 1455
 		$guid = $this->_get_original_guid($guid);
1456
-		if($guid){
1456
+		if ($guid) {
1457 1457
 			//check for an existing attachment post with this guid
1458 1458
 			$attachment_post_id = $this->_get_image_attachment_id_by_GUID($guid);
1459
-			if( ! $attachment_post_id){
1459
+			if ( ! $attachment_post_id) {
1460 1460
 				//post thumbnail with that GUID doesn't exist, we should create one
1461 1461
 				$attachment_post_id = $this->_create_image_attachment_from_GUID($guid, $migration_stage);
1462 1462
 				$created_attachment_post = true;
1463 1463
 			}
1464 1464
 			//double-check we actually have an attachment post
1465
-			if( $attachment_post_id){
1466
-				update_post_meta($new_cpt_id,'_thumbnail_id',$attachment_post_id);
1467
-			}else{
1468
-				$migration_stage->add_error(sprintf(__("Could not update event image %s for CPT with ID %d, but attachments post ID is %d", "event_espresso"),$guid,$new_cpt_id,$attachment_post_id));
1465
+			if ($attachment_post_id) {
1466
+				update_post_meta($new_cpt_id, '_thumbnail_id', $attachment_post_id);
1467
+			} else {
1468
+				$migration_stage->add_error(sprintf(__("Could not update event image %s for CPT with ID %d, but attachments post ID is %d", "event_espresso"), $guid, $new_cpt_id, $attachment_post_id));
1469 1469
 			}
1470 1470
 		}
1471 1471
 		return $created_attachment_post;
@@ -1479,13 +1479,13 @@  discard block
 block discarded – undo
1479 1479
 	 * @param string $guid_in_old_event
1480 1480
 	 * @return string either the original guid, or $guid_in_old_event if we couldn't figure out what the original was
1481 1481
 	 */
1482
-	private function _get_original_guid($guid_in_old_event){
1483
-		$original_guid = preg_replace('~-\d*x\d*\.~','.',$guid_in_old_event,1);
1482
+	private function _get_original_guid($guid_in_old_event) {
1483
+		$original_guid = preg_replace('~-\d*x\d*\.~', '.', $guid_in_old_event, 1);
1484 1484
 		//do a head request to verify the file exists
1485 1485
 		$head_response = wp_remote_head($original_guid);
1486
-		if( ! $head_response instanceof WP_Error && $head_response['response']['message'] == 'OK'){
1486
+		if ( ! $head_response instanceof WP_Error && $head_response['response']['message'] == 'OK') {
1487 1487
 			return $original_guid;
1488
-		}else{
1488
+		} else {
1489 1489
 			return $guid_in_old_event;
1490 1490
 		}
1491 1491
 	}
@@ -1497,32 +1497,32 @@  discard block
 block discarded – undo
1497 1497
 	 * @param EE_Data_Migration_Script_Stage $migration_stage
1498 1498
 	 * @return int
1499 1499
 	 */
1500
-	private function _create_image_attachment_from_GUID($guid, EE_Data_Migration_Script_Stage $migration_stage){
1501
-		if ( ! $guid){
1500
+	private function _create_image_attachment_from_GUID($guid, EE_Data_Migration_Script_Stage $migration_stage) {
1501
+		if ( ! $guid) {
1502 1502
 			$migration_stage->add_error(sprintf(__("Cannot create image attachment for a blank GUID!", "event_espresso")));
1503 1503
 			return 0;
1504 1504
 		}
1505
-		$wp_filetype = wp_check_filetype(basename($guid), null );
1505
+		$wp_filetype = wp_check_filetype(basename($guid), null);
1506 1506
 		$wp_upload_dir = wp_upload_dir();
1507 1507
 		//if the file is located remotely, download it to our uploads DIR, because wp_genereate_attachmnet_metadata needs the file to be local
1508
-		if(strpos($guid,$wp_upload_dir['url']) === FALSE){
1508
+		if (strpos($guid, $wp_upload_dir['url']) === FALSE) {
1509 1509
 			//image is located remotely. download it and place it in the uploads directory
1510
-			if( ! is_readable($guid)){
1511
-				$migration_stage->add_error(sprintf(__("Could not create image attachment from non-existent file: %s", "event_espresso"),$guid));
1510
+			if ( ! is_readable($guid)) {
1511
+				$migration_stage->add_error(sprintf(__("Could not create image attachment from non-existent file: %s", "event_espresso"), $guid));
1512 1512
 				return 0;
1513 1513
 			}
1514
-			$contents= file_get_contents($guid);
1515
-			if($contents === FALSE){
1516
-				$migration_stage->add_error(sprintf(__("Could not read image at %s, and therefore couldnt create an attachment post for it.", "event_espresso"),$guid));
1514
+			$contents = file_get_contents($guid);
1515
+			if ($contents === FALSE) {
1516
+				$migration_stage->add_error(sprintf(__("Could not read image at %s, and therefore couldnt create an attachment post for it.", "event_espresso"), $guid));
1517 1517
 				return false;
1518 1518
 			}
1519
-			$local_filepath  = $wp_upload_dir['path'].DS.basename($guid);
1519
+			$local_filepath = $wp_upload_dir['path'].DS.basename($guid);
1520 1520
 			$savefile = fopen($local_filepath, 'w');
1521 1521
 			fwrite($savefile, $contents);
1522 1522
 			fclose($savefile);
1523
-			$guid = str_replace($wp_upload_dir['path'],$wp_upload_dir['url'],$local_filepath);
1524
-		}else{
1525
-			$local_filepath = str_replace($wp_upload_dir['url'],$wp_upload_dir['path'],$guid);
1523
+			$guid = str_replace($wp_upload_dir['path'], $wp_upload_dir['url'], $local_filepath);
1524
+		} else {
1525
+			$local_filepath = str_replace($wp_upload_dir['url'], $wp_upload_dir['path'], $guid);
1526 1526
 		}
1527 1527
 
1528 1528
 		$attachment = array(
@@ -1532,24 +1532,24 @@  discard block
 block discarded – undo
1532 1532
 		   'post_content' => '',
1533 1533
 		   'post_status' => 'inherit'
1534 1534
 		);
1535
-		$attach_id = wp_insert_attachment( $attachment, $guid );
1536
-		if( ! $attach_id ){
1537
-			$migration_stage->add_error(sprintf(__("Could not create image attachment post from image '%s'. Attachment data was %s.", "event_espresso"),$guid,$this->_json_encode($attachment)));
1535
+		$attach_id = wp_insert_attachment($attachment, $guid);
1536
+		if ( ! $attach_id) {
1537
+			$migration_stage->add_error(sprintf(__("Could not create image attachment post from image '%s'. Attachment data was %s.", "event_espresso"), $guid, $this->_json_encode($attachment)));
1538 1538
 			return $attach_id;
1539 1539
 		}
1540 1540
 
1541 1541
 		// you must first include the image.php file
1542 1542
 		// for the function wp_generate_attachment_metadata() to work
1543
-		require_once(ABSPATH . 'wp-admin/includes/image.php');
1543
+		require_once(ABSPATH.'wp-admin/includes/image.php');
1544 1544
 
1545
-		$attach_data = wp_generate_attachment_metadata( $attach_id, $local_filepath );
1546
-		if( ! $attach_data){
1547
-			$migration_stage->add_error(sprintf(__("Coudl not genereate attachment metadata for attachment post %d with filepath %s and GUID %s. Please check the file was downloaded properly.", "event_espresso"),$attach_id,$local_filepath,$guid));
1545
+		$attach_data = wp_generate_attachment_metadata($attach_id, $local_filepath);
1546
+		if ( ! $attach_data) {
1547
+			$migration_stage->add_error(sprintf(__("Coudl not genereate attachment metadata for attachment post %d with filepath %s and GUID %s. Please check the file was downloaded properly.", "event_espresso"), $attach_id, $local_filepath, $guid));
1548 1548
 			return $attach_id;
1549 1549
 		}
1550
-		$metadata_save_result = wp_update_attachment_metadata( $attach_id, $attach_data );
1551
-		if( ! $metadata_save_result ){
1552
-			$migration_stage->add_error(sprintf(__("Could not update attachment metadata for attachment %d with data %s", "event_espresso"),$attach_id,$this->_json_encode($attach_data)));
1550
+		$metadata_save_result = wp_update_attachment_metadata($attach_id, $attach_data);
1551
+		if ( ! $metadata_save_result) {
1552
+			$migration_stage->add_error(sprintf(__("Could not update attachment metadata for attachment %d with data %s", "event_espresso"), $attach_id, $this->_json_encode($attach_data)));
1553 1553
 		}
1554 1554
 		return $attach_id;
1555 1555
 	}
@@ -1561,9 +1561,9 @@  discard block
 block discarded – undo
1561 1561
 	 * @param string $guid
1562 1562
 	 * @return int
1563 1563
 	 */
1564
-	private function _get_image_attachment_id_by_GUID($guid){
1564
+	private function _get_image_attachment_id_by_GUID($guid) {
1565 1565
 		global $wpdb;
1566
-		$attachment_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE guid=%s LIMIT 1",$guid));
1566
+		$attachment_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE guid=%s LIMIT 1", $guid));
1567 1567
 		return $attachment_id;
1568 1568
 	}
1569 1569
 	/**
@@ -1575,20 +1575,20 @@  discard block
 block discarded – undo
1575 1575
 	 * @param string $timezone
1576 1576
 	 * @return string
1577 1577
 	 */
1578
-	public function convert_date_string_to_utc(EE_Data_Migration_Script_Stage $stage, $row_of_data, $DATETIME_string,$timezone = null){
1578
+	public function convert_date_string_to_utc(EE_Data_Migration_Script_Stage $stage, $row_of_data, $DATETIME_string, $timezone = null) {
1579 1579
 		$original_tz = $timezone;
1580
-		if( ! $timezone){
1580
+		if ( ! $timezone) {
1581 1581
 			$timezone = $this->_get_wp_timezone();
1582 1582
 		}
1583
-		if( ! $timezone){
1584
-			$stage->add_error(sprintf(__("Could not find timezone given %s for %s", "event_espresso"),$original_tz,$row_of_data));
1583
+		if ( ! $timezone) {
1584
+			$stage->add_error(sprintf(__("Could not find timezone given %s for %s", "event_espresso"), $original_tz, $row_of_data));
1585 1585
 			$timezone = 'UTC';
1586 1586
 		}
1587
-		try{
1588
-			$date_obj = new DateTime( $DATETIME_string, new DateTimeZone( $timezone ) );
1587
+		try {
1588
+			$date_obj = new DateTime($DATETIME_string, new DateTimeZone($timezone));
1589 1589
 			$date_obj->setTimezone(new DateTimeZone('UTC'));
1590
-		}catch(Exception $e){
1591
-			$stage->add_error(sprintf(__("Could not convert time string '%s' using timezone '%s' into a proper DATETIME. Using current time instead.", "event_espresso"),$DATETIME_string,$timezone));
1590
+		} catch (Exception $e) {
1591
+			$stage->add_error(sprintf(__("Could not convert time string '%s' using timezone '%s' into a proper DATETIME. Using current time instead.", "event_espresso"), $DATETIME_string, $timezone));
1592 1592
 			$date_obj = new DateTime();
1593 1593
 		}
1594 1594
 
@@ -1599,14 +1599,14 @@  discard block
 block discarded – undo
1599 1599
 	 * Gets the DEFAULT timezone string from wordpress (even if they set a gmt offset)
1600 1600
 	 * @return string
1601 1601
 	 */
1602
-	private function _get_wp_timezone(){
1603
-		$timezone = empty( $timezone ) ? get_option('timezone_string') : $timezone;
1602
+	private function _get_wp_timezone() {
1603
+		$timezone = empty($timezone) ? get_option('timezone_string') : $timezone;
1604 1604
 
1605 1605
 		//if timezone is STILL empty then let's get the GMT offset and then set the timezone_string using our converter
1606
-		if ( empty( $timezone ) ) {
1606
+		if (empty($timezone)) {
1607 1607
 			//let's get a the WordPress UTC offset
1608 1608
 			$offset = get_option('gmt_offset');
1609
-			$timezone = $this->timezone_convert_to_string_from_offset( $offset );
1609
+			$timezone = $this->timezone_convert_to_string_from_offset($offset);
1610 1610
 		}
1611 1611
 		return $timezone;
1612 1612
 	}
@@ -1615,11 +1615,11 @@  discard block
 block discarded – undo
1615 1615
 	 * @param int $offset
1616 1616
 	 * @return boolean
1617 1617
 	 */
1618
-	private function timezone_convert_to_string_from_offset($offset){
1618
+	private function timezone_convert_to_string_from_offset($offset) {
1619 1619
 		//shamelessly taken from bottom comment at http://ca1.php.net/manual/en/function.timezone-name-from-abbr.php because timezone_name_from_abbr() did NOT work as expected - its not reliable
1620 1620
 		$offset *= 3600; // convert hour offset to seconds
1621 1621
         $abbrarray = timezone_abbreviations_list();
1622
-        foreach ($abbrarray as $abbr){
1622
+        foreach ($abbrarray as $abbr) {
1623 1623
                 foreach ($abbr as $city)
1624 1624
                 {
1625 1625
                         if ($city['offset'] == $offset)
@@ -1633,32 +1633,32 @@  discard block
 block discarded – undo
1633 1633
         return FALSE;
1634 1634
 	}
1635 1635
 
1636
-	public function migration_page_hooks(){
1637
-		add_filter('FHEE__ee_migration_page__header',array($this,'_migrate_page_hook_simplify_version_strings'),10,3);
1638
-		add_filter('FHEE__ee_migration_page__p_after_header',array($this,'_migration_page_hook_simplify_next_db_state'),10,2);
1639
-		add_filter('FHEE__ee_migration_page__option_1_main',array($this,'_migrate_page_hook_simplify_version_strings'),10,3);
1640
-		add_filter('FHEE__ee_migration_page__option_1_button_text',array($this,'_migrate_page_hook_simplify_version_strings'),10,3);
1641
-		add_action('AHEE__ee_migration_page__option_1_extra_details',array($this,'_migration_page_hook_option_1_extra_details'),10,3);
1642
-		add_filter('FHEE__ee_migration_page__option_2_main',array($this,'_migrate_page_hook_simplify_version_strings'),10,4);
1643
-		add_filter('FHEE__ee_migration_page__option_2_button_text',array($this,'_migration_page_hook_simplify_next_db_state'),10,2);
1644
-		add_filter('FHEE__ee_migration_page__option_2_details',array($this,'_migration_page_hook_simplify_next_db_state'),10,2);
1645
-		add_action('AHEE__ee_migration_page__after_migration_options_table',array($this,'_migration_page_hook_after_migration_options_table'));
1646
-		add_filter('FHEE__ee_migration_page__done_migration_header',array($this,'_migration_page_hook_simplify_next_db_state'),10,2);
1647
-		add_filter('FHEE__ee_migration_page__p_after_done_migration_header',array($this,'_migration_page_hook_simplify_next_db_state'),10,2);
1636
+	public function migration_page_hooks() {
1637
+		add_filter('FHEE__ee_migration_page__header', array($this, '_migrate_page_hook_simplify_version_strings'), 10, 3);
1638
+		add_filter('FHEE__ee_migration_page__p_after_header', array($this, '_migration_page_hook_simplify_next_db_state'), 10, 2);
1639
+		add_filter('FHEE__ee_migration_page__option_1_main', array($this, '_migrate_page_hook_simplify_version_strings'), 10, 3);
1640
+		add_filter('FHEE__ee_migration_page__option_1_button_text', array($this, '_migrate_page_hook_simplify_version_strings'), 10, 3);
1641
+		add_action('AHEE__ee_migration_page__option_1_extra_details', array($this, '_migration_page_hook_option_1_extra_details'), 10, 3);
1642
+		add_filter('FHEE__ee_migration_page__option_2_main', array($this, '_migrate_page_hook_simplify_version_strings'), 10, 4);
1643
+		add_filter('FHEE__ee_migration_page__option_2_button_text', array($this, '_migration_page_hook_simplify_next_db_state'), 10, 2);
1644
+		add_filter('FHEE__ee_migration_page__option_2_details', array($this, '_migration_page_hook_simplify_next_db_state'), 10, 2);
1645
+		add_action('AHEE__ee_migration_page__after_migration_options_table', array($this, '_migration_page_hook_after_migration_options_table'));
1646
+		add_filter('FHEE__ee_migration_page__done_migration_header', array($this, '_migration_page_hook_simplify_next_db_state'), 10, 2);
1647
+		add_filter('FHEE__ee_migration_page__p_after_done_migration_header', array($this, '_migration_page_hook_simplify_next_db_state'), 10, 2);
1648 1648
 	}
1649 1649
 
1650
-	public function _migrate_page_hook_simplify_version_strings($old_content,$current_db_state,$next_db_state,$ultimate_db_state = NULL){
1651
-		return str_replace(array($current_db_state,$next_db_state,$ultimate_db_state),array(__('EE3','event_espresso'),__('EE4','event_espresso'),  __("EE4", 'event_espresso')),$old_content);
1650
+	public function _migrate_page_hook_simplify_version_strings($old_content, $current_db_state, $next_db_state, $ultimate_db_state = NULL) {
1651
+		return str_replace(array($current_db_state, $next_db_state, $ultimate_db_state), array(__('EE3', 'event_espresso'), __('EE4', 'event_espresso'), __("EE4", 'event_espresso')), $old_content);
1652 1652
 	}
1653
-	public function _migration_page_hook_simplify_next_db_state($old_content,$next_db_state){
1654
-		return str_replace($next_db_state,  __("EE4", 'event_espresso'),$old_content);
1653
+	public function _migration_page_hook_simplify_next_db_state($old_content, $next_db_state) {
1654
+		return str_replace($next_db_state, __("EE4", 'event_espresso'), $old_content);
1655 1655
 	}
1656
-	public function _migration_page_hook_option_1_extra_details(){
1657
-		?><p><?php	printf(__("Note: many of your EE3 shortcodes will be changed to EE4 shortcodes during this migration (among many other things). Should you revert to EE3, then you should restore to your backup or manually change the EE4 shortcodes back to their EE3 equivalents", "event_espresso"));?></p><?php
1656
+	public function _migration_page_hook_option_1_extra_details() {
1657
+		?><p><?php	printf(__("Note: many of your EE3 shortcodes will be changed to EE4 shortcodes during this migration (among many other things). Should you revert to EE3, then you should restore to your backup or manually change the EE4 shortcodes back to their EE3 equivalents", "event_espresso")); ?></p><?php
1658 1658
 	}
1659
-	public function _migration_page_hook_after_migration_options_table(){
1659
+	public function _migration_page_hook_after_migration_options_table() {
1660 1660
 		?><p class="ee-attention">
1661
-				<strong><span class="reminder-spn"><?php _e("Important note to those using Event Espresso 3 addons: ", "event_espresso");?></span></strong><br/><?php _e("Unless an addon's description on our website explicitly states that it is compatible with EE4, you should consider it incompatible and know that it WILL NOT WORK correctly with this new version of Event Espresso 4 (EE4). As well, any data for incompatible addons will NOT BE MIGRATED until an updated EE4 compatible version of the addon is available. If you want, or need to keep using your EE3 addons, you should simply continue using EE3 until EE4 compatible versions of your addons become available. To continue using EE3 for now, just deactivate EE4 and reactivate EE3.", "event_espresso");	?>
1661
+				<strong><span class="reminder-spn"><?php _e("Important note to those using Event Espresso 3 addons: ", "event_espresso"); ?></span></strong><br/><?php _e("Unless an addon's description on our website explicitly states that it is compatible with EE4, you should consider it incompatible and know that it WILL NOT WORK correctly with this new version of Event Espresso 4 (EE4). As well, any data for incompatible addons will NOT BE MIGRATED until an updated EE4 compatible version of the addon is available. If you want, or need to keep using your EE3 addons, you should simply continue using EE3 until EE4 compatible versions of your addons become available. To continue using EE3 for now, just deactivate EE4 and reactivate EE3.", "event_espresso"); ?>
1662 1662
 			</p><?php
1663 1663
 	}
1664 1664
 }
Please login to merge, or discard this patch.
espresso.php 1 patch
Spacing   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined( 'ABSPATH' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('ABSPATH')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /*
5 5
   Plugin Name:		Event Espresso
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
  *
43 43
  */
44 44
 
45
-if ( function_exists( 'espresso_version' ) ) {
45
+if (function_exists('espresso_version')) {
46 46
 
47 47
 	/**
48 48
 	 *    espresso_duplicate_plugin_error
@@ -51,12 +51,12 @@  discard block
 block discarded – undo
51 51
 	function espresso_duplicate_plugin_error() {
52 52
 		?>
53 53
 		<div class="error">
54
-			<p><?php _e( '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.', 'event_espresso' ); ?></p>
54
+			<p><?php _e('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.', 'event_espresso'); ?></p>
55 55
 		</div>
56 56
 		<?php
57
-		espresso_deactivate_plugin( plugin_basename( __FILE__ ) );
57
+		espresso_deactivate_plugin(plugin_basename(__FILE__));
58 58
 	}
59
-	add_action( 'admin_notices', 'espresso_duplicate_plugin_error', 1 );
59
+	add_action('admin_notices', 'espresso_duplicate_plugin_error', 1);
60 60
 
61 61
 } else {
62 62
 
@@ -67,103 +67,103 @@  discard block
 block discarded – undo
67 67
 	 * @return string
68 68
 	 */
69 69
 	function espresso_version() {
70
-		return apply_filters( 'FHEE__espresso__espresso_version', '4.9.13.rc.013' );
70
+		return apply_filters('FHEE__espresso__espresso_version', '4.9.13.rc.013');
71 71
 	}
72 72
 
73 73
 	// define versions
74
-	define( 'EVENT_ESPRESSO_VERSION', espresso_version() );
75
-	define( 'EE_MIN_WP_VER_REQUIRED', '4.1' );
76
-	define( 'EE_MIN_WP_VER_RECOMMENDED', '4.4.2' );
77
-	define( 'EE_MIN_PHP_VER_REQUIRED', '5.3.0' );
78
-	define( 'EE_MIN_PHP_VER_RECOMMENDED', '5.4.44' );
79
-	define( 'EVENT_ESPRESSO_POWERED_BY', 'Event Espresso - ' . EVENT_ESPRESSO_VERSION );
80
-	define( 'EVENT_ESPRESSO_MAIN_FILE', __FILE__ );
74
+	define('EVENT_ESPRESSO_VERSION', espresso_version());
75
+	define('EE_MIN_WP_VER_REQUIRED', '4.1');
76
+	define('EE_MIN_WP_VER_RECOMMENDED', '4.4.2');
77
+	define('EE_MIN_PHP_VER_REQUIRED', '5.3.0');
78
+	define('EE_MIN_PHP_VER_RECOMMENDED', '5.4.44');
79
+	define('EVENT_ESPRESSO_POWERED_BY', 'Event Espresso - '.EVENT_ESPRESSO_VERSION);
80
+	define('EVENT_ESPRESSO_MAIN_FILE', __FILE__);
81 81
 	//used to be DIRECTORY_SEPARATOR, but that caused issues on windows
82
-	if ( ! defined( 'DS' ) ) {
83
-		define( 'DS', '/' );
82
+	if ( ! defined('DS')) {
83
+		define('DS', '/');
84 84
 	}
85
-	if ( ! defined( 'PS' ) ) {
86
-		define( 'PS', PATH_SEPARATOR );
85
+	if ( ! defined('PS')) {
86
+		define('PS', PATH_SEPARATOR);
87 87
 	}
88
-	if ( ! defined( 'SP' ) ) {
89
-		define( 'SP', ' ' );
88
+	if ( ! defined('SP')) {
89
+		define('SP', ' ');
90 90
 	}
91
-	if ( ! defined( 'EENL' ) ) {
92
-		define( 'EENL', "\n" );
91
+	if ( ! defined('EENL')) {
92
+		define('EENL', "\n");
93 93
 	}
94
-	define( 'EE_SUPPORT_EMAIL', '[email protected]' );
94
+	define('EE_SUPPORT_EMAIL', '[email protected]');
95 95
 	// define the plugin directory and URL
96
-	define( 'EE_PLUGIN_BASENAME', plugin_basename( EVENT_ESPRESSO_MAIN_FILE ) );
97
-	define( 'EE_PLUGIN_DIR_PATH', plugin_dir_path( EVENT_ESPRESSO_MAIN_FILE ) );
98
-	define( 'EE_PLUGIN_DIR_URL', plugin_dir_url( EVENT_ESPRESSO_MAIN_FILE ) );
96
+	define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE));
97
+	define('EE_PLUGIN_DIR_PATH', plugin_dir_path(EVENT_ESPRESSO_MAIN_FILE));
98
+	define('EE_PLUGIN_DIR_URL', plugin_dir_url(EVENT_ESPRESSO_MAIN_FILE));
99 99
 	// main root folder paths
100
-	define( 'EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH . 'admin_pages' . DS );
101
-	define( 'EE_CORE', EE_PLUGIN_DIR_PATH . 'core' . DS );
102
-	define( 'EE_MODULES', EE_PLUGIN_DIR_PATH . 'modules' . DS );
103
-	define( 'EE_PUBLIC', EE_PLUGIN_DIR_PATH . 'public' . DS );
104
-	define( 'EE_SHORTCODES', EE_PLUGIN_DIR_PATH . 'shortcodes' . DS );
105
-	define( 'EE_WIDGETS', EE_PLUGIN_DIR_PATH . 'widgets' . DS );
106
-	define( 'EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH . 'payment_methods' . DS );
107
-	define( 'EE_CAFF_PATH', EE_PLUGIN_DIR_PATH . 'caffeinated' . DS );
100
+	define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH.'admin_pages'.DS);
101
+	define('EE_CORE', EE_PLUGIN_DIR_PATH.'core'.DS);
102
+	define('EE_MODULES', EE_PLUGIN_DIR_PATH.'modules'.DS);
103
+	define('EE_PUBLIC', EE_PLUGIN_DIR_PATH.'public'.DS);
104
+	define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH.'shortcodes'.DS);
105
+	define('EE_WIDGETS', EE_PLUGIN_DIR_PATH.'widgets'.DS);
106
+	define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH.'payment_methods'.DS);
107
+	define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH.'caffeinated'.DS);
108 108
 	// core system paths
109
-	define( 'EE_ADMIN', EE_CORE . 'admin' . DS );
110
-	define( 'EE_CPTS', EE_CORE . 'CPTs' . DS );
111
-	define( 'EE_CLASSES', EE_CORE . 'db_classes' . DS );
112
-	define( 'EE_INTERFACES', EE_CORE . 'interfaces' . DS );
113
-	define( 'EE_BUSINESS', EE_CORE . 'business' . DS );
114
-	define( 'EE_MODELS', EE_CORE . 'db_models' . DS );
115
-	define( 'EE_HELPERS', EE_CORE . 'helpers' . DS );
116
-	define( 'EE_LIBRARIES', EE_CORE . 'libraries' . DS );
117
-	define( 'EE_TEMPLATES', EE_CORE . 'templates' . DS );
118
-	define( 'EE_THIRD_PARTY', EE_CORE . 'third_party_libs' . DS );
119
-	define( 'EE_GLOBAL_ASSETS', EE_TEMPLATES . 'global_assets' . DS );
120
-	define( 'EE_FORM_SECTIONS', EE_LIBRARIES . 'form_sections' . DS );
109
+	define('EE_ADMIN', EE_CORE.'admin'.DS);
110
+	define('EE_CPTS', EE_CORE.'CPTs'.DS);
111
+	define('EE_CLASSES', EE_CORE.'db_classes'.DS);
112
+	define('EE_INTERFACES', EE_CORE.'interfaces'.DS);
113
+	define('EE_BUSINESS', EE_CORE.'business'.DS);
114
+	define('EE_MODELS', EE_CORE.'db_models'.DS);
115
+	define('EE_HELPERS', EE_CORE.'helpers'.DS);
116
+	define('EE_LIBRARIES', EE_CORE.'libraries'.DS);
117
+	define('EE_TEMPLATES', EE_CORE.'templates'.DS);
118
+	define('EE_THIRD_PARTY', EE_CORE.'third_party_libs'.DS);
119
+	define('EE_GLOBAL_ASSETS', EE_TEMPLATES.'global_assets'.DS);
120
+	define('EE_FORM_SECTIONS', EE_LIBRARIES.'form_sections'.DS);
121 121
 	// gateways
122
-	define( 'EE_GATEWAYS', EE_MODULES . 'gateways' . DS );
123
-	define( 'EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL . 'modules' . DS . 'gateways' . DS );
122
+	define('EE_GATEWAYS', EE_MODULES.'gateways'.DS);
123
+	define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL.'modules'.DS.'gateways'.DS);
124 124
 	// asset URL paths
125
-	define( 'EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'templates' . DS );
126
-	define( 'EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL . 'global_assets' . DS );
127
-	define( 'EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL . 'images' . DS );
128
-	define( 'EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'third_party_libs' . DS );
129
-	define( 'EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL . 'core/helpers/assets/' );
130
-	define( 'EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL . 'core/libraries/' );
125
+	define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL.'core'.DS.'templates'.DS);
126
+	define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL.'global_assets'.DS);
127
+	define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL.'images'.DS);
128
+	define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL.'core'.DS.'third_party_libs'.DS);
129
+	define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL.'core/helpers/assets/');
130
+	define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL.'core/libraries/');
131 131
 	// define upload paths
132 132
 	$uploads = wp_upload_dir();
133 133
 	// define the uploads directory and URL
134
-	define( 'EVENT_ESPRESSO_UPLOAD_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS );
135
-	define( 'EVENT_ESPRESSO_UPLOAD_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS );
134
+	define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'].DS.'espresso'.DS);
135
+	define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'].DS.'espresso'.DS);
136 136
 	// define the templates directory and URL
137
-	define( 'EVENT_ESPRESSO_TEMPLATE_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS . 'templates' . DS );
138
-	define( 'EVENT_ESPRESSO_TEMPLATE_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS . 'templates' . DS );
137
+	define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'].DS.'espresso'.DS.'templates'.DS);
138
+	define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'].DS.'espresso'.DS.'templates'.DS);
139 139
 	// define the gateway directory and URL
140
-	define( 'EVENT_ESPRESSO_GATEWAY_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS . 'gateways' . DS );
141
-	define( 'EVENT_ESPRESSO_GATEWAY_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS . 'gateways' . DS );
140
+	define('EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'].DS.'espresso'.DS.'gateways'.DS);
141
+	define('EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'].DS.'espresso'.DS.'gateways'.DS);
142 142
 	// languages folder/path
143
-	define( 'EE_LANGUAGES_SAFE_LOC', '..' . DS . 'uploads' . DS . 'espresso' . DS . 'languages' . DS );
144
-	define( 'EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages' . DS );
143
+	define('EE_LANGUAGES_SAFE_LOC', '..'.DS.'uploads'.DS.'espresso'.DS.'languages'.DS);
144
+	define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'languages'.DS);
145 145
 	//check for dompdf fonts in uploads
146
-	if ( file_exists( EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS ) ) {
147
-		define( 'DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS );
146
+	if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS)) {
147
+		define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS);
148 148
 	}
149 149
 	//ajax constants
150
-	define( 'EE_FRONT_AJAX', isset( $_REQUEST[ 'ee_front_ajax' ] ) || isset( $_REQUEST[ 'data' ][ 'ee_front_ajax' ] ) ? true : false );
151
-	define( 'EE_ADMIN_AJAX', isset( $_REQUEST[ 'ee_admin_ajax' ] ) || isset( $_REQUEST[ 'data' ][ 'ee_admin_ajax' ] ) ? true : false );
150
+	define('EE_FRONT_AJAX', isset($_REQUEST['ee_front_ajax']) || isset($_REQUEST['data']['ee_front_ajax']) ? true : false);
151
+	define('EE_ADMIN_AJAX', isset($_REQUEST['ee_admin_ajax']) || isset($_REQUEST['data']['ee_admin_ajax']) ? true : false);
152 152
 	//just a handy constant occasionally needed for finding values representing infinity in the DB
153 153
 	//you're better to use this than its straight value (currently -1) in case you ever
154 154
 	//want to change its default value! or find when -1 means infinity
155
-	define( 'EE_INF_IN_DB', -1 );
156
-	define( 'EE_INF', INF > (float)PHP_INT_MAX ? INF : PHP_INT_MAX );
157
-	define( 'EE_DEBUG', false );
155
+	define('EE_INF_IN_DB', -1);
156
+	define('EE_INF', INF > (float) PHP_INT_MAX ? INF : PHP_INT_MAX);
157
+	define('EE_DEBUG', false);
158 158
 
159 159
 	/**
160 160
 	 *    espresso_plugin_activation
161 161
 	 *    adds a wp-option to indicate that EE has been activated via the WP admin plugins page
162 162
 	 */
163 163
 	function espresso_plugin_activation() {
164
-		update_option( 'ee_espresso_activation', true );
164
+		update_option('ee_espresso_activation', true);
165 165
 	}
166
-	register_activation_hook( EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation' );
166
+	register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation');
167 167
 
168 168
 
169 169
 
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 		//	}
178 178
 		//
179 179
 	}
180
-	register_deactivation_hook( EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation' );
180
+	register_deactivation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation');
181 181
 
182 182
 
183 183
 
@@ -187,15 +187,15 @@  discard block
 block discarded – undo
187 187
 	 */
188 188
 	function espresso_load_error_handling() {
189 189
 		// load debugging tools
190
-		if ( WP_DEBUG === true && is_readable( EE_HELPERS . 'EEH_Debug_Tools.helper.php' ) ) {
191
-			require_once( EE_HELPERS . 'EEH_Debug_Tools.helper.php' );
190
+		if (WP_DEBUG === true && is_readable(EE_HELPERS.'EEH_Debug_Tools.helper.php')) {
191
+			require_once(EE_HELPERS.'EEH_Debug_Tools.helper.php');
192 192
 			EEH_Debug_Tools::instance();
193 193
 		}
194 194
 		// load error handling
195
-		if ( is_readable( EE_CORE . 'EE_Error.core.php' ) ) {
196
-			require_once( EE_CORE . 'EE_Error.core.php' );
195
+		if (is_readable(EE_CORE.'EE_Error.core.php')) {
196
+			require_once(EE_CORE.'EE_Error.core.php');
197 197
 		} else {
198
-			wp_die( __( 'The EE_Error core class could not be loaded.', 'event_espresso' ) );
198
+			wp_die(__('The EE_Error core class could not be loaded.', 'event_espresso'));
199 199
 		}
200 200
 	}
201 201
 
@@ -209,25 +209,25 @@  discard block
 block discarded – undo
209 209
 	 * @param    string $full_path_to_file
210 210
 	 * @throws    EE_Error
211 211
 	 */
212
-	function espresso_load_required( $classname, $full_path_to_file ) {
212
+	function espresso_load_required($classname, $full_path_to_file) {
213 213
 		static $error_handling_loaded = false;
214
-		if ( ! $error_handling_loaded ) {
214
+		if ( ! $error_handling_loaded) {
215 215
 			espresso_load_error_handling();
216 216
 			$error_handling_loaded = true;
217 217
 		}
218
-		if ( is_readable( $full_path_to_file ) ) {
219
-			require_once( $full_path_to_file );
218
+		if (is_readable($full_path_to_file)) {
219
+			require_once($full_path_to_file);
220 220
 		} else {
221
-			throw new EE_Error ( sprintf(
222
-				__( 'The %s class file could not be located or is not readable due to file permissions.', 'event_espresso' ),
221
+			throw new EE_Error(sprintf(
222
+				__('The %s class file could not be located or is not readable due to file permissions.', 'event_espresso'),
223 223
 				$classname
224
-			) );
224
+			));
225 225
 		}
226 226
 	}
227 227
 
228
-	espresso_load_required( 'EEH_Base', EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php' );
229
-	espresso_load_required( 'EEH_File', EE_CORE . 'helpers' . DS . 'EEH_File.helper.php' );
230
-	espresso_load_required( 'EE_Bootstrap', EE_CORE . 'EE_Bootstrap.core.php' );
228
+	espresso_load_required('EEH_Base', EE_CORE.'helpers'.DS.'EEH_Base.helper.php');
229
+	espresso_load_required('EEH_File', EE_CORE.'helpers'.DS.'EEH_File.helper.php');
230
+	espresso_load_required('EE_Bootstrap', EE_CORE.'EE_Bootstrap.core.php');
231 231
 	new EE_Bootstrap();
232 232
 
233 233
 
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 
237 237
 
238 238
 
239
-if ( ! function_exists( 'espresso_deactivate_plugin' ) ) {
239
+if ( ! function_exists('espresso_deactivate_plugin')) {
240 240
 	/**
241 241
 	*    deactivate_plugin
242 242
 	* usage:  espresso_deactivate_plugin( plugin_basename( __FILE__ ));
@@ -245,11 +245,11 @@  discard block
 block discarded – undo
245 245
 	* @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file
246 246
 	* @return    void
247 247
 	*/
248
-	function espresso_deactivate_plugin( $plugin_basename = '' ) {
249
-		if ( ! function_exists( 'deactivate_plugins' ) ) {
250
-			require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
248
+	function espresso_deactivate_plugin($plugin_basename = '') {
249
+		if ( ! function_exists('deactivate_plugins')) {
250
+			require_once(ABSPATH.'wp-admin/includes/plugin.php');
251 251
 		}
252
-		unset( $_GET[ 'activate' ], $_REQUEST[ 'activate' ] );
253
-		deactivate_plugins( $plugin_basename );
252
+		unset($_GET['activate'], $_REQUEST['activate']);
253
+		deactivate_plugins($plugin_basename);
254 254
 	}
255 255
 }
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_DMS_Core_4_8_0.dms.php 1 patch
Spacing   +89 added lines, -89 removed lines patch added patch discarded remove patch
@@ -16,13 +16,13 @@  discard block
 block discarded – undo
16 16
 //(all other times it gets resurrected from a wordpress option)
17 17
 $stages = glob(EE_CORE.'data_migration_scripts/4_8_0_stages/*');
18 18
 $class_to_filepath = array();
19
-foreach($stages as $filepath){
19
+foreach ($stages as $filepath) {
20 20
 	$matches = array();
21
-	preg_match('~4_8_0_stages/(.*).dmsstage.php~',$filepath,$matches);
21
+	preg_match('~4_8_0_stages/(.*).dmsstage.php~', $filepath, $matches);
22 22
 	$class_to_filepath[$matches[1]] = $filepath;
23 23
 }
24 24
 //give addons a chance to autoload their stages too
25
-$class_to_filepath = apply_filters('FHEE__EE_DMS_4_8_0__autoloaded_stages',$class_to_filepath);
25
+$class_to_filepath = apply_filters('FHEE__EE_DMS_4_8_0__autoloaded_stages', $class_to_filepath);
26 26
 EEH_Autoloader::register_autoloader($class_to_filepath);
27 27
 
28 28
 
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
  * @since                4.6.0
39 39
  *
40 40
  */
41
-class EE_DMS_Core_4_8_0 extends EE_Data_Migration_Script_Base{
41
+class EE_DMS_Core_4_8_0 extends EE_Data_Migration_Script_Base {
42 42
 
43 43
 	/**
44 44
 	 * return EE_DMS_Core_4_8_0
@@ -46,14 +46,14 @@  discard block
 block discarded – undo
46 46
 	 * @param TableManager  $table_manager
47 47
 	 * @param TableAnalysis $table_analysis
48 48
 	 */
49
-	public function __construct( TableManager $table_manager = null, TableAnalysis $table_analysis = null ) {
49
+	public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) {
50 50
 		$this->_pretty_name = __("Data Migration to Event Espresso 4.8.0.P (for promotions)", "event_espresso");
51 51
 		$this->_priority = 10;
52 52
 		$this->_migration_stages = array(
53 53
 			new EE_DMS_4_8_0_pretax_totals(),
54 54
 			new EE_DMS_4_8_0_event_subtotals(),
55 55
 		);
56
-		parent::__construct( $table_manager, $table_analysis );
56
+		parent::__construct($table_manager, $table_analysis);
57 57
 	}
58 58
 
59 59
 
@@ -68,14 +68,14 @@  discard block
 block discarded – undo
68 68
 	 */
69 69
 	public function can_migrate_from_version($version_array) {
70 70
 		$version_string = $version_array['Core'];
71
-		if ( version_compare( $version_string, '4.8.0', '<=' ) && version_compare( $version_string, '4.7.0', '>=' ) ) {
71
+		if (version_compare($version_string, '4.8.0', '<=') && version_compare($version_string, '4.7.0', '>=')) {
72 72
 //			echo "$version_string can be migrated from";
73 73
 			return true;
74
-		}elseif( ! $version_string ){
74
+		}elseif ( ! $version_string) {
75 75
 //			echo "no version string provided: $version_string";
76 76
 			//no version string provided... this must be pre 4.3
77
-			return false;//changed mind. dont want people thinking they should migrate yet because they cant
78
-		}else{
77
+			return false; //changed mind. dont want people thinking they should migrate yet because they cant
78
+		} else {
79 79
 //			echo "$version_string doesnt apply";
80 80
 			return false;
81 81
 		}
@@ -96,19 +96,19 @@  discard block
 block discarded – undo
96 96
 	 * @return bool
97 97
 	 */
98 98
 	public function schema_changes_before_migration() {
99
-		require_once( EE_HELPERS . 'EEH_Activation.helper.php' );
100
-		$now_in_mysql = current_time( 'mysql', true );
99
+		require_once(EE_HELPERS.'EEH_Activation.helper.php');
100
+		$now_in_mysql = current_time('mysql', true);
101 101
 
102
-		require_once( EE_HELPERS . 'EEH_Activation.helper.php' );
103
-		$table_name='esp_answer';
104
-		$sql=" ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
102
+		require_once(EE_HELPERS.'EEH_Activation.helper.php');
103
+		$table_name = 'esp_answer';
104
+		$sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
105 105
 					REG_ID int(10) unsigned NOT NULL,
106 106
 					QST_ID int(10) unsigned NOT NULL,
107 107
 					ANS_value text NOT NULL,
108 108
 					PRIMARY KEY  (ANS_ID),
109 109
 					KEY REG_ID (REG_ID),
110 110
 					KEY QST_ID (QST_ID)";
111
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
111
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
112 112
 
113 113
 		$table_name = 'esp_attendee_meta';
114 114
 		$sql = "ATTM_ID int(10) unsigned NOT	NULL AUTO_INCREMENT,
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 					  CNT_is_EU tinyint(1) DEFAULT '0',
149 149
 					  CNT_active tinyint(1) DEFAULT '0',
150 150
 					  PRIMARY KEY  (CNT_ISO)";
151
-		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' );
151
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
152 152
 
153 153
 		$table_name = 'esp_currency';
154 154
 		$sql = "CUR_code varchar(6) collate utf8_bin NOT NULL,
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 				CUR_dec_plc varchar(1) collate utf8_bin NOT NULL DEFAULT '2',
159 159
 				CUR_active tinyint(1) DEFAULT '0',
160 160
 				PRIMARY KEY  (CUR_code)";
161
-		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' );
161
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
162 162
 
163 163
 
164 164
 		$table_name = 'esp_currency_payment_method';
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 						KEY EVT_ID (EVT_ID),
189 189
 						KEY DTT_is_primary (DTT_is_primary)";
190 190
 
191
-		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' );
191
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
192 192
 
193 193
 		$table_name = 'esp_event_meta';
194 194
 		$sql = "
@@ -207,41 +207,41 @@  discard block
 block discarded – undo
207 207
 			EVT_donations tinyint(1) NULL,
208 208
 			PRIMARY KEY  (EVTM_ID),
209 209
 			KEY EVT_ID (EVT_ID)";
210
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
210
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
211 211
 
212 212
 
213 213
 
214
-		$table_name='esp_event_question_group';
215
-		$sql="EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
214
+		$table_name = 'esp_event_question_group';
215
+		$sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
216 216
 					EVT_ID bigint(20) unsigned NOT NULL,
217 217
 					QSG_ID int(10) unsigned NOT NULL,
218 218
 					EQG_primary tinyint(1) unsigned NOT NULL DEFAULT 0,
219 219
 					PRIMARY KEY  (EQG_ID),
220 220
 					KEY EVT_ID (EVT_ID),
221 221
 					KEY QSG_ID (QSG_ID)";
222
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
222
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
223 223
 
224 224
 
225 225
 
226
-		$table_name='esp_event_venue';
227
-		$sql="EVV_ID int(11) NOT NULL AUTO_INCREMENT,
226
+		$table_name = 'esp_event_venue';
227
+		$sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT,
228 228
 				EVT_ID bigint(20) unsigned NOT NULL,
229 229
 				VNU_ID bigint(20) unsigned NOT NULL,
230 230
 				EVV_primary tinyint(1) unsigned NOT NULL DEFAULT 0,
231 231
 				PRIMARY KEY  (EVV_ID)";
232
-		$this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB');
232
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
233 233
 
234 234
 
235 235
 
236
-		$table_name='esp_extra_meta';
237
-		$sql="EXM_ID int(11) NOT NULL AUTO_INCREMENT,
236
+		$table_name = 'esp_extra_meta';
237
+		$sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT,
238 238
 				OBJ_ID int(11) DEFAULT NULL,
239 239
 				EXM_type varchar(45) DEFAULT NULL,
240 240
 				EXM_key varchar(45) DEFAULT NULL,
241 241
 				EXM_value text,
242 242
 				PRIMARY KEY  (EXM_ID),
243 243
 				KEY EXM_type (EXM_type,OBJ_ID,EXM_key)";
244
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
244
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
245 245
 
246 246
 		$table_name = 'esp_extra_join';
247 247
 		$sql = "EXJ_ID int(11) NOT NULL AUTO_INCREMENT,
@@ -254,8 +254,8 @@  discard block
 block discarded – undo
254 254
 				KEY second_model (EXJ_second_model_name,EXJ_second_model_id)";
255 255
 		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
256 256
 
257
-		$table_name='esp_line_item';
258
-		$sql="LIN_ID int(11) NOT NULL AUTO_INCREMENT,
257
+		$table_name = 'esp_line_item';
258
+		$sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT,
259 259
 				LIN_code varchar(245) NOT NULL DEFAULT '',
260 260
 				TXN_ID int(11) DEFAULT NULL,
261 261
 				LIN_name varchar(245) NOT NULL DEFAULT '',
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
 				PRIMARY KEY  (LIN_ID),
275 275
 				KEY LIN_code (LIN_code(191)),
276 276
 				KEY TXN_ID (TXN_ID)";
277
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB' );
277
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
278 278
 
279 279
 		$table_name = 'esp_log';
280 280
 		$sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT,
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 					MTP_is_active tinyint(1) NOT NULL DEFAULT '1',
314 314
 					PRIMARY KEY  (GRP_ID),
315 315
 					KEY MTP_user_id (MTP_user_id)";
316
-		$this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB');
316
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
317 317
 
318 318
 		$table_name = 'esp_event_message_template';
319 319
 		$sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT,
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 					PRIMARY KEY  (EMT_ID),
323 323
 					KEY EVT_ID (EVT_ID),
324 324
 					KEY GRP_ID (GRP_ID)";
325
-		$this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB');
325
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
326 326
 
327 327
 
328 328
 		$table_name = 'esp_payment';
@@ -395,8 +395,8 @@  discard block
 block discarded – undo
395 395
 					  PRIMARY KEY  (TTM_ID)";
396 396
 		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
397 397
 
398
-		$table_name='esp_question';
399
-		$sql='QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
398
+		$table_name = 'esp_question';
399
+		$sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
400 400
 					QST_display_text text NOT NULL,
401 401
 					QST_admin_label varchar(255) NOT NULL,
402 402
 					QST_system varchar(25) NOT NULL DEFAULT "",
@@ -410,22 +410,22 @@  discard block
 block discarded – undo
410 410
 					QST_deleted tinyint(2) unsigned NOT NULL DEFAULT 0,
411 411
 					PRIMARY KEY  (QST_ID),
412 412
 					KEY QST_order (QST_order)';
413
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
413
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
414 414
 
415
-		$table_name='esp_question_group_question';
416
-		$sql="QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
415
+		$table_name = 'esp_question_group_question';
416
+		$sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
417 417
 					QSG_ID int(10) unsigned NOT NULL,
418 418
 					QST_ID int(10) unsigned NOT NULL,
419 419
 					QGQ_order int(10) unsigned NOT NULL DEFAULT 0,
420 420
 					PRIMARY KEY  (QGQ_ID),
421 421
 					KEY QST_ID (QST_ID),
422 422
 					KEY QSG_ID_order (QSG_ID,QGQ_order)";
423
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
423
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
424 424
 
425 425
 
426 426
 
427
-		$table_name='esp_question_option';
428
-		$sql="QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
427
+		$table_name = 'esp_question_option';
428
+		$sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
429 429
 					QSO_value varchar(255) NOT NULL,
430 430
 					QSO_desc text NOT NULL,
431 431
 					QST_ID int(10) unsigned NOT NULL,
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
 					PRIMARY KEY  (QSO_ID),
436 436
 					KEY QST_ID (QST_ID),
437 437
 					KEY QSO_order (QSO_order)";
438
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
438
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
439 439
 
440 440
 
441 441
 
@@ -481,8 +481,8 @@  discard block
 block discarded – undo
481 481
 
482 482
 
483 483
 
484
-		$table_name='esp_checkin';
485
-		$sql="CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
484
+		$table_name = 'esp_checkin';
485
+		$sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
486 486
 					REG_ID int(10) unsigned NOT NULL,
487 487
 					DTT_ID int(10) unsigned NOT NULL,
488 488
 					CHK_in tinyint(1) unsigned NOT NULL DEFAULT 1,
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
 					  PRC_parent int(10) unsigned DEFAULT 0,
578 578
 					  PRIMARY KEY  (PRC_ID),
579 579
 					  KEY PRT_ID (PRT_ID)";
580
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
580
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
581 581
 
582 582
 		$table_name = "esp_price_type";
583 583
 		$sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
@@ -615,10 +615,10 @@  discard block
 block discarded – undo
615 615
 					  TKT_deleted tinyint(1) NOT NULL DEFAULT '0',
616 616
 					  PRIMARY KEY  (TKT_ID),
617 617
 					  KEY TKT_start_date (TKT_start_date)";
618
-		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' );
618
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
619 619
 
620 620
 		$table_name = 'esp_question_group';
621
-		$sql='QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
621
+		$sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
622 622
 					QSG_name varchar(255) NOT NULL,
623 623
 					QSG_identifier varchar(100) NOT NULL,
624 624
 					QSG_desc text NULL,
@@ -631,7 +631,7 @@  discard block
 block discarded – undo
631 631
 					PRIMARY KEY  (QSG_ID),
632 632
 					UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier),
633 633
 					KEY QSG_order (QSG_order)';
634
-		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' );
634
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
635 635
 
636 636
 		/** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */
637 637
 		$script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
@@ -667,7 +667,7 @@  discard block
 block discarded – undo
667 667
 		return $script_4_7_defaults->schema_changes_after_migration();
668 668
 	}
669 669
 
670
-	public function migration_page_hooks(){
670
+	public function migration_page_hooks() {
671 671
 
672 672
 	}
673 673
 
@@ -681,28 +681,28 @@  discard block
 block discarded – undo
681 681
 		//CNT_ISO, CNT_ISO3, RGN_ID, CNT_name, CNT_cur_code, CNT_cur_single, CNT_cur_plural, CNT_cur_sign, CNT_cur_sign_b4, CNT_cur_dec_plc, CNT_tel_code, CNT_is_EU, CNT_active
682 682
 		//('AD', 'AND', 0, 'Andorra', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+376', 0, 0),
683 683
 		$newer_countries = array(
684
-			array( 'AX', 'ALA', 0, '&#197;land Islands', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+358', 1, 0 ),
685
-			array( 'BL', 'BLM', 0, 'Saint Barthelemy', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0 ),
686
-			array( 'CW', 'CUW', 0, 'Curacao', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+599', 1, 0 ),
687
-			array( 'GG', 'GGY', 0, 'Guernsey', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+44', 0, 0 ),
688
-			array( 'IM', 'IMN', 0, 'Isle of Man', 'GBP', 'Pound', 'Pounds', '£', 1, 2,  '+44', 0, 0  ),
689
-			array( 'JE', 'JEY', 0, 'Jersey', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0 ),
690
-			array( 'MF', 'MAF', 0, 'Saint Martin', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0 ),
691
-			array( 'ME', 'MNE', 0, 'Montenegro', 'EUR', 'Euro', 'Euros', '€', 1,  2, '+382', 0, 0 ),
692
-			array( 'RS', 'SRB', 0, 'Serbia', 'RSD', 'Dinar', 'Dinars', '', 0, 2, '+381', 1, 0 ),
693
-			array( 'SS', 'SSD', 0, 'South Sudan', 'SSP', 'Pound', 'Pounds', '£', 1, 2, '+211', 0, 0 ),
694
-			array( 'SX', 'SXM', 0, 'Sint Maarten', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+1', 1, 0 ),
695
-			array( 'XK', 'XKX', 0, 'Kosovo', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+383', 0, 0 ),
696
-			array( 'YT', 'MYT', 0, 'Mayotte', 'EUR', 'Euro', 'Euros', '€', 0, 2, '+262', 1, 0 ),
697
-			array( 'BQ', 'BES', 0, 'Bonaire, Saint Eustatius and Saba', 'USD', 'Dollar', 'Dollars', '$', 1,  2, '+599', 0, 0 ),
698
-			array( 'BV', 'BVT', 0, 'Bouvet Island', 'NOK', 'Krone', 'Krones', 'kr', 1,  2, '+47', 0, 0 ),
699
-			array( 'IO', 'IOT', 0, 'British Indian Ocean Territory', 'GBP', 'Pound', 'Pounds', '£', 1,  2, '+246', 0, 0 ),
700
-			array( 'CX', 'CXR', 0, 'Christmas Island', 'AUD', 'Dollar', 'Dollars', '$', 1,  2, '+61', 0, 0 ),
701
-			array( 'CC', 'CCK', 0, 'Cocos (Keeling) Islands', 'AUD', 'Dollar', 'Dollars', '$', 1,  2, '+891', 0, 0 ),
702
-			array( 'HM', 'HMD', 0, 'Heard Island and McDonald Islands', 'AUD', 'Dollar', 'Dollars', '$', 1,  2, '+891', 0, 0 ),
703
-			array( 'PS', 'PSE', 0, 'Palestinian Territory', 'ILS', 'Shekel', 'Shekels', '₪', 1,  2, '+970', 0, 0 ),
704
-			array( 'GS', 'SGS', 0, 'South Georgia and the South Sandwich Islands', 'GBP', 'Pound', 'Pounds', '£', 1,  2, '+500', 0, 0 ),
705
-			array( 'UM', 'UMI', 0, 'United States Minor Outlying Islands', 'USD', 'Dollar', 'Dollars', '$', 1,  2, '+1', 0, 0 ),
684
+			array('AX', 'ALA', 0, '&#197;land Islands', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+358', 1, 0),
685
+			array('BL', 'BLM', 0, 'Saint Barthelemy', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0),
686
+			array('CW', 'CUW', 0, 'Curacao', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+599', 1, 0),
687
+			array('GG', 'GGY', 0, 'Guernsey', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+44', 0, 0),
688
+			array('IM', 'IMN', 0, 'Isle of Man', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0),
689
+			array('JE', 'JEY', 0, 'Jersey', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0),
690
+			array('MF', 'MAF', 0, 'Saint Martin', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0),
691
+			array('ME', 'MNE', 0, 'Montenegro', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+382', 0, 0),
692
+			array('RS', 'SRB', 0, 'Serbia', 'RSD', 'Dinar', 'Dinars', '', 0, 2, '+381', 1, 0),
693
+			array('SS', 'SSD', 0, 'South Sudan', 'SSP', 'Pound', 'Pounds', '£', 1, 2, '+211', 0, 0),
694
+			array('SX', 'SXM', 0, 'Sint Maarten', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+1', 1, 0),
695
+			array('XK', 'XKX', 0, 'Kosovo', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+383', 0, 0),
696
+			array('YT', 'MYT', 0, 'Mayotte', 'EUR', 'Euro', 'Euros', '€', 0, 2, '+262', 1, 0),
697
+			array('BQ', 'BES', 0, 'Bonaire, Saint Eustatius and Saba', 'USD', 'Dollar', 'Dollars', '$', 1, 2, '+599', 0, 0),
698
+			array('BV', 'BVT', 0, 'Bouvet Island', 'NOK', 'Krone', 'Krones', 'kr', 1, 2, '+47', 0, 0),
699
+			array('IO', 'IOT', 0, 'British Indian Ocean Territory', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+246', 0, 0),
700
+			array('CX', 'CXR', 0, 'Christmas Island', 'AUD', 'Dollar', 'Dollars', '$', 1, 2, '+61', 0, 0),
701
+			array('CC', 'CCK', 0, 'Cocos (Keeling) Islands', 'AUD', 'Dollar', 'Dollars', '$', 1, 2, '+891', 0, 0),
702
+			array('HM', 'HMD', 0, 'Heard Island and McDonald Islands', 'AUD', 'Dollar', 'Dollars', '$', 1, 2, '+891', 0, 0),
703
+			array('PS', 'PSE', 0, 'Palestinian Territory', 'ILS', 'Shekel', 'Shekels', '₪', 1, 2, '+970', 0, 0),
704
+			array('GS', 'SGS', 0, 'South Georgia and the South Sandwich Islands', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+500', 0, 0),
705
+			array('UM', 'UMI', 0, 'United States Minor Outlying Islands', 'USD', 'Dollar', 'Dollars', '$', 1, 2, '+1', 0, 0),
706 706
 		);
707 707
 		global $wpdb;
708 708
 		$country_table = $wpdb->prefix."esp_country";
@@ -721,14 +721,14 @@  discard block
 block discarded – undo
721 721
 							"CNT_is_EU" => '%d',
722 722
 							"CNT_active" => '%d',
723 723
 						);
724
-		if ( $this->_get_table_analysis()->tableExists( $country_table ) ) {
725
-			foreach( $newer_countries as $country ) {
726
-				$SQL = "SELECT COUNT('CNT_ISO') FROM {$country_table} WHERE CNT_ISO='{$country[0]}' LIMIT 1" ;
724
+		if ($this->_get_table_analysis()->tableExists($country_table)) {
725
+			foreach ($newer_countries as $country) {
726
+				$SQL = "SELECT COUNT('CNT_ISO') FROM {$country_table} WHERE CNT_ISO='{$country[0]}' LIMIT 1";
727 727
 				$countries = $wpdb->get_var($SQL);
728
-				if ( ! $countries ) {
728
+				if ( ! $countries) {
729 729
 
730
-					$wpdb->insert( $country_table,
731
-							array_combine( array_keys( $country_format), $country ),
730
+					$wpdb->insert($country_table,
731
+							array_combine(array_keys($country_format), $country),
732 732
 							$country_format
733 733
 							);
734 734
 				}
@@ -746,7 +746,7 @@  discard block
 block discarded – undo
746 746
 		// CUR_code, CUR_single, CUR_plural, CUR_sign, CUR_dec_plc, CUR_active
747 747
 		//( 'EUR',  'Euro',  'Euros',  '€',  2,1),
748 748
 		$newer_currencies = array(
749
-			array( 'RSD', 'Dinar', 'Dinars', '', 3, 1 ),
749
+			array('RSD', 'Dinar', 'Dinars', '', 3, 1),
750 750
 		);
751 751
 		global $wpdb;
752 752
 		$currency_table = $wpdb->prefix."esp_currency";
@@ -758,14 +758,14 @@  discard block
 block discarded – undo
758 758
 							"CUR_dec_plc" => '%d',
759 759
 							"CUR_active" => '%d',
760 760
 						);
761
-		if ( $this->_get_table_analysis()->tableExists( $currency_table ) ) {
762
-			foreach( $newer_currencies as $currency ) {
763
-				$SQL = "SELECT COUNT('CUR_code') FROM {$currency_table} WHERE CUR_code='{$currency[0]}' LIMIT 1" ;
761
+		if ($this->_get_table_analysis()->tableExists($currency_table)) {
762
+			foreach ($newer_currencies as $currency) {
763
+				$SQL = "SELECT COUNT('CUR_code') FROM {$currency_table} WHERE CUR_code='{$currency[0]}' LIMIT 1";
764 764
 				$countries = $wpdb->get_var($SQL);
765
-				if ( ! $countries ) {
765
+				if ( ! $countries) {
766 766
 
767
-					$wpdb->insert( $currency_table,
768
-							array_combine( array_keys( $currency_format), $currency ),
767
+					$wpdb->insert($currency_table,
768
+							array_combine(array_keys($currency_format), $currency),
769 769
 							$currency_format
770 770
 							);
771 771
 				}
@@ -777,9 +777,9 @@  discard block
 block discarded – undo
777 777
 	 * which should just be a temporary issue for folks who installed 4.8.0-4.8.5;
778 778
 	 * we should be able to stop doing this in 4.9
779 779
 	 */
780
-	public function fix_non_default_taxes(){
780
+	public function fix_non_default_taxes() {
781 781
 		global $wpdb;
782
-		$query = $wpdb->prepare( "UPDATE
782
+		$query = $wpdb->prepare("UPDATE
783 783
 				{$wpdb->prefix}esp_price p INNER JOIN
784 784
 				{$wpdb->prefix}esp_price_type pt ON p.PRT_ID = pt.PRT_ID
785 785
 			SET
@@ -787,7 +787,7 @@  discard block
 block discarded – undo
787 787
 			WHERE
788 788
 				p.PRC_is_default = 0 AND
789 789
 				pt.PBT_ID = %d
790
-					", EEM_Price_Type::base_type_tax );
791
-		$wpdb->query( $query );
790
+					", EEM_Price_Type::base_type_tax);
791
+		$wpdb->query($query);
792 792
 	}
793 793
 }
Please login to merge, or discard this patch.