Completed
Branch FET-8385-datetime-ticket-selec... (f41f36)
by
unknown
184:03 queued 173:38
created
maintenance/templates/ee_confirm_migration_crash_report_sent.template.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -5,39 +5,39 @@  discard block
 block discarded – undo
5 5
 /** @type string $reset_db_action_url */
6 6
 /** @type EE_Data_Migration_Script_Base $most_recent_migration */
7 7
 ?>
8
-<?php if ( $success ) { ?>
9
-	<h1><?php _e( "Database Update Crash Report Sent", "event_espresso" ); ?></h1>
10
-	<p><?php _e( "A crash report email was sent to Event Espresso. You should hear back from us soon.", "event_espresso" ); ?></p>
8
+<?php if ($success) { ?>
9
+	<h1><?php _e("Database Update Crash Report Sent", "event_espresso"); ?></h1>
10
+	<p><?php _e("A crash report email was sent to Event Espresso. You should hear back from us soon.", "event_espresso"); ?></p>
11 11
 <?php } else {//didn't send email properly ?>
12
-	<h1><?php _e( "Migration Report not sent", "event_espresso" ); ?></h1>
13
-	<p><?php _e( "An error occurred and we were not able to automatically send a report to Event Espresso support.", "event_espresso" ); ?></p>
14
-	<p><?php printf( esc_html__( "Please copy-and-paste the system information below to %s", "event_espresso" ), '<a href="mailto:' . EE_SUPPORT_EMAIL . '">' .EE_SUPPORT_EMAIL . "</a>" ); ?></p>
12
+	<h1><?php _e("Migration Report not sent", "event_espresso"); ?></h1>
13
+	<p><?php _e("An error occurred and we were not able to automatically send a report to Event Espresso support.", "event_espresso"); ?></p>
14
+	<p><?php printf(esc_html__("Please copy-and-paste the system information below to %s", "event_espresso"), '<a href="mailto:'.EE_SUPPORT_EMAIL.'">'.EE_SUPPORT_EMAIL."</a>"); ?></p>
15 15
 	<label>
16
-		<?php _e( "system status info", "event_espresso" ); ?>
17
-		<textarea name="system_status_info" class="system_status_info"><?php print_r( EEM_System_Status::instance()->get_system_stati() ); ?></textarea>
16
+		<?php _e("system status info", "event_espresso"); ?>
17
+		<textarea name="system_status_info" class="system_status_info"><?php print_r(EEM_System_Status::instance()->get_system_stati()); ?></textarea>
18 18
 	</label>
19 19
 <?php } ?>
20 20
 
21 21
 
22
-<h1><?php _e( "What's next?", 'event_espresso' ); ?></h1>
23
-<p><?php _e( "Well, it depends on your situation:", 'event_espresso' ); ?></p>
22
+<h1><?php _e("What's next?", 'event_espresso'); ?></h1>
23
+<p><?php _e("Well, it depends on your situation:", 'event_espresso'); ?></p>
24 24
 <div class='ee-table-wrap'>
25 25
 	<table>
26 26
 		<thead>
27 27
 			<tr>
28
-				<th><?php _e( "Your Situation", 'event_espresso' ); ?></th>
29
-				<th><?php _e( "Suggested Action", 'event_espresso' ); ?></th>
28
+				<th><?php _e("Your Situation", 'event_espresso'); ?></th>
29
+				<th><?php _e("Suggested Action", 'event_espresso'); ?></th>
30 30
 			</tr>
31 31
 		</thead>
32 32
 		<tbody>
33 33
 			<tr>
34
-				<td><p class='big-text'><?php _e( "I want to retry migrating my data", 'event_espresso' ); ?></p></td>
34
+				<td><p class='big-text'><?php _e("I want to retry migrating my data", 'event_espresso'); ?></p></td>
35 35
 				<td>
36 36
 					<p>
37 37
 						<?php
38 38
 						printf(
39
-							esc_html__( 'First, %1$s check the forums %2$s to see if there is a solution before re-attempting the Database Update. Often it helps to deactivate other plugins which may have conflicts; or it may help to add %3$s to your %4$s wp-config.php%5$s (which will make the update run slower, but may resolve any memory exhaustion errors.', 'event_espresso' ),
40
-							"<a href='" . EE_SUPPORT_EMAIL . "' target='_blank'>",
39
+							esc_html__('First, %1$s check the forums %2$s to see if there is a solution before re-attempting the Database Update. Often it helps to deactivate other plugins which may have conflicts; or it may help to add %3$s to your %4$s wp-config.php%5$s (which will make the update run slower, but may resolve any memory exhaustion errors.', 'event_espresso'),
40
+							"<a href='".EE_SUPPORT_EMAIL."' target='_blank'>",
41 41
 							'</a>',
42 42
 							'<pre lang="php">define( EE_MIGRATION_STEP_SIZE, 10 );</pre>',
43 43
 							'<b>',
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 					<p>
50 50
 						<?php
51 51
 						printf(
52
-							esc_html__( 'To retry updating your data: restore to the backup you made before the update and reactivate EE (and any addons you are using) and re-run the Database Update. If you did not make a database backup and are migrating from EE3: delete your EE4 data (use the %1$s Reset/Delete Data tab above%2$s), and then reactivate EE4, and then re-run the migration and updates. If you did not make a database backup, are only updating from a previous install of EE4, have found a solution to the fatal error you received, and are willing to possibly have some data lost, %3$sattempt to continue migrating%2$s.', 'event_espresso' ),
52
+							esc_html__('To retry updating your data: restore to the backup you made before the update and reactivate EE (and any addons you are using) and re-run the Database Update. If you did not make a database backup and are migrating from EE3: delete your EE4 data (use the %1$s Reset/Delete Data tab above%2$s), and then reactivate EE4, and then re-run the migration and updates. If you did not make a database backup, are only updating from a previous install of EE4, have found a solution to the fatal error you received, and are willing to possibly have some data lost, %3$sattempt to continue migrating%2$s.', 'event_espresso'),
53 53
 							"<a href='$reset_db_page_url'>",
54 54
 							"</a>",
55 55
 							"<a class='button-primary' href='$reattempt_action_url'>"
@@ -60,13 +60,13 @@  discard block
 block discarded – undo
60 60
 			</tr>
61 61
 			<tr>
62 62
 				<td>
63
-					<p class='big-text'><?php _e( "I want to hear from Support before proceeding", 'event_espresso' ); ?></p>
63
+					<p class='big-text'><?php _e("I want to hear from Support before proceeding", 'event_espresso'); ?></p>
64 64
 				</td>
65 65
 				<td>
66 66
 					<?php
67 67
 					printf(
68
-						esc_html__( 'Just make sure you\'ve %1$s checked for a solution in the forums,%2$s and properly contacted Support. We will get back to you as soon as possible', 'event_espresso' ),
69
-						"<a href='" . EE_SUPPORT_EMAIL . "'>",
68
+						esc_html__('Just make sure you\'ve %1$s checked for a solution in the forums,%2$s and properly contacted Support. We will get back to you as soon as possible', 'event_espresso'),
69
+						"<a href='".EE_SUPPORT_EMAIL."'>",
70 70
 						"</a>"
71 71
 					);
72 72
 					?>
@@ -74,12 +74,12 @@  discard block
 block discarded – undo
74 74
 			</tr>
75 75
 			<tr>
76 76
 				<td>
77
-					<p class='big-text'><?php printf( esc_html__( 'I don\'t need my old EE %s data', 'event_espresso' ), $most_recent_migration->slug() ); ?></p>
77
+					<p class='big-text'><?php printf(esc_html__('I don\'t need my old EE %s data', 'event_espresso'), $most_recent_migration->slug()); ?></p>
78 78
 				</td>
79 79
 				<td>
80 80
 					<?php
81 81
 					printf(
82
-						esc_html__( 'If you are ok with losing all the EE %1$s data, you can skip the Database Updates and %2$s use EE4 with only default Data%3$s', 'event_espresso' ),
82
+						esc_html__('If you are ok with losing all the EE %1$s data, you can skip the Database Updates and %2$s use EE4 with only default Data%3$s', 'event_espresso'),
83 83
 						$most_recent_migration->slug(),
84 84
 						"<a id='do-not-migrate' class='do-not-migrate button-primary' href='$reset_db_action_url'>",
85 85
 						"</a>"
@@ -89,20 +89,20 @@  discard block
 block discarded – undo
89 89
 			</tr>
90 90
 			<tr>
91 91
 				<td>
92
-					<p class='big-text'><?php printf( esc_html__( 'I want to go back to my old version of EE %1$s', 'event_espresso' ), $most_recent_migration->slug() ); ?>
92
+					<p class='big-text'><?php printf(esc_html__('I want to go back to my old version of EE %1$s', 'event_espresso'), $most_recent_migration->slug()); ?>
93 93
 				</td>
94 94
 				<td>
95 95
 					<p>
96 96
 					<?php
97 97
 					printf(
98
-						esc_html__( 'Then we suggest you re-activate the old version of EE %3$s and restore your database to the backup you made just before the Database Update . If you didn\'t backup your database and are migrating from EE3, you can also delete your EE4 data (use on the %1$s"Reset/Delete Data" tab above%2$s), and then reactivate EE3 from the plugins page. Note: some of your EE3 shortcodes may have been changed to their EE4 equivalents, so you will need to change them back.', 'event_espresso' ),
98
+						esc_html__('Then we suggest you re-activate the old version of EE %3$s and restore your database to the backup you made just before the Database Update . If you didn\'t backup your database and are migrating from EE3, you can also delete your EE4 data (use on the %1$s"Reset/Delete Data" tab above%2$s), and then reactivate EE3 from the plugins page. Note: some of your EE3 shortcodes may have been changed to their EE4 equivalents, so you will need to change them back.', 'event_espresso'),
99 99
 						"<a href='$reset_db_page_url'>",
100 100
 						"</a>",
101 101
 						$most_recent_migration->slug()
102 102
 					);
103 103
 					?>
104 104
 					</p>
105
-					<p><?php _e( "If you ever decide to re-attempt using EE4, you will again be given the option to migrate your EE3 data or not.", 'event_espresso' ); ?></p>
105
+					<p><?php _e("If you ever decide to re-attempt using EE4, you will again be given the option to migrate your EE3 data or not.", 'event_espresso'); ?></p>
106 106
 				</td>
107 107
 			</tr>
108 108
 
Please login to merge, or discard this patch.
maintenance/templates/ee_upgrade_addons_before_migrating.template.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 ?>
4
-<h1><?php esc_html_e("You must upgrade your Event Espresso Add-ons before Migrating", "event_espresso");?></h1>
5
-<p><?php printf(esc_html__("Please %s visit the plugins page%s and update all Event Espresso addon plugins before updating your database.", "event_espresso"), "<a href='".admin_url('/plugins.php')."'>","</a>");?></p>
6
-<p><?php esc_html_e("You can also deactivate the addons, but all of their data will be lost when your database is migrated", "event_espresso");?></p>
7 4
\ No newline at end of file
5
+<h1><?php esc_html_e("You must upgrade your Event Espresso Add-ons before Migrating", "event_espresso"); ?></h1>
6
+<p><?php printf(esc_html__("Please %s visit the plugins page%s and update all Event Espresso addon plugins before updating your database.", "event_espresso"), "<a href='".admin_url('/plugins.php')."'>", "</a>"); ?></p>
7
+<p><?php esc_html_e("You can also deactivate the addons, but all of their data will be lost when your database is migrated", "event_espresso"); ?></p>
8 8
\ No newline at end of file
Please login to merge, or discard this patch.
admin_pages/maintenance/templates/ee_migration_page.template.php 1 patch
Indentation   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -28,29 +28,29 @@  discard block
 block discarded – undo
28 28
             <h3 class="espresso-header">
29 29
                 <span class="dashicons dashicons-flag ee-icon-size-22"></span>
30 30
                 <?php
31
-                echo apply_filters(
32
-                        'FHEE__ee_migration_page__header',
33
-                        sprintf(
34
-                                esc_html__("Your Event Espresso data needs to be updated.", "event_espresso"),
35
-                                $current_db_state,
36
-                                $next_db_state
37
-                        ),
38
-                        $current_db_state,
39
-                        $next_db_state
40
-                );
41
-                ?>
31
+				echo apply_filters(
32
+						'FHEE__ee_migration_page__header',
33
+						sprintf(
34
+								esc_html__("Your Event Espresso data needs to be updated.", "event_espresso"),
35
+								$current_db_state,
36
+								$next_db_state
37
+						),
38
+						$current_db_state,
39
+						$next_db_state
40
+				);
41
+				?>
42 42
             </h3>
43 43
         <?php } elseif ($show_most_recent_migration) { ?>
44 44
             <h3 class="espresso-header">
45 45
                 <span class="dashicons dashicons-awards ee-icon-size-22"></span>
46 46
                 <?php echo apply_filters('FHEE__ee_migration_page__done_migration_header',
47
-                        sprintf(esc_html__('Congratulations! Your database is "up-to-date" and you are ready to begin using %s',
48
-                                "event_espresso"), $ultimate_db_state)); ?>
47
+						sprintf(esc_html__('Congratulations! Your database is "up-to-date" and you are ready to begin using %s',
48
+								"event_espresso"), $ultimate_db_state)); ?>
49 49
             </h3>
50 50
             <p>
51 51
                 <?php echo apply_filters('FHEE__ee_migration_page__p_after_done_migration_header',
52
-                        sprintf(esc_html__("Time to find out about all the great new features %s has to offer.",
53
-                                "event_espresso"), $ultimate_db_state)); ?> &nbsp;
52
+						sprintf(esc_html__("Time to find out about all the great new features %s has to offer.",
53
+								"event_espresso"), $ultimate_db_state)); ?> &nbsp;
54 54
                 <b><a id="get-started-after-migrate" class="button-primary"
55 55
                       href="<?php echo add_query_arg(array('page' => 'espresso_about'), admin_url('admin.php')); ?>">
56 56
                         <?php esc_html_e("Let's Get Started", "event_espresso"); ?>&nbsp;<span
@@ -61,34 +61,34 @@  discard block
 block discarded – undo
61 61
 
62 62
 
63 63
         <?php if ($show_backup_db_text) {
64
-            echo $migration_options_html;
65
-        } ?>
64
+			echo $migration_options_html;
65
+		} ?>
66 66
 
67 67
         <?php
68
-        if ($show_most_recent_migration) {
69
-            if ($most_recent_migration && $most_recent_migration instanceof EE_Data_Migration_Script_Base) {
70
-                if ($most_recent_migration->can_continue()) {
71
-                    //tell the user they should continue their migration because it appears to be unfinished... well, assuming there were no errors ?>
68
+		if ($show_most_recent_migration) {
69
+			if ($most_recent_migration && $most_recent_migration instanceof EE_Data_Migration_Script_Base) {
70
+				if ($most_recent_migration->can_continue()) {
71
+					//tell the user they should continue their migration because it appears to be unfinished... well, assuming there were no errors ?>
72 72
                     <h3 class="espresso-header">
73 73
                         <span class="dashicons dashicons-star-half ee-icon-size-22"></span>
74 74
                         <?php printf(esc_html__("It appears that your previous Database Update (%s) is incomplete, and should be resumed",
75
-                                "event_espresso"), $most_recent_migration->pretty_name()); ?>
75
+								"event_espresso"), $most_recent_migration->pretty_name()); ?>
76 76
                     </h3>
77 77
                 <?php } elseif ($most_recent_migration->is_broken()) {
78
-                    //tell the user the migration failed and they should notify EE?>
78
+					//tell the user the migration failed and they should notify EE?>
79 79
                     <h3 class="espresso-header">
80 80
                         <span class="dashicons dashicons-no ee-icon-size-22"></span>
81 81
                         <?php echo $most_recent_migration->get_feedback_message() ?>
82 82
                     </h3>
83 83
                 <?php }
84
-                //display errors or not of the most recent migration ran
85
-                if ($most_recent_migration->get_errors()) { ?>
84
+				//display errors or not of the most recent migration ran
85
+				if ($most_recent_migration->get_errors()) { ?>
86 86
                     <div class="ee-attention">
87 87
                         <strong><?php printf(esc_html__("Warnings occurred during your last Database Update (%s):",
88
-                                    'event_espresso'),
89
-                                    $most_recent_migration->pretty_name()) ?></strong>
88
+									'event_espresso'),
89
+									$most_recent_migration->pretty_name()) ?></strong>
90 90
                         <a id="show-hide-migration-warnings" class="display-the-hidden"><?php esc_html_e("Show Warnings",
91
-                                    'event_espresso'); ?></a>
91
+									'event_espresso'); ?></a>
92 92
                         <ul class="migration-warnings" style="display:none">
93 93
                             <?php foreach ($most_recent_migration->get_errors() as $error) { ?>
94 94
                                 <li><?php echo htmlentities($error) ?></li>
@@ -96,15 +96,15 @@  discard block
 block discarded – undo
96 96
                         </ul>
97 97
                     </div>
98 98
                 <?php } else {
99
-                    //there were no errors during the last migration, just say so?>
99
+					//there were no errors during the last migration, just say so?>
100 100
                     <h2><?php printf(esc_html__("The last Database Update (%s) ran successfully without errors.",
101
-                                "event_espresso"), $most_recent_migration->pretty_name()) ?></h2>
101
+								"event_espresso"), $most_recent_migration->pretty_name()) ?></h2>
102 102
                 <?php }
103
-            } else {
104
-            }
105
-        }
106
-        // end of: if ( $show_most_recent_migration )
107
-        ?>
103
+			} else {
104
+			}
105
+		}
106
+		// end of: if ( $show_most_recent_migration )
107
+		?>
108 108
 
109 109
     </div>
110 110
     <!--end of #migration-prep-->
@@ -124,12 +124,12 @@  discard block
 block discarded – undo
124 124
             <div id='progress-area'>
125 125
                 <h3 class="espresso-header">
126 126
                     <?php
127
-                    echo sprintf(_n(
128
-                            "The following task needs to be performed:",
129
-                            "The following %s tasks need to be performed:",
130
-                            count($script_names),
131
-                            "event_espresso"
132
-                    ), count($script_names)); ?>
127
+					echo sprintf(_n(
128
+							"The following task needs to be performed:",
129
+							"The following %s tasks need to be performed:",
130
+							count($script_names),
131
+							"event_espresso"
132
+					), count($script_names)); ?>
133 133
                 </h3>
134 134
                 <ul style="list-style: inside;">
135 135
                     <?php foreach ($script_names as $script_name) { ?>
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
                 <br/>
140 140
                 <?php if (count($script_names) > 1) { ?>
141 141
                     <p><?php esc_html_e("Please note: after each task is completed you will need to continue the Database Update, or report an error to Event Espresso.",
142
-                                "event_espresso"); ?></p>
142
+								"event_espresso"); ?></p>
143 143
                 <?php } ?>
144 144
 
145 145
                 <div class="ee-attention">
@@ -149,11 +149,11 @@  discard block
 block discarded – undo
149 149
 					</span>
150 150
                         <br/>
151 151
                         <?php esc_html_e("Depending on the number of events and the complexity of the information in your database, this could take a few minutes.",
152
-                                "event_espresso"); ?>
152
+								"event_espresso"); ?>
153 153
                     </p>
154 154
                     <p>
155 155
                         <?php printf(esc_html__("%sPlease be patient and do NOT navigate away from this page once the migration has begun%s. If any issues arise due to existing malformed data, an itemized report will be made available to you after the migration has completed.",
156
-                                "event_espresso"), '<strong>', '</strong>'); ?>
156
+								"event_espresso"), '<strong>', '</strong>'); ?>
157 157
                     </p>
158 158
                     <p>
159 159
                         <?php esc_html_e("Click the button below to begin the migration process.", "event_espresso") ?>
@@ -169,8 +169,8 @@  discard block
 block discarded – undo
169 169
 
170 170
                 <button id='start-migration' class='button-primary'>
171 171
                     <?php echo $show_continue_current_migration_script ? esc_html__("Continue Database Update",
172
-                            "event_espresso")
173
-                            : esc_html__("Begin Database Update", "event_espresso"); ?>
172
+							"event_espresso")
173
+							: esc_html__("Begin Database Update", "event_espresso"); ?>
174 174
                 </button>
175 175
                 <br class="clear"/>
176 176
 
@@ -186,10 +186,10 @@  discard block
 block discarded – undo
186 186
         </div>
187 187
 
188 188
     <?php }
189
-    if ($show_maintenance_switch) {
190
-        ?>
189
+	if ($show_maintenance_switch) {
190
+		?>
191 191
         <h2><span class="dashicons dashicons-admin-tools"></span><?php esc_html_e('Set Event Espresso Maintenance Mode',
192
-                    'event_espresso'); ?></h2>
192
+					'event_espresso'); ?></h2>
193 193
         <form method='post' action='<?php echo $update_migration_script_page_link ?>'>
194 194
             <div class="ee-table-wrap">
195 195
                 <table>
@@ -197,15 +197,15 @@  discard block
 block discarded – undo
197 197
                         <td width="40px" align="center">
198 198
                             <input type="radio" id="maintenance_mode_level_off" name="maintenance_mode_level"
199 199
                                    value="0" <?php echo EE_Maintenance_Mode::instance()->level()
200
-                                                        == EE_Maintenance_Mode::level_0_not_in_maintenance
201
-                                    ? 'checked="checked"' : '' ?>>
200
+														== EE_Maintenance_Mode::level_0_not_in_maintenance
201
+									? 'checked="checked"' : '' ?>>
202 202
                         </td>
203 203
                         <th align="left">
204 204
                             <label for="maintenance_mode_level_off"><?php esc_html_e('Maintenance Mode OFF',
205
-                                        'event_espresso'); ?></label>
205
+										'event_espresso'); ?></label>
206 206
                             <p class='description' style="font-weight: normal;">
207 207
                                 <?php esc_html_e("This is the normal operating mode for Event Espresso and allows all functionality to be viewed by all site visitors.",
208
-                                        "event_espresso"); ?>
208
+										"event_espresso"); ?>
209 209
                             </p>
210 210
                         </th>
211 211
                     </tr>
@@ -213,8 +213,8 @@  discard block
 block discarded – undo
213 213
                         <td width="40px" align="center">
214 214
                             <input type="radio" id="maintenance_mode_level_on" name="maintenance_mode_level"
215 215
                                    value="1" <?php echo EE_Maintenance_Mode::instance()->level()
216
-                                                        == EE_Maintenance_Mode::level_1_frontend_only_maintenance
217
-                                    ? 'checked="checked"' : '' ?>>
216
+														== EE_Maintenance_Mode::level_1_frontend_only_maintenance
217
+									? 'checked="checked"' : '' ?>>
218 218
                         </td>
219 219
                         <th align="left">
220 220
                             <label for="maintenance_mode_level_on">
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
                             </label>
223 223
                             <p class='description' style="font-weight: normal;">
224 224
                                 <?php esc_html_e("This disables Event Espresso frontend functionality for all site visitors that are not administrators, and allows you to configure and/or test things on the frontend of your website before others can see.",
225
-                                        "event_espresso"); ?>
225
+										"event_espresso"); ?>
226 226
                             </p>
227 227
                         </th>
228 228
                     </tr>
@@ -234,6 +234,6 @@  discard block
 block discarded – undo
234 234
             </p>
235 235
         </form>
236 236
         <?php
237
-    } ?>
237
+	} ?>
238 238
 
239 239
 </div>
Please login to merge, or discard this patch.
admin_pages/maintenance/templates/ee_migration_was_borked_page.template.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1,26 +1,26 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 ?>
4
-<h1><?php esc_html_e("Data Migration Error", "event_espresso");?></h1>
5
-<p class='error'><?php printf(esc_html__("Your last Database Update had a %s FATAL ERROR, and CANNOT be continued%s.", "event_espresso"),"<b>","</b>");?></p>
6
-<a id="show-hide-migration-warnings" class="display-the-hidden"><?php esc_html_e("Show Errors", 'event_espresso');?></a>
4
+<h1><?php esc_html_e("Data Migration Error", "event_espresso"); ?></h1>
5
+<p class='error'><?php printf(esc_html__("Your last Database Update had a %s FATAL ERROR, and CANNOT be continued%s.", "event_espresso"), "<b>", "</b>"); ?></p>
6
+<a id="show-hide-migration-warnings" class="display-the-hidden"><?php esc_html_e("Show Errors", 'event_espresso'); ?></a>
7 7
 <ul class="migration-warnings" style="display:none">
8
-<?php foreach($most_recent_migration->get_errors() as $error){ ?>
8
+<?php foreach ($most_recent_migration->get_errors() as $error) { ?>
9 9
 	<li style="overflow-y:auto;max-height:100px"><?php echo esc_html($error)?></li>
10 10
 <?php }?>
11 11
 </ul>
12
-<h2><?php esc_html_e("Fill out the below form to automatically Send Event Espresso a Crash Report", "event_espresso");?></h2>
13
-<form action='<?php echo EE_Admin_Page::add_query_args_and_nonce(array('action'=>'send_migration_crash_report'), EE_MAINTENANCE_ADMIN_URL);?>' method='post'>
12
+<h2><?php esc_html_e("Fill out the below form to automatically Send Event Espresso a Crash Report", "event_espresso"); ?></h2>
13
+<form action='<?php echo EE_Admin_Page::add_query_args_and_nonce(array('action'=>'send_migration_crash_report'), EE_MAINTENANCE_ADMIN_URL); ?>' method='post'>
14 14
 	<table class='widefat'>
15
-		<tr><td><label for='from'><?php esc_html_e("From/Reply-To:", "event_espresso");?></label></td><td><input name='from' id='from' type='text' style="width:200px"value='<?php echo get_bloginfo('admin_email','display'); ?>'></td></tr>
16
-		<tr><td><label for='from_name'><?php esc_html_e("Your Name", "event_espresso");?></label></td><td><input name='from_name' id='from_name' type='text' style="width:200px"value='<?php printf(esc_html__("Admin of %s", "event_espresso"),get_bloginfo('name','display'));?>'></td></tr>
17
-		<tr><td><label for='body'><?php esc_html_e("Comments", "event_espresso");?></label></td><td><textarea name="body" id="body" class='system_status_info'><?php esc_html_e("Enter any comments about why you think the error may have occurred", "event_espresso");?></textarea>
18
-			<p class='description'><?php esc_html_e("Note: the System Information report will also be added to the email's body, which contains information about your Event Espresso, Wordpress, and PHP settings which can be helpful in debugging the problem.", "event_espresso");?></p></td></tr>
19
-		<tr><td colspan="2"><input type="submit" value="<?php esc_html_e("Mail Crash Report to Event Espresso", "event_espresso");?>"/></td></tr>
15
+		<tr><td><label for='from'><?php esc_html_e("From/Reply-To:", "event_espresso"); ?></label></td><td><input name='from' id='from' type='text' style="width:200px"value='<?php echo get_bloginfo('admin_email', 'display'); ?>'></td></tr>
16
+		<tr><td><label for='from_name'><?php esc_html_e("Your Name", "event_espresso"); ?></label></td><td><input name='from_name' id='from_name' type='text' style="width:200px"value='<?php printf(esc_html__("Admin of %s", "event_espresso"), get_bloginfo('name', 'display')); ?>'></td></tr>
17
+		<tr><td><label for='body'><?php esc_html_e("Comments", "event_espresso"); ?></label></td><td><textarea name="body" id="body" class='system_status_info'><?php esc_html_e("Enter any comments about why you think the error may have occurred", "event_espresso"); ?></textarea>
18
+			<p class='description'><?php esc_html_e("Note: the System Information report will also be added to the email's body, which contains information about your Event Espresso, Wordpress, and PHP settings which can be helpful in debugging the problem.", "event_espresso"); ?></p></td></tr>
19
+		<tr><td colspan="2"><input type="submit" value="<?php esc_html_e("Mail Crash Report to Event Espresso", "event_espresso"); ?>"/></td></tr>
20 20
 	</table>
21 21
 </form>
22 22
 <br>
23
-<p><?php printf(esc_html__('...or copy-and-paste the below information to %1$s %2$s %3$s', "event_espresso"),'<a href="mailto:'.EE_SUPPORT_EMAIL.'">',EE_SUPPORT_EMAIL,"</a>");?></p>
24
-<textarea class="system_status_info"><?php print_r( EEM_System_Status::instance()->get_system_stati())?></textarea>
25
-<p><?php printf( esc_html__( '%1$sNext Step%2$s', 'event_espresso' ), "<a href='$next_url'>","</a>");?></p>
26
-<p><?php printf( esc_html__( '...or %1$sDON\'T send crash report%2$s.', 'event_espresso' ), "<a href='$next_url'>","</a>");?></p>
23
+<p><?php printf(esc_html__('...or copy-and-paste the below information to %1$s %2$s %3$s', "event_espresso"), '<a href="mailto:'.EE_SUPPORT_EMAIL.'">', EE_SUPPORT_EMAIL, "</a>"); ?></p>
24
+<textarea class="system_status_info"><?php print_r(EEM_System_Status::instance()->get_system_stati())?></textarea>
25
+<p><?php printf(esc_html__('%1$sNext Step%2$s', 'event_espresso'), "<a href='$next_url'>", "</a>"); ?></p>
26
+<p><?php printf(esc_html__('...or %1$sDON\'T send crash report%2$s.', 'event_espresso'), "<a href='$next_url'>", "</a>"); ?></p>
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_DMS_Core_4_7_0.dms.php 1 patch
Indentation   +181 added lines, -182 removed lines patch added patch discarded remove patch
@@ -9,7 +9,6 @@  discard block
 block discarded – undo
9 9
  * and recalculates esp_registration.REG_final_price to actually be the final price
10 10
  * for that registration (before this it was just the ticket's price, NOT including
11 11
  * taxes or other price modifiers)
12
-
13 12
  */
14 13
 // make sure we have all the stages loaded too
15 14
 // unfortunately, this needs to be done upon INCLUSION of this file,
@@ -18,9 +17,9 @@  discard block
 block discarded – undo
18 17
 $stages = glob(EE_CORE . 'data_migration_scripts/4_7_0_stages/*');
19 18
 $class_to_filepath = array();
20 19
 foreach ($stages as $filepath) {
21
-    $matches = array();
22
-    preg_match('~4_7_0_stages/(.*).dmsstage.php~', $filepath, $matches);
23
-    $class_to_filepath[$matches[1]] = $filepath;
20
+	$matches = array();
21
+	preg_match('~4_7_0_stages/(.*).dmsstage.php~', $filepath, $matches);
22
+	$class_to_filepath[$matches[1]] = $filepath;
24 23
 }
25 24
 //give addons a chance to autoload their stages too
26 25
 $class_to_filepath = apply_filters('FHEE__EE_DMS_4_7_0__autoloaded_stages', $class_to_filepath);
@@ -39,72 +38,72 @@  discard block
 block discarded – undo
39 38
 class EE_DMS_Core_4_7_0 extends EE_Data_Migration_Script_Base
40 39
 {
41 40
 
42
-    /**
43
-     * return EE_DMS_Core_4_7_0
44
-     *
45
-     * @param TableManager  $table_manager
46
-     * @param TableAnalysis $table_analysis
47
-     */
48
-    public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null)
49
-    {
50
-        $this->_pretty_name = __("Data Update to Event Espresso 4.7.0", "event_espresso");
51
-        $this->_priority = 10;
52
-        $this->_migration_stages = array(
53
-            new EE_DMS_4_7_0_Add_Taxes_To_REG_Final_Price(),
54
-            new EE_DMS_4_7_0_Registration_Payments(),
55
-        );
56
-        parent::__construct($table_manager, $table_analysis);
57
-    }
41
+	/**
42
+	 * return EE_DMS_Core_4_7_0
43
+	 *
44
+	 * @param TableManager  $table_manager
45
+	 * @param TableAnalysis $table_analysis
46
+	 */
47
+	public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null)
48
+	{
49
+		$this->_pretty_name = __("Data Update to Event Espresso 4.7.0", "event_espresso");
50
+		$this->_priority = 10;
51
+		$this->_migration_stages = array(
52
+			new EE_DMS_4_7_0_Add_Taxes_To_REG_Final_Price(),
53
+			new EE_DMS_4_7_0_Registration_Payments(),
54
+		);
55
+		parent::__construct($table_manager, $table_analysis);
56
+	}
58 57
 
59 58
 
60 59
 
61
-    /**
62
-     * @param array $version_array
63
-     * @return bool
64
-     */
65
-    public function can_migrate_from_version($version_array)
66
-    {
67
-        $version_string = $version_array['Core'];
68
-        if (
69
-            (
70
-                version_compare($version_string, '4.7.0', '<=')
71
-                && version_compare($version_string, '4.6.0', '>=')
72
-            )
73
-            || (
74
-                version_compare($version_string, '4.7.0', '>=')
75
-                && ! $this->_get_table_analysis()->tableExists('esp_registration_payment')
76
-                && $this->_get_table_analysis()->tableExists('esp_registration')
77
-            )
78
-        ) {
79
-            return true;
80
-        } elseif ( ! $version_string) {
81
-            //no version string provided... this must be pre 4.3
82
-            return false;//changed mind. dont want people thinking they should migrate yet because they cant
83
-        } else {
84
-            return false;
85
-        }
86
-    }
60
+	/**
61
+	 * @param array $version_array
62
+	 * @return bool
63
+	 */
64
+	public function can_migrate_from_version($version_array)
65
+	{
66
+		$version_string = $version_array['Core'];
67
+		if (
68
+			(
69
+				version_compare($version_string, '4.7.0', '<=')
70
+				&& version_compare($version_string, '4.6.0', '>=')
71
+			)
72
+			|| (
73
+				version_compare($version_string, '4.7.0', '>=')
74
+				&& ! $this->_get_table_analysis()->tableExists('esp_registration_payment')
75
+				&& $this->_get_table_analysis()->tableExists('esp_registration')
76
+			)
77
+		) {
78
+			return true;
79
+		} elseif ( ! $version_string) {
80
+			//no version string provided... this must be pre 4.3
81
+			return false;//changed mind. dont want people thinking they should migrate yet because they cant
82
+		} else {
83
+			return false;
84
+		}
85
+	}
87 86
 
88 87
 
89 88
 
90
-    /**
91
-     * @return bool
92
-     */
93
-    public function schema_changes_before_migration()
94
-    {
95
-        //relies on 4.1's EEH_Activation::create_table
96
-        require_once(EE_HELPERS . 'EEH_Activation.helper.php');
97
-        $table_name = 'esp_answer';
98
-        $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
89
+	/**
90
+	 * @return bool
91
+	 */
92
+	public function schema_changes_before_migration()
93
+	{
94
+		//relies on 4.1's EEH_Activation::create_table
95
+		require_once(EE_HELPERS . 'EEH_Activation.helper.php');
96
+		$table_name = 'esp_answer';
97
+		$sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
99 98
 					REG_ID INT UNSIGNED NOT NULL,
100 99
 					QST_ID INT UNSIGNED NOT NULL,
101 100
 					ANS_value TEXT NOT NULL,
102 101
 					PRIMARY KEY  (ANS_ID),
103 102
 					KEY REG_ID (REG_ID),
104 103
 					KEY QST_ID (QST_ID)";
105
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
106
-        $table_name = 'esp_attendee_meta';
107
-        $sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
104
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
105
+		$table_name = 'esp_attendee_meta';
106
+		$sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
108 107
 						ATT_ID BIGINT(20) UNSIGNED NOT NULL,
109 108
 						ATT_fname VARCHAR(45) NOT NULL,
110 109
 						ATT_lname VARCHAR(45) NOT	NULL,
@@ -121,9 +120,9 @@  discard block
 block discarded – undo
121 120
 								KEY ATT_email (ATT_email),
122 121
 								KEY ATT_lname (ATT_lname),
123 122
 								KEY ATT_fname (ATT_fname)";
124
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
125
-        $table_name = 'esp_country';
126
-        $sql = "CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL,
123
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
124
+		$table_name = 'esp_country';
125
+		$sql = "CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL,
127 126
 					  CNT_ISO3 VARCHAR(3) COLLATE utf8_bin NOT NULL,
128 127
 					  RGN_ID TINYINT(3) UNSIGNED DEFAULT NULL,
129 128
 					  CNT_name VARCHAR(45) COLLATE utf8_bin NOT NULL,
@@ -139,25 +138,25 @@  discard block
 block discarded – undo
139 138
 					  CNT_is_EU TINYINT(1) DEFAULT '0',
140 139
 					  CNT_active TINYINT(1) DEFAULT '0',
141 140
 					  PRIMARY KEY  (CNT_ISO)";
142
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
143
-        $table_name = 'esp_currency';
144
-        $sql = "CUR_code VARCHAR(6) COLLATE utf8_bin NOT NULL,
141
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
142
+		$table_name = 'esp_currency';
143
+		$sql = "CUR_code VARCHAR(6) COLLATE utf8_bin NOT NULL,
145 144
 				CUR_single VARCHAR(45) COLLATE utf8_bin DEFAULT 'dollar',
146 145
 				CUR_plural VARCHAR(45) COLLATE utf8_bin DEFAULT 'dollars',
147 146
 				CUR_sign VARCHAR(45) COLLATE utf8_bin DEFAULT '$',
148 147
 				CUR_dec_plc VARCHAR(1) COLLATE utf8_bin NOT NULL DEFAULT '2',
149 148
 				CUR_active TINYINT(1) DEFAULT '0',
150 149
 				PRIMARY KEY  (CUR_code)";
151
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
152
-        $table_name = 'esp_currency_payment_method';
153
-        $sql = "CPM_ID INT(11) NOT NULL AUTO_INCREMENT,
150
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
151
+		$table_name = 'esp_currency_payment_method';
152
+		$sql = "CPM_ID INT(11) NOT NULL AUTO_INCREMENT,
154 153
 				CUR_code  VARCHAR(6) COLLATE utf8_bin NOT NULL,
155 154
 				PMD_ID INT(11) NOT NULL,
156 155
 				PRIMARY KEY  (CPM_ID),
157 156
 				KEY PMD_ID (PMD_ID)";
158
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
159
-        $table_name = 'esp_datetime';
160
-        $sql = "DTT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
157
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
158
+		$table_name = 'esp_datetime';
159
+		$sql = "DTT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
161 160
 				  EVT_ID BIGINT(20) UNSIGNED NOT NULL,
162 161
 				  DTT_name VARCHAR(255) NOT NULL DEFAULT '',
163 162
 				  DTT_description TEXT NOT NULL,
@@ -173,9 +172,9 @@  discard block
 block discarded – undo
173 172
 						KEY DTT_EVT_start (DTT_EVT_start),
174 173
 						KEY EVT_ID (EVT_ID),
175 174
 						KEY DTT_is_primary (DTT_is_primary)";
176
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
177
-        $table_name = 'esp_event_meta';
178
-        $sql = "
175
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
176
+		$table_name = 'esp_event_meta';
177
+		$sql = "
179 178
 			EVTM_ID INT NOT NULL AUTO_INCREMENT,
180 179
 			EVT_ID BIGINT(20) UNSIGNED NOT NULL,
181 180
 			EVT_display_desc TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
@@ -191,34 +190,34 @@  discard block
 block discarded – undo
191 190
 			EVT_donations TINYINT(1) NULL,
192 191
 			PRIMARY KEY  (EVTM_ID),
193 192
 			KEY EVT_ID (EVT_ID)";
194
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
195
-        $table_name = 'esp_event_question_group';
196
-        $sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
193
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
194
+		$table_name = 'esp_event_question_group';
195
+		$sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
197 196
 					EVT_ID BIGINT(20) UNSIGNED NOT NULL,
198 197
 					QSG_ID INT UNSIGNED NOT NULL,
199 198
 					EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
200 199
 					PRIMARY KEY  (EQG_ID),
201 200
 					KEY EVT_ID (EVT_ID),
202 201
 					KEY QSG_ID (QSG_ID)";
203
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
204
-        $table_name = 'esp_event_venue';
205
-        $sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
202
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
203
+		$table_name = 'esp_event_venue';
204
+		$sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
206 205
 				EVT_ID BIGINT(20) UNSIGNED NOT NULL,
207 206
 				VNU_ID BIGINT(20) UNSIGNED NOT NULL,
208 207
 				EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
209 208
 				PRIMARY KEY  (EVV_ID)";
210
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
211
-        $table_name = 'esp_extra_meta';
212
-        $sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
209
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
210
+		$table_name = 'esp_extra_meta';
211
+		$sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
213 212
 				OBJ_ID INT(11) DEFAULT NULL,
214 213
 				EXM_type VARCHAR(45) DEFAULT NULL,
215 214
 				EXM_key VARCHAR(45) DEFAULT NULL,
216 215
 				EXM_value TEXT,
217 216
 				PRIMARY KEY  (EXM_ID),
218 217
 				KEY EXM_type (EXM_type, OBJ_ID, EXM_key(45))";
219
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
220
-        $table_name = 'esp_line_item';
221
-        $sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
218
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
219
+		$table_name = 'esp_line_item';
220
+		$sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
222 221
 				LIN_code VARCHAR(245) NOT NULL DEFAULT '',
223 222
 				TXN_ID INT(11) DEFAULT NULL,
224 223
 				LIN_name VARCHAR(245) NOT NULL DEFAULT '',
@@ -236,9 +235,9 @@  discard block
 block discarded – undo
236 235
 				PRIMARY KEY  (LIN_ID),
237 236
 				KEY LIN_code (LIN_code(191)),
238 237
 				KEY TXN_ID (TXN_ID)";
239
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
240
-        $table_name = 'esp_log';
241
-        $sql = "LOG_ID INT(11) NOT NULL AUTO_INCREMENT,
238
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
239
+		$table_name = 'esp_log';
240
+		$sql = "LOG_ID INT(11) NOT NULL AUTO_INCREMENT,
242 241
 				LOG_time DATETIME DEFAULT NULL,
243 242
 				OBJ_ID VARCHAR(45) DEFAULT NULL,
244 243
 				OBJ_type VARCHAR(45) DEFAULT NULL,
@@ -249,18 +248,18 @@  discard block
 block discarded – undo
249 248
 				KEY LOG_time (LOG_time),
250 249
 				KEY OBJ (OBJ_type,OBJ_ID),
251 250
 				KEY LOG_type (LOG_type)";
252
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
253
-        $table_name = 'esp_message_template';
254
-        $sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
251
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
252
+		$table_name = 'esp_message_template';
253
+		$sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
255 254
 					GRP_ID INT(10) UNSIGNED NOT NULL,
256 255
 					MTP_context VARCHAR(50) NOT NULL,
257 256
 					MTP_template_field VARCHAR(30) NOT NULL,
258 257
 					MTP_content TEXT NOT NULL,
259 258
 					PRIMARY KEY  (MTP_ID),
260 259
 					KEY GRP_ID (GRP_ID)";
261
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
262
-        $table_name = 'esp_message_template_group';
263
-        $sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
260
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
261
+		$table_name = 'esp_message_template_group';
262
+		$sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
264 263
 					MTP_user_id INT(10) NOT NULL DEFAULT '1',
265 264
 					MTP_name VARCHAR(245) NOT NULL DEFAULT '',
266 265
 					MTP_description VARCHAR(245) NOT NULL DEFAULT '',
@@ -272,17 +271,17 @@  discard block
 block discarded – undo
272 271
 					MTP_is_active TINYINT(1) NOT NULL DEFAULT '1',
273 272
 					PRIMARY KEY  (GRP_ID),
274 273
 					KEY MTP_user_id (MTP_user_id)";
275
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
276
-        $table_name = 'esp_event_message_template';
277
-        $sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
274
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
275
+		$table_name = 'esp_event_message_template';
276
+		$sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
278 277
 					EVT_ID BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
279 278
 					GRP_ID INT(10) UNSIGNED NOT NULL DEFAULT 0,
280 279
 					PRIMARY KEY  (EMT_ID),
281 280
 					KEY EVT_ID (EVT_ID),
282 281
 					KEY GRP_ID (GRP_ID)";
283
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
284
-        $table_name = 'esp_payment';
285
-        $sql = "PAY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
282
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
283
+		$table_name = 'esp_payment';
284
+		$sql = "PAY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
286 285
 					TXN_ID INT(10) UNSIGNED DEFAULT NULL,
287 286
 					STS_ID VARCHAR(3) COLLATE utf8_bin DEFAULT NULL,
288 287
 					PAY_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
@@ -299,9 +298,9 @@  discard block
 block discarded – undo
299 298
 					PRIMARY KEY  (PAY_ID),
300 299
 					KEY PAY_timestamp (PAY_timestamp),
301 300
 					KEY TXN_ID (TXN_ID)";
302
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
303
-        $table_name = 'esp_payment_method';
304
-        $sql = "PMD_ID INT(11) NOT NULL AUTO_INCREMENT,
301
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
302
+		$table_name = 'esp_payment_method';
303
+		$sql = "PMD_ID INT(11) NOT NULL AUTO_INCREMENT,
305 304
 				PMD_type VARCHAR(124) DEFAULT NULL,
306 305
 				PMD_name VARCHAR(255) DEFAULT NULL,
307 306
 				PMD_desc TEXT,
@@ -317,32 +316,32 @@  discard block
 block discarded – undo
317 316
 				PRIMARY KEY  (PMD_ID),
318 317
 				UNIQUE KEY PMD_slug_UNIQUE (PMD_slug),
319 318
 				KEY PMD_type (PMD_type)";
320
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
321
-        $table_name = "esp_ticket_price";
322
-        $sql = "TKP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
319
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
320
+		$table_name = "esp_ticket_price";
321
+		$sql = "TKP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
323 322
 					  TKT_ID INT(10) UNSIGNED NOT NULL,
324 323
 					  PRC_ID INT(10) UNSIGNED NOT NULL,
325 324
 					  PRIMARY KEY  (TKP_ID),
326 325
 					  KEY TKT_ID (TKT_ID),
327 326
 					  KEY PRC_ID (PRC_ID)";
328
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
329
-        $table_name = "esp_datetime_ticket";
330
-        $sql = "DTK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
327
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
328
+		$table_name = "esp_datetime_ticket";
329
+		$sql = "DTK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
331 330
 					  DTT_ID INT(10) UNSIGNED NOT NULL,
332 331
 					  TKT_ID INT(10) UNSIGNED NOT NULL,
333 332
 					  PRIMARY KEY  (DTK_ID),
334 333
 					  KEY DTT_ID (DTT_ID),
335 334
 					  KEY TKT_ID (TKT_ID)";
336
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
337
-        $table_name = "esp_ticket_template";
338
-        $sql = "TTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
335
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
336
+		$table_name = "esp_ticket_template";
337
+		$sql = "TTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
339 338
 					  TTM_name VARCHAR(45) NOT NULL,
340 339
 					  TTM_description TEXT,
341 340
 					  TTM_file VARCHAR(45),
342 341
 					  PRIMARY KEY  (TTM_ID)";
343
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
344
-        $table_name = 'esp_question';
345
-        $sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
342
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
343
+		$table_name = 'esp_question';
344
+		$sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
346 345
 					QST_display_text TEXT NOT NULL,
347 346
 					QST_admin_label VARCHAR(255) NOT NULL,
348 347
 					QST_system VARCHAR(25) DEFAULT NULL,
@@ -355,18 +354,18 @@  discard block
 block discarded – undo
355 354
 					QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0,
356 355
 					PRIMARY KEY  (QST_ID),
357 356
 					KEY QST_order (QST_order)';
358
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
359
-        $table_name = 'esp_question_group_question';
360
-        $sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
357
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
358
+		$table_name = 'esp_question_group_question';
359
+		$sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
361 360
 					QSG_ID INT UNSIGNED NOT NULL,
362 361
 					QST_ID INT UNSIGNED NOT NULL,
363 362
 					QGQ_order INT UNSIGNED NOT NULL DEFAULT 0,
364 363
 					PRIMARY KEY  (QGQ_ID),
365 364
 					KEY QST_ID (QST_ID),
366 365
 					KEY QSG_ID_order (QSG_ID, QGQ_order)";
367
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
368
-        $table_name = 'esp_question_option';
369
-        $sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
366
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
367
+		$table_name = 'esp_question_option';
368
+		$sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
370 369
 					QSO_value VARCHAR(255) NOT NULL,
371 370
 					QSO_desc TEXT NOT NULL,
372 371
 					QST_ID INT UNSIGNED NOT NULL,
@@ -375,9 +374,9 @@  discard block
 block discarded – undo
375 374
 					PRIMARY KEY  (QSO_ID),
376 375
 					KEY QST_ID (QST_ID),
377 376
 					KEY QSO_order (QSO_order)";
378
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
379
-        $table_name = 'esp_registration';
380
-        $sql = "REG_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
377
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
378
+		$table_name = 'esp_registration';
379
+		$sql = "REG_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
381 380
 					  EVT_ID BIGINT(20) UNSIGNED NOT NULL,
382 381
 					  ATT_ID BIGINT(20) UNSIGNED NOT NULL,
383 382
 					  TXN_ID INT(10) UNSIGNED NOT NULL,
@@ -401,18 +400,18 @@  discard block
 block discarded – undo
401 400
 					  KEY TKT_ID (TKT_ID),
402 401
 					  KEY EVT_ID (EVT_ID),
403 402
 					  KEY STS_ID (STS_ID)";
404
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
405
-        $table_name = 'esp_registration_payment';
406
-        $sql = "RPY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
403
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
404
+		$table_name = 'esp_registration_payment';
405
+		$sql = "RPY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
407 406
 					  REG_ID INT(10) UNSIGNED NOT NULL,
408 407
 					  PAY_ID INT(10) UNSIGNED NULL,
409 408
 					  RPY_amount DECIMAL(10,3) NOT NULL DEFAULT '0.00',
410 409
 					  PRIMARY KEY  (RPY_ID),
411 410
 					  KEY REG_ID (REG_ID),
412 411
 					  KEY PAY_ID (PAY_ID)";
413
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
414
-        $table_name = 'esp_checkin';
415
-        $sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
412
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
413
+		$table_name = 'esp_checkin';
414
+		$sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
416 415
 					REG_ID INT(10) UNSIGNED NOT NULL,
417 416
 					DTT_ID INT(10) UNSIGNED NOT NULL,
418 417
 					CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
@@ -420,9 +419,9 @@  discard block
 block discarded – undo
420 419
 					PRIMARY KEY  (CHK_ID),
421 420
 					KEY REG_ID (REG_ID),
422 421
 					KEY DTT_ID (DTT_ID)";
423
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
424
-        $table_name = 'esp_state';
425
-        $sql = "STA_ID smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT,
422
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
423
+		$table_name = 'esp_state';
424
+		$sql = "STA_ID smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT,
426 425
 					  CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL,
427 426
 					  STA_abbrev VARCHAR(24) COLLATE utf8_bin NOT NULL,
428 427
 					  STA_name VARCHAR(100) COLLATE utf8_bin NOT NULL,
@@ -430,9 +429,9 @@  discard block
 block discarded – undo
430 429
 					  PRIMARY KEY  (STA_ID),
431 430
 					  KEY STA_abbrev (STA_abbrev),
432 431
 					  KEY CNT_ISO (CNT_ISO)";
433
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
434
-        $table_name = 'esp_status';
435
-        $sql = "STS_ID VARCHAR(3) COLLATE utf8_bin NOT NULL,
432
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
433
+		$table_name = 'esp_status';
434
+		$sql = "STS_ID VARCHAR(3) COLLATE utf8_bin NOT NULL,
436 435
 					  STS_code VARCHAR(45) COLLATE utf8_bin NOT NULL,
437 436
 					  STS_type set('event','registration','transaction','payment','email') COLLATE utf8_bin NOT NULL,
438 437
 					  STS_can_edit TINYINT(1) NOT NULL DEFAULT 0,
@@ -440,9 +439,9 @@  discard block
 block discarded – undo
440 439
 					  STS_open TINYINT(1) NOT NULL DEFAULT 1,
441 440
 					  UNIQUE KEY STS_ID_UNIQUE (STS_ID),
442 441
 					  KEY STS_type (STS_type)";
443
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
444
-        $table_name = 'esp_transaction';
445
-        $sql = "TXN_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
442
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
443
+		$table_name = 'esp_transaction';
444
+		$sql = "TXN_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
446 445
 					  TXN_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
447 446
 					  TXN_total DECIMAL(10,3) DEFAULT '0.00',
448 447
 					  TXN_paid DECIMAL(10,3) NOT NULL DEFAULT '0.00',
@@ -454,9 +453,9 @@  discard block
 block discarded – undo
454 453
 					  PRIMARY KEY  (TXN_ID),
455 454
 					  KEY TXN_timestamp (TXN_timestamp),
456 455
 					  KEY STS_ID (STS_ID)";
457
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
458
-        $table_name = 'esp_venue_meta';
459
-        $sql = "VNUM_ID INT(11) NOT NULL AUTO_INCREMENT,
456
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
457
+		$table_name = 'esp_venue_meta';
458
+		$sql = "VNUM_ID INT(11) NOT NULL AUTO_INCREMENT,
460 459
 			VNU_ID BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
461 460
 			VNU_address VARCHAR(255) DEFAULT NULL,
462 461
 			VNU_address2 VARCHAR(255) DEFAULT NULL,
@@ -475,10 +474,10 @@  discard block
 block discarded – undo
475 474
 			KEY VNU_ID (VNU_ID),
476 475
 			KEY STA_ID (STA_ID),
477 476
 			KEY CNT_ISO (CNT_ISO)";
478
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
479
-        //modified tables
480
-        $table_name = "esp_price";
481
-        $sql = "PRC_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
477
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
478
+		//modified tables
479
+		$table_name = "esp_price";
480
+		$sql = "PRC_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
482 481
 					  PRT_ID TINYINT(3) UNSIGNED NOT NULL,
483 482
 					  PRC_amount DECIMAL(10,3) NOT NULL DEFAULT '0.00',
484 483
 					  PRC_name VARCHAR(245) NOT NULL,
@@ -491,9 +490,9 @@  discard block
 block discarded – undo
491 490
 					  PRC_parent INT(10) UNSIGNED DEFAULT 0,
492 491
 					  PRIMARY KEY  (PRC_ID),
493 492
 					  KEY PRT_ID (PRT_ID)";
494
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
495
-        $table_name = "esp_price_type";
496
-        $sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
493
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
494
+		$table_name = "esp_price_type";
495
+		$sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
497 496
 				  PRT_name VARCHAR(45) NOT NULL,
498 497
 				  PBT_ID TINYINT(3) UNSIGNED NOT NULL DEFAULT '1',
499 498
 				  PRT_is_percent TINYINT(1) NOT NULL DEFAULT '0',
@@ -502,9 +501,9 @@  discard block
 block discarded – undo
502 501
 				  PRT_deleted TINYINT(1) NOT NULL DEFAULT '0',
503 502
 				  UNIQUE KEY PRT_name_UNIQUE (PRT_name),
504 503
 				  PRIMARY KEY  (PRT_ID)";
505
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
506
-        $table_name = "esp_ticket";
507
-        $sql = "TKT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
504
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
505
+		$table_name = "esp_ticket";
506
+		$sql = "TKT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
508 507
 					  TTM_ID INT(10) UNSIGNED NOT NULL,
509 508
 					  TKT_name VARCHAR(245) NOT NULL DEFAULT '',
510 509
 					  TKT_description TEXT NOT NULL,
@@ -526,9 +525,9 @@  discard block
 block discarded – undo
526 525
 					  TKT_deleted TINYINT(1) NOT NULL DEFAULT '0',
527 526
 					  PRIMARY KEY  (TKT_ID),
528 527
 					  KEY TKT_start_date (TKT_start_date)";
529
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
530
-        $table_name = 'esp_question_group';
531
-        $sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
528
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
529
+		$table_name = 'esp_question_group';
530
+		$sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
532 531
 					QSG_name VARCHAR(255) NOT NULL,
533 532
 					QSG_identifier VARCHAR(100) NOT NULL,
534 533
 					QSG_desc TEXT NULL,
@@ -541,38 +540,38 @@  discard block
 block discarded – undo
541 540
 					PRIMARY KEY  (QSG_ID),
542 541
 					UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier),
543 542
 					KEY QSG_order (QSG_order)';
544
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
545
-        /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */
546
-        $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
547
-        //(because many need to convert old string states to foreign keys into the states table)
548
-        $script_4_1_defaults->insert_default_states();
549
-        $script_4_1_defaults->insert_default_countries();
550
-        /** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */
551
-        $script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0');
552
-        $script_4_5_defaults->insert_default_price_types();
553
-        $script_4_5_defaults->insert_default_prices();
554
-        $script_4_5_defaults->insert_default_tickets();
555
-        /** @var EE_DMS_Core_4_6_0 $script_4_6_defaults */
556
-        $script_4_6_defaults = EE_Registry::instance()->load_dms('Core_4_6_0');
557
-        $script_4_6_defaults->add_default_admin_only_payments();
558
-        $script_4_6_defaults->insert_default_currencies();
559
-        return true;
560
-    }
543
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
544
+		/** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */
545
+		$script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
546
+		//(because many need to convert old string states to foreign keys into the states table)
547
+		$script_4_1_defaults->insert_default_states();
548
+		$script_4_1_defaults->insert_default_countries();
549
+		/** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */
550
+		$script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0');
551
+		$script_4_5_defaults->insert_default_price_types();
552
+		$script_4_5_defaults->insert_default_prices();
553
+		$script_4_5_defaults->insert_default_tickets();
554
+		/** @var EE_DMS_Core_4_6_0 $script_4_6_defaults */
555
+		$script_4_6_defaults = EE_Registry::instance()->load_dms('Core_4_6_0');
556
+		$script_4_6_defaults->add_default_admin_only_payments();
557
+		$script_4_6_defaults->insert_default_currencies();
558
+		return true;
559
+	}
561 560
 
562 561
 
563 562
 
564
-    /**
565
-     * @return boolean
566
-     */
567
-    public function schema_changes_after_migration()
568
-    {
569
-        return true;
570
-    }
563
+	/**
564
+	 * @return boolean
565
+	 */
566
+	public function schema_changes_after_migration()
567
+	{
568
+		return true;
569
+	}
571 570
 
572 571
 
573 572
 
574
-    public function migration_page_hooks()
575
-    {
576
-    }
573
+	public function migration_page_hooks()
574
+	{
575
+	}
577 576
 }
578 577
 // end of file: /core/data_migration_scripts/EE_DMS_Core_4_7_0.dms.php
579 578
\ No newline at end of file
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_DMS_Core_4_9_0.dms.php 1 patch
Indentation   +183 added lines, -183 removed lines patch added patch discarded remove patch
@@ -12,9 +12,9 @@  discard block
 block discarded – undo
12 12
 $stages = glob(EE_CORE . 'data_migration_scripts/4_9_0_stages/*');
13 13
 $class_to_filepath = array();
14 14
 foreach ($stages as $filepath) {
15
-    $matches = array();
16
-    preg_match('~4_9_0_stages/(.*).dmsstage.php~', $filepath, $matches);
17
-    $class_to_filepath[$matches[1]] = $filepath;
15
+	$matches = array();
16
+	preg_match('~4_9_0_stages/(.*).dmsstage.php~', $filepath, $matches);
17
+	$class_to_filepath[$matches[1]] = $filepath;
18 18
 }
19 19
 //give addons a chance to autoload their stages too
20 20
 $class_to_filepath = apply_filters('FHEE__EE_DMS_4_9_0__autoloaded_stages', $class_to_filepath);
@@ -33,67 +33,67 @@  discard block
 block discarded – undo
33 33
 class EE_DMS_Core_4_9_0 extends EE_Data_Migration_Script_Base
34 34
 {
35 35
 
36
-    /**
37
-     * return EE_DMS_Core_4_9_0
38
-     *
39
-     * @param TableManager  $table_manager
40
-     * @param TableAnalysis $table_analysis
41
-     */
42
-    public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null)
43
-    {
44
-        $this->_pretty_name = esc_html__("Data Update to Event Espresso 4.9.0", "event_espresso");
45
-        $this->_priority = 10;
46
-        $this->_migration_stages = array(
47
-            new EE_DMS_4_9_0_Email_System_Question(),
48
-            new EE_DMS_4_9_0_Answers_With_No_Registration(),
49
-        );
50
-        parent::__construct($table_manager, $table_analysis);
51
-    }
36
+	/**
37
+	 * return EE_DMS_Core_4_9_0
38
+	 *
39
+	 * @param TableManager  $table_manager
40
+	 * @param TableAnalysis $table_analysis
41
+	 */
42
+	public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null)
43
+	{
44
+		$this->_pretty_name = esc_html__("Data Update to Event Espresso 4.9.0", "event_espresso");
45
+		$this->_priority = 10;
46
+		$this->_migration_stages = array(
47
+			new EE_DMS_4_9_0_Email_System_Question(),
48
+			new EE_DMS_4_9_0_Answers_With_No_Registration(),
49
+		);
50
+		parent::__construct($table_manager, $table_analysis);
51
+	}
52 52
 
53 53
 
54 54
 
55
-    /**
56
-     * Whether to migrate or not.
57
-     *
58
-     * @param array $version_array
59
-     * @return bool
60
-     */
61
-    public function can_migrate_from_version($version_array)
62
-    {
63
-        $version_string = $version_array['Core'];
64
-        if (version_compare($version_string, '4.9.0', '<=') && version_compare($version_string, '4.8.0', '>=')) {
55
+	/**
56
+	 * Whether to migrate or not.
57
+	 *
58
+	 * @param array $version_array
59
+	 * @return bool
60
+	 */
61
+	public function can_migrate_from_version($version_array)
62
+	{
63
+		$version_string = $version_array['Core'];
64
+		if (version_compare($version_string, '4.9.0', '<=') && version_compare($version_string, '4.8.0', '>=')) {
65 65
 //			echo "$version_string can be migrated from";
66
-            return true;
67
-        } elseif ( ! $version_string) {
66
+			return true;
67
+		} elseif ( ! $version_string) {
68 68
 //			echo "no version string provided: $version_string";
69
-            //no version string provided... this must be pre 4.3
70
-            return false;//changed mind. dont want people thinking they should migrate yet because they cant
71
-        } else {
69
+			//no version string provided... this must be pre 4.3
70
+			return false;//changed mind. dont want people thinking they should migrate yet because they cant
71
+		} else {
72 72
 //			echo "$version_string doesnt apply";
73
-            return false;
74
-        }
75
-    }
73
+			return false;
74
+		}
75
+	}
76 76
 
77 77
 
78 78
 
79
-    /**
80
-     * @return bool
81
-     */
82
-    public function schema_changes_before_migration()
83
-    {
84
-        require_once(EE_HELPERS . 'EEH_Activation.helper.php');
85
-        $now_in_mysql = current_time('mysql', true);
86
-        $table_name = 'esp_answer';
87
-        $sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
79
+	/**
80
+	 * @return bool
81
+	 */
82
+	public function schema_changes_before_migration()
83
+	{
84
+		require_once(EE_HELPERS . 'EEH_Activation.helper.php');
85
+		$now_in_mysql = current_time('mysql', true);
86
+		$table_name = 'esp_answer';
87
+		$sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
88 88
 					REG_ID int(10) unsigned NOT NULL,
89 89
 					QST_ID int(10) unsigned NOT NULL,
90 90
 					ANS_value text NOT NULL,
91 91
 					PRIMARY KEY  (ANS_ID),
92 92
 					KEY REG_ID (REG_ID),
93 93
 					KEY QST_ID (QST_ID)";
94
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
95
-        $table_name = 'esp_attendee_meta';
96
-        $sql = "ATTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
94
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
95
+		$table_name = 'esp_attendee_meta';
96
+		$sql = "ATTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
97 97
 				ATT_ID bigint(20) unsigned NOT NULL,
98 98
 				ATT_fname varchar(45) NOT NULL,
99 99
 				ATT_lname varchar(45) NOT	NULL,
@@ -110,9 +110,9 @@  discard block
 block discarded – undo
110 110
 				KEY ATT_email (ATT_email),
111 111
 				KEY ATT_lname (ATT_lname),
112 112
 				KEY ATT_fname (ATT_fname)";
113
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
114
-        $table_name = 'esp_checkin';
115
-        $sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
113
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
114
+		$table_name = 'esp_checkin';
115
+		$sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
116 116
 				REG_ID int(10) unsigned NOT NULL,
117 117
 				DTT_ID int(10) unsigned NOT NULL,
118 118
 				CHK_in tinyint(1) unsigned NOT NULL DEFAULT 1,
@@ -120,9 +120,9 @@  discard block
 block discarded – undo
120 120
 				PRIMARY KEY  (CHK_ID),
121 121
 				KEY REG_ID (REG_ID),
122 122
 				KEY DTT_ID (DTT_ID)";
123
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
124
-        $table_name = 'esp_country';
125
-        $sql = "CNT_ISO varchar(2) collate utf8_bin NOT NULL,
123
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
124
+		$table_name = 'esp_country';
125
+		$sql = "CNT_ISO varchar(2) collate utf8_bin NOT NULL,
126 126
 				CNT_ISO3 varchar(3) collate utf8_bin NOT NULL,
127 127
 				RGN_ID tinyint(3) unsigned DEFAULT NULL,
128 128
 				CNT_name varchar(45) collate utf8_bin NOT NULL,
@@ -138,25 +138,25 @@  discard block
 block discarded – undo
138 138
 				CNT_is_EU tinyint(1) DEFAULT '0',
139 139
 				CNT_active tinyint(1) DEFAULT '0',
140 140
 				PRIMARY KEY  (CNT_ISO)";
141
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
142
-        $table_name = 'esp_currency';
143
-        $sql = "CUR_code varchar(6) collate utf8_bin NOT NULL,
141
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
142
+		$table_name = 'esp_currency';
143
+		$sql = "CUR_code varchar(6) collate utf8_bin NOT NULL,
144 144
 				CUR_single varchar(45) collate utf8_bin DEFAULT 'dollar',
145 145
 				CUR_plural varchar(45) collate utf8_bin DEFAULT 'dollars',
146 146
 				CUR_sign varchar(45) collate utf8_bin DEFAULT '$',
147 147
 				CUR_dec_plc varchar(1) collate utf8_bin NOT NULL DEFAULT '2',
148 148
 				CUR_active tinyint(1) DEFAULT '0',
149 149
 				PRIMARY KEY  (CUR_code)";
150
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
151
-        $table_name = 'esp_currency_payment_method';
152
-        $sql = "CPM_ID int(11) NOT NULL AUTO_INCREMENT,
150
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
151
+		$table_name = 'esp_currency_payment_method';
152
+		$sql = "CPM_ID int(11) NOT NULL AUTO_INCREMENT,
153 153
 				CUR_code varchar(6) collate utf8_bin NOT NULL,
154 154
 				PMD_ID int(11) NOT NULL,
155 155
 				PRIMARY KEY  (CPM_ID),
156 156
 				KEY PMD_ID (PMD_ID)";
157
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
158
-        $table_name = 'esp_datetime';
159
-        $sql = "DTT_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
157
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
158
+		$table_name = 'esp_datetime';
159
+		$sql = "DTT_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
160 160
 				EVT_ID bigint(20) unsigned NOT NULL,
161 161
 				DTT_name varchar(255) NOT NULL DEFAULT '',
162 162
 				DTT_description text NOT NULL,
@@ -172,25 +172,25 @@  discard block
 block discarded – undo
172 172
 				KEY DTT_EVT_start (DTT_EVT_start),
173 173
 				KEY EVT_ID (EVT_ID),
174 174
 				KEY DTT_is_primary (DTT_is_primary)";
175
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
176
-        $table_name = "esp_datetime_ticket";
177
-        $sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
175
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
176
+		$table_name = "esp_datetime_ticket";
177
+		$sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
178 178
 				DTT_ID int(10) unsigned NOT NULL,
179 179
 				TKT_ID int(10) unsigned NOT NULL,
180 180
 				PRIMARY KEY  (DTK_ID),
181 181
 				KEY DTT_ID (DTT_ID),
182 182
 				KEY TKT_ID (TKT_ID)";
183
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
184
-        $table_name = 'esp_event_message_template';
185
-        $sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT,
183
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
184
+		$table_name = 'esp_event_message_template';
185
+		$sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT,
186 186
 				EVT_ID bigint(20) unsigned NOT NULL DEFAULT 0,
187 187
 				GRP_ID int(10) unsigned NOT NULL DEFAULT 0,
188 188
 				PRIMARY KEY  (EMT_ID),
189 189
 				KEY EVT_ID (EVT_ID),
190 190
 				KEY GRP_ID (GRP_ID)";
191
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
192
-        $table_name = 'esp_event_meta';
193
-        $sql = "EVTM_ID int(10) NOT NULL AUTO_INCREMENT,
191
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
192
+		$table_name = 'esp_event_meta';
193
+		$sql = "EVTM_ID int(10) NOT NULL AUTO_INCREMENT,
194 194
 				EVT_ID bigint(20) unsigned NOT NULL,
195 195
 				EVT_display_desc tinyint(1) unsigned NOT NULL DEFAULT 1,
196 196
 				EVT_display_ticket_selector tinyint(1) unsigned NOT NULL DEFAULT 1,
@@ -205,34 +205,34 @@  discard block
 block discarded – undo
205 205
 				EVT_donations tinyint(1) NULL,
206 206
 				PRIMARY KEY  (EVTM_ID),
207 207
 				KEY EVT_ID (EVT_ID)";
208
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
209
-        $table_name = 'esp_event_question_group';
210
-        $sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
208
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
209
+		$table_name = 'esp_event_question_group';
210
+		$sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
211 211
 				EVT_ID bigint(20) unsigned NOT NULL,
212 212
 				QSG_ID int(10) unsigned NOT NULL,
213 213
 				EQG_primary tinyint(1) unsigned NOT NULL DEFAULT 0,
214 214
 				PRIMARY KEY  (EQG_ID),
215 215
 				KEY EVT_ID (EVT_ID),
216 216
 				KEY QSG_ID (QSG_ID)";
217
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
218
-        $table_name = 'esp_event_venue';
219
-        $sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT,
217
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
218
+		$table_name = 'esp_event_venue';
219
+		$sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT,
220 220
 				EVT_ID bigint(20) unsigned NOT NULL,
221 221
 				VNU_ID bigint(20) unsigned NOT NULL,
222 222
 				EVV_primary tinyint(1) unsigned NOT NULL DEFAULT 0,
223 223
 				PRIMARY KEY  (EVV_ID)";
224
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
225
-        $table_name = 'esp_extra_meta';
226
-        $sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT,
224
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
225
+		$table_name = 'esp_extra_meta';
226
+		$sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT,
227 227
 				OBJ_ID int(11) DEFAULT NULL,
228 228
 				EXM_type varchar(45) DEFAULT NULL,
229 229
 				EXM_key varchar(45) DEFAULT NULL,
230 230
 				EXM_value text,
231 231
 				PRIMARY KEY  (EXM_ID),
232 232
 				KEY EXM_type (EXM_type,OBJ_ID,EXM_key)";
233
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
234
-        $table_name = 'esp_extra_join';
235
-        $sql = "EXJ_ID int(11) NOT NULL AUTO_INCREMENT,
233
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
234
+		$table_name = 'esp_extra_join';
235
+		$sql = "EXJ_ID int(11) NOT NULL AUTO_INCREMENT,
236 236
 				EXJ_first_model_id varchar(6) NOT NULL,
237 237
 				EXJ_first_model_name varchar(20) NOT NULL,
238 238
 				EXJ_second_model_id varchar(6) NOT NULL,
@@ -240,9 +240,9 @@  discard block
 block discarded – undo
240 240
 				PRIMARY KEY  (EXJ_ID),
241 241
 				KEY first_model (EXJ_first_model_name,EXJ_first_model_id),
242 242
 				KEY second_model (EXJ_second_model_name,EXJ_second_model_id)";
243
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
244
-        $table_name = 'esp_line_item';
245
-        $sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT,
243
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
244
+		$table_name = 'esp_line_item';
245
+		$sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT,
246 246
 				LIN_code varchar(245) NOT NULL DEFAULT '',
247 247
 				TXN_ID int(11) DEFAULT NULL,
248 248
 				LIN_name varchar(245) NOT NULL DEFAULT '',
@@ -261,9 +261,9 @@  discard block
 block discarded – undo
261 261
 				PRIMARY KEY  (LIN_ID),
262 262
 				KEY LIN_code (LIN_code(191)),
263 263
 				KEY TXN_ID (TXN_ID)";
264
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
265
-        $table_name = 'esp_log';
266
-        $sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT,
264
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
265
+		$table_name = 'esp_log';
266
+		$sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT,
267 267
 				LOG_time datetime DEFAULT NULL,
268 268
 				OBJ_ID varchar(45) DEFAULT NULL,
269 269
 				OBJ_type varchar(45) DEFAULT NULL,
@@ -274,9 +274,9 @@  discard block
 block discarded – undo
274 274
 				KEY LOG_time (LOG_time),
275 275
 				KEY OBJ (OBJ_type,OBJ_ID),
276 276
 				KEY LOG_type (LOG_type)";
277
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
278
-        $table_name = 'esp_message';
279
-        $sql = "MSG_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT,
277
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
278
+		$table_name = 'esp_message';
279
+		$sql = "MSG_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT,
280 280
 				GRP_ID int(10) unsigned NULL,
281 281
 				MSG_token varchar(255) NULL,
282 282
 				TXN_ID int(10) unsigned NULL,
@@ -308,18 +308,18 @@  discard block
 block discarded – undo
308 308
 				KEY STS_ID (STS_ID),
309 309
 				KEY MSG_created (MSG_created),
310 310
 				KEY MSG_modified (MSG_modified)";
311
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
312
-        $table_name = 'esp_message_template';
313
-        $sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
311
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
312
+		$table_name = 'esp_message_template';
313
+		$sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
314 314
 				GRP_ID int(10) unsigned NOT NULL,
315 315
 				MTP_context varchar(50) NOT NULL,
316 316
 				MTP_template_field varchar(30) NOT NULL,
317 317
 				MTP_content text NOT NULL,
318 318
 				PRIMARY KEY  (MTP_ID),
319 319
 				KEY GRP_ID (GRP_ID)";
320
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
321
-        $table_name = 'esp_message_template_group';
322
-        $sql = "GRP_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
320
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
321
+		$table_name = 'esp_message_template_group';
322
+		$sql = "GRP_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
323 323
 				MTP_user_id int(10) NOT NULL DEFAULT '1',
324 324
 				MTP_name varchar(245) NOT NULL DEFAULT '',
325 325
 				MTP_description varchar(245) NOT NULL DEFAULT '',
@@ -331,9 +331,9 @@  discard block
 block discarded – undo
331 331
 				MTP_is_active tinyint(1) NOT NULL DEFAULT '1',
332 332
 				PRIMARY KEY  (GRP_ID),
333 333
 				KEY MTP_user_id (MTP_user_id)";
334
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
335
-        $table_name = 'esp_payment';
336
-        $sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
334
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
335
+		$table_name = 'esp_payment';
336
+		$sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
337 337
 				TXN_ID int(10) unsigned DEFAULT NULL,
338 338
 				STS_ID varchar(3) collate utf8_bin DEFAULT NULL,
339 339
 				PAY_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
@@ -350,9 +350,9 @@  discard block
 block discarded – undo
350 350
 				PRIMARY KEY  (PAY_ID),
351 351
 				KEY PAY_timestamp (PAY_timestamp),
352 352
 				KEY TXN_ID (TXN_ID)";
353
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
354
-        $table_name = 'esp_payment_method';
355
-        $sql = "PMD_ID int(11) NOT NULL AUTO_INCREMENT,
353
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
354
+		$table_name = 'esp_payment_method';
355
+		$sql = "PMD_ID int(11) NOT NULL AUTO_INCREMENT,
356 356
 				PMD_type varchar(124) DEFAULT NULL,
357 357
 				PMD_name varchar(255) DEFAULT NULL,
358 358
 				PMD_desc text,
@@ -368,24 +368,24 @@  discard block
 block discarded – undo
368 368
 				PRIMARY KEY  (PMD_ID),
369 369
 				UNIQUE KEY PMD_slug_UNIQUE (PMD_slug),
370 370
 				KEY PMD_type (PMD_type)";
371
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
372
-        $table_name = "esp_ticket_price";
373
-        $sql = "TKP_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
371
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
372
+		$table_name = "esp_ticket_price";
373
+		$sql = "TKP_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
374 374
 				TKT_ID int(10) unsigned NOT NULL,
375 375
 				PRC_ID int(10) unsigned NOT NULL,
376 376
 				PRIMARY KEY  (TKP_ID),
377 377
 				KEY TKT_ID (TKT_ID),
378 378
 				KEY PRC_ID (PRC_ID)";
379
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
380
-        $table_name = "esp_ticket_template";
381
-        $sql = "TTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
379
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
380
+		$table_name = "esp_ticket_template";
381
+		$sql = "TTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
382 382
 				TTM_name varchar(45) NOT NULL,
383 383
 				TTM_description text,
384 384
 				TTM_file varchar(45),
385 385
 				PRIMARY KEY  (TTM_ID)";
386
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
387
-        $table_name = 'esp_question';
388
-        $sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
386
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
387
+		$table_name = 'esp_question';
388
+		$sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
389 389
 				QST_display_text text NOT NULL,
390 390
 				QST_admin_label varchar(255) NOT NULL,
391 391
 				QST_system varchar(25) DEFAULT NULL,
@@ -399,18 +399,18 @@  discard block
 block discarded – undo
399 399
 				QST_deleted tinyint(2) unsigned NOT NULL DEFAULT 0,
400 400
 				PRIMARY KEY  (QST_ID),
401 401
 				KEY QST_order (QST_order)';
402
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
403
-        $table_name = 'esp_question_group_question';
404
-        $sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
402
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
403
+		$table_name = 'esp_question_group_question';
404
+		$sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
405 405
 				QSG_ID int(10) unsigned NOT NULL,
406 406
 				QST_ID int(10) unsigned NOT NULL,
407 407
 				QGQ_order int(10) unsigned NOT NULL DEFAULT 0,
408 408
 				PRIMARY KEY  (QGQ_ID),
409 409
 				KEY QST_ID (QST_ID),
410 410
 				KEY QSG_ID_order (QSG_ID,QGQ_order)";
411
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
412
-        $table_name = 'esp_question_option';
413
-        $sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
411
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
412
+		$table_name = 'esp_question_option';
413
+		$sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
414 414
 				QSO_value varchar(255) NOT NULL,
415 415
 				QSO_desc text NOT NULL,
416 416
 				QST_ID int(10) unsigned NOT NULL,
@@ -420,9 +420,9 @@  discard block
 block discarded – undo
420 420
 				PRIMARY KEY  (QSO_ID),
421 421
 				KEY QST_ID (QST_ID),
422 422
 				KEY QSO_order (QSO_order)";
423
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
424
-        $table_name = 'esp_registration';
425
-        $sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
423
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
424
+		$table_name = 'esp_registration';
425
+		$sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
426 426
 				EVT_ID bigint(20) unsigned NOT NULL,
427 427
 				ATT_ID bigint(20) unsigned NOT NULL,
428 428
 				TXN_ID int(10) unsigned NOT NULL,
@@ -446,18 +446,18 @@  discard block
 block discarded – undo
446 446
 				KEY TKT_ID (TKT_ID),
447 447
 				KEY EVT_ID (EVT_ID),
448 448
 				KEY STS_ID (STS_ID)";
449
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
450
-        $table_name = 'esp_registration_payment';
451
-        $sql = "RPY_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
449
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
450
+		$table_name = 'esp_registration_payment';
451
+		$sql = "RPY_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
452 452
 					  REG_ID int(10) unsigned NOT NULL,
453 453
 					  PAY_ID int(10) unsigned NULL,
454 454
 					  RPY_amount decimal(10,3) NOT NULL DEFAULT '0.00',
455 455
 					  PRIMARY KEY  (RPY_ID),
456 456
 					  KEY REG_ID (REG_ID),
457 457
 					  KEY PAY_ID (PAY_ID)";
458
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
459
-        $table_name = 'esp_state';
460
-        $sql = "STA_ID smallint(5) unsigned NOT NULL AUTO_INCREMENT,
458
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
459
+		$table_name = 'esp_state';
460
+		$sql = "STA_ID smallint(5) unsigned NOT NULL AUTO_INCREMENT,
461 461
 				CNT_ISO varchar(2) collate utf8_bin NOT NULL,
462 462
 				STA_abbrev varchar(24) collate utf8_bin NOT NULL,
463 463
 				STA_name varchar(100) collate utf8_bin NOT NULL,
@@ -465,9 +465,9 @@  discard block
 block discarded – undo
465 465
 				PRIMARY KEY  (STA_ID),
466 466
 				KEY STA_abbrev (STA_abbrev),
467 467
 				KEY CNT_ISO (CNT_ISO)";
468
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
469
-        $table_name = 'esp_status';
470
-        $sql = "STS_ID varchar(3) NOT NULL,
468
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
469
+		$table_name = 'esp_status';
470
+		$sql = "STS_ID varchar(3) NOT NULL,
471 471
 				STS_code varchar(45) NOT NULL,
472 472
 				STS_type varchar(45) NOT NULL,
473 473
 				STS_can_edit tinyint(1) NOT NULL DEFAULT 0,
@@ -475,9 +475,9 @@  discard block
 block discarded – undo
475 475
 				STS_open tinyint(1) NOT NULL DEFAULT 1,
476 476
 				UNIQUE KEY STS_ID_UNIQUE (STS_ID),
477 477
 				KEY STS_type (STS_type)";
478
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
479
-        $table_name = 'esp_transaction';
480
-        $sql = "TXN_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
478
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
479
+		$table_name = 'esp_transaction';
480
+		$sql = "TXN_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
481 481
 				TXN_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
482 482
 				TXN_total decimal(10,3) DEFAULT '0.00',
483 483
 				TXN_paid decimal(10,3) NOT NULL DEFAULT '0.00',
@@ -489,9 +489,9 @@  discard block
 block discarded – undo
489 489
 				PRIMARY KEY  (TXN_ID),
490 490
 				KEY TXN_timestamp (TXN_timestamp),
491 491
 				KEY STS_ID (STS_ID)";
492
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
493
-        $table_name = 'esp_venue_meta';
494
-        $sql = "VNUM_ID int(11) NOT NULL AUTO_INCREMENT,
492
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
493
+		$table_name = 'esp_venue_meta';
494
+		$sql = "VNUM_ID int(11) NOT NULL AUTO_INCREMENT,
495 495
 			VNU_ID bigint(20) unsigned NOT NULL DEFAULT 0,
496 496
 			VNU_address varchar(255) DEFAULT NULL,
497 497
 			VNU_address2 varchar(255) DEFAULT NULL,
@@ -510,10 +510,10 @@  discard block
 block discarded – undo
510 510
 			KEY VNU_ID (VNU_ID),
511 511
 			KEY STA_ID (STA_ID),
512 512
 			KEY CNT_ISO (CNT_ISO)";
513
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
514
-        //modified tables
515
-        $table_name = "esp_price";
516
-        $sql = "PRC_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
513
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
514
+		//modified tables
515
+		$table_name = "esp_price";
516
+		$sql = "PRC_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
517 517
 				PRT_ID tinyint(3) unsigned NOT NULL,
518 518
 				PRC_amount decimal(10,3) NOT NULL DEFAULT '0.00',
519 519
 				PRC_name varchar(245) NOT NULL,
@@ -526,9 +526,9 @@  discard block
 block discarded – undo
526 526
 				PRC_parent int(10) unsigned DEFAULT 0,
527 527
 				PRIMARY KEY  (PRC_ID),
528 528
 				KEY PRT_ID (PRT_ID)";
529
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
530
-        $table_name = "esp_price_type";
531
-        $sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
529
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
530
+		$table_name = "esp_price_type";
531
+		$sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
532 532
 				PRT_name varchar(45) NOT NULL,
533 533
 				PBT_ID tinyint(3) unsigned NOT NULL DEFAULT '1',
534 534
 				PRT_is_percent tinyint(1) NOT NULL DEFAULT '0',
@@ -537,9 +537,9 @@  discard block
 block discarded – undo
537 537
 				PRT_deleted tinyint(1) NOT NULL DEFAULT '0',
538 538
 				UNIQUE KEY PRT_name_UNIQUE (PRT_name),
539 539
 				PRIMARY KEY  (PRT_ID)";
540
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
541
-        $table_name = "esp_ticket";
542
-        $sql = "TKT_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
540
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
541
+		$table_name = "esp_ticket";
542
+		$sql = "TKT_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
543 543
 				TTM_ID int(10) unsigned NOT NULL,
544 544
 				TKT_name varchar(245) NOT NULL DEFAULT '',
545 545
 				TKT_description text NOT NULL,
@@ -561,9 +561,9 @@  discard block
 block discarded – undo
561 561
 				TKT_deleted tinyint(1) NOT NULL DEFAULT '0',
562 562
 				PRIMARY KEY  (TKT_ID),
563 563
 				KEY TKT_start_date (TKT_start_date)";
564
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
565
-        $table_name = 'esp_question_group';
566
-        $sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
564
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
565
+		$table_name = 'esp_question_group';
566
+		$sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
567 567
 				QSG_name varchar(255) NOT NULL,
568 568
 				QSG_identifier varchar(100) NOT NULL,
569 569
 				QSG_desc text NULL,
@@ -576,41 +576,41 @@  discard block
 block discarded – undo
576 576
 				PRIMARY KEY  (QSG_ID),
577 577
 				UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier),
578 578
 				KEY QSG_order (QSG_order)';
579
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
580
-        /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */
581
-        $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
582
-        //(because many need to convert old string states to foreign keys into the states table)
583
-        $script_4_1_defaults->insert_default_states();
584
-        $script_4_1_defaults->insert_default_countries();
585
-        /** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */
586
-        $script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0');
587
-        $script_4_5_defaults->insert_default_price_types();
588
-        $script_4_5_defaults->insert_default_prices();
589
-        $script_4_5_defaults->insert_default_tickets();
590
-        /** @var EE_DMS_Core_4_6_0 $script_4_6_defaults */
591
-        $script_4_6_defaults = EE_Registry::instance()->load_dms('Core_4_6_0');
592
-        $script_4_6_defaults->add_default_admin_only_payments();
593
-        $script_4_6_defaults->insert_default_currencies();
594
-        /** @var EE_DMS_Core_4_8_0 $script_4_8_defaults */
595
-        $script_4_8_defaults = EE_Registry::instance()->load_dms('Core_4_8_0');
596
-        $script_4_8_defaults->verify_new_countries();
597
-        $script_4_8_defaults->verify_new_currencies();
598
-        return true;
599
-    }
579
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
580
+		/** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */
581
+		$script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
582
+		//(because many need to convert old string states to foreign keys into the states table)
583
+		$script_4_1_defaults->insert_default_states();
584
+		$script_4_1_defaults->insert_default_countries();
585
+		/** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */
586
+		$script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0');
587
+		$script_4_5_defaults->insert_default_price_types();
588
+		$script_4_5_defaults->insert_default_prices();
589
+		$script_4_5_defaults->insert_default_tickets();
590
+		/** @var EE_DMS_Core_4_6_0 $script_4_6_defaults */
591
+		$script_4_6_defaults = EE_Registry::instance()->load_dms('Core_4_6_0');
592
+		$script_4_6_defaults->add_default_admin_only_payments();
593
+		$script_4_6_defaults->insert_default_currencies();
594
+		/** @var EE_DMS_Core_4_8_0 $script_4_8_defaults */
595
+		$script_4_8_defaults = EE_Registry::instance()->load_dms('Core_4_8_0');
596
+		$script_4_8_defaults->verify_new_countries();
597
+		$script_4_8_defaults->verify_new_currencies();
598
+		return true;
599
+	}
600 600
 
601 601
 
602 602
 
603
-    /**
604
-     * @return boolean
605
-     */
606
-    public function schema_changes_after_migration()
607
-    {
608
-        return true;
609
-    }
603
+	/**
604
+	 * @return boolean
605
+	 */
606
+	public function schema_changes_after_migration()
607
+	{
608
+		return true;
609
+	}
610 610
 
611 611
 
612 612
 
613
-    public function migration_page_hooks()
614
-    {
615
-    }
613
+	public function migration_page_hooks()
614
+	{
615
+	}
616 616
 }
617 617
\ No newline at end of file
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_DMS_Core_4_6_0.dms.php 1 patch
Indentation   +270 added lines, -270 removed lines patch added patch discarded remove patch
@@ -14,9 +14,9 @@  discard block
 block discarded – undo
14 14
 $stages = glob(EE_CORE . 'data_migration_scripts/4_6_0_stages/*');
15 15
 $class_to_filepath = array();
16 16
 foreach ($stages as $filepath) {
17
-    $matches = array();
18
-    preg_match('~4_6_0_stages/(.*).dmsstage.php~', $filepath, $matches);
19
-    $class_to_filepath[$matches[1]] = $filepath;
17
+	$matches = array();
18
+	preg_match('~4_6_0_stages/(.*).dmsstage.php~', $filepath, $matches);
19
+	$class_to_filepath[$matches[1]] = $filepath;
20 20
 }
21 21
 //give addons a chance to autoload their stages too
22 22
 $class_to_filepath = apply_filters('FHEE__EE_DMS_4_6_0__autoloaded_stages', $class_to_filepath);
@@ -35,70 +35,70 @@  discard block
 block discarded – undo
35 35
 class EE_DMS_Core_4_6_0 extends EE_Data_Migration_Script_Base
36 36
 {
37 37
 
38
-    /**
39
-     * return EE_DMS_Core_4_6_0
40
-     *
41
-     * @param TableManager  $table_manager
42
-     * @param TableAnalysis $table_analysis
43
-     */
44
-    public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null)
45
-    {
46
-        $this->_pretty_name = __("Data Update to Event Espresso 4.6.0", "event_espresso");
47
-        $this->_priority = 10;
48
-        $this->_migration_stages = array(
49
-            new EE_DMS_4_6_0_gateways(),
50
-            new EE_DMS_4_6_0_payment_method_currencies(),
51
-            new EE_DMS_4_6_0_question_types(),
52
-            new EE_DMS_4_6_0_country_system_question(),
53
-            new EE_DMS_4_6_0_state_system_question(),
54
-            new EE_DMS_4_6_0_billing_info(),
55
-            new EE_DMS_4_6_0_transactions(),
56
-            new EE_DMS_4_6_0_payments(),
57
-            new EE_DMS_4_6_0_invoice_settings(),
58
-        );
59
-        parent::__construct($table_manager, $table_analysis);
60
-    }
61
-
62
-
63
-
64
-    /**
65
-     * @param array $version_array
66
-     * @return bool
67
-     */
68
-    public function can_migrate_from_version($version_array)
69
-    {
70
-        $version_string = $version_array['Core'];
71
-        if (version_compare($version_string, '4.6.0', '<=') && version_compare($version_string, '4.5.0', '>=')) {
38
+	/**
39
+	 * return EE_DMS_Core_4_6_0
40
+	 *
41
+	 * @param TableManager  $table_manager
42
+	 * @param TableAnalysis $table_analysis
43
+	 */
44
+	public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null)
45
+	{
46
+		$this->_pretty_name = __("Data Update to Event Espresso 4.6.0", "event_espresso");
47
+		$this->_priority = 10;
48
+		$this->_migration_stages = array(
49
+			new EE_DMS_4_6_0_gateways(),
50
+			new EE_DMS_4_6_0_payment_method_currencies(),
51
+			new EE_DMS_4_6_0_question_types(),
52
+			new EE_DMS_4_6_0_country_system_question(),
53
+			new EE_DMS_4_6_0_state_system_question(),
54
+			new EE_DMS_4_6_0_billing_info(),
55
+			new EE_DMS_4_6_0_transactions(),
56
+			new EE_DMS_4_6_0_payments(),
57
+			new EE_DMS_4_6_0_invoice_settings(),
58
+		);
59
+		parent::__construct($table_manager, $table_analysis);
60
+	}
61
+
62
+
63
+
64
+	/**
65
+	 * @param array $version_array
66
+	 * @return bool
67
+	 */
68
+	public function can_migrate_from_version($version_array)
69
+	{
70
+		$version_string = $version_array['Core'];
71
+		if (version_compare($version_string, '4.6.0', '<=') && version_compare($version_string, '4.5.0', '>=')) {
72 72
 //			echo "$version_string can be migrated from";
73
-            return true;
74
-        } elseif ( ! $version_string) {
73
+			return true;
74
+		} elseif ( ! $version_string) {
75 75
 //			echo "no version string provided: $version_string";
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 {
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 {
79 79
 //			echo "$version_string doesnt apply";
80
-            return false;
81
-        }
82
-    }
80
+			return false;
81
+		}
82
+	}
83 83
 
84 84
 
85 85
 
86
-    /**
87
-     * @return bool
88
-     */
89
-    public function schema_changes_before_migration()
90
-    {
91
-        //relies on 4.1's EEH_Activation::create_table
92
-        require_once(EE_HELPERS . 'EEH_Activation.helper.php');
93
-        $table_name = 'esp_answer';
94
-        $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
86
+	/**
87
+	 * @return bool
88
+	 */
89
+	public function schema_changes_before_migration()
90
+	{
91
+		//relies on 4.1's EEH_Activation::create_table
92
+		require_once(EE_HELPERS . 'EEH_Activation.helper.php');
93
+		$table_name = 'esp_answer';
94
+		$sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
95 95
 					REG_ID INT UNSIGNED NOT NULL,
96 96
 					QST_ID INT UNSIGNED NOT NULL,
97 97
 					ANS_value TEXT NOT NULL,
98 98
 					PRIMARY KEY  (ANS_ID)";
99
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
100
-        $table_name = 'esp_attendee_meta';
101
-        $sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
99
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
100
+		$table_name = 'esp_attendee_meta';
101
+		$sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
102 102
 						ATT_ID BIGINT(20) UNSIGNED NOT NULL,
103 103
 						ATT_fname VARCHAR(45) NOT NULL,
104 104
 						ATT_lname VARCHAR(45) NOT	NULL,
@@ -114,9 +114,9 @@  discard block
 block discarded – undo
114 114
 								KEY ATT_fname (ATT_fname),
115 115
 								KEY ATT_lname (ATT_lname),
116 116
 								KEY ATT_email (ATT_email)";
117
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
118
-        $table_name = 'esp_country';
119
-        $sql = "CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL,
117
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
118
+		$table_name = 'esp_country';
119
+		$sql = "CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL,
120 120
 					  CNT_ISO3 VARCHAR(3) COLLATE utf8_bin NOT NULL,
121 121
 					  RGN_ID TINYINT(3) UNSIGNED DEFAULT NULL,
122 122
 					  CNT_name VARCHAR(45) COLLATE utf8_bin NOT NULL,
@@ -132,24 +132,24 @@  discard block
 block discarded – undo
132 132
 					  CNT_is_EU TINYINT(1) DEFAULT '0',
133 133
 					  CNT_active TINYINT(1) DEFAULT '0',
134 134
 					  PRIMARY KEY  (CNT_ISO)";
135
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
136
-        $table_name = 'esp_currency';
137
-        $sql = "CUR_code VARCHAR(6) COLLATE utf8_bin NOT NULL,
135
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
136
+		$table_name = 'esp_currency';
137
+		$sql = "CUR_code VARCHAR(6) COLLATE utf8_bin NOT NULL,
138 138
 				CUR_single VARCHAR(45) COLLATE utf8_bin DEFAULT 'dollar',
139 139
 				CUR_plural VARCHAR(45) COLLATE utf8_bin DEFAULT 'dollars',
140 140
 				CUR_sign VARCHAR(45) COLLATE utf8_bin DEFAULT '$',
141 141
 				CUR_dec_plc VARCHAR(1) COLLATE utf8_bin NOT NULL DEFAULT '2',
142 142
 				CUR_active TINYINT(1) DEFAULT '0',
143 143
 				PRIMARY KEY  (CUR_code)";
144
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
145
-        $table_name = 'esp_currency_payment_method';
146
-        $sql = "CPM_ID INT(11) NOT NULL AUTO_INCREMENT,
144
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
145
+		$table_name = 'esp_currency_payment_method';
146
+		$sql = "CPM_ID INT(11) NOT NULL AUTO_INCREMENT,
147 147
 				CUR_code  VARCHAR(6) COLLATE utf8_bin NOT NULL,
148 148
 				PMD_ID INT(11) NOT NULL,
149 149
 				PRIMARY KEY  (CPM_ID)";
150
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
151
-        $table_name = 'esp_datetime';
152
-        $sql = "DTT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
150
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
151
+		$table_name = 'esp_datetime';
152
+		$sql = "DTT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
153 153
 				  EVT_ID BIGINT(20) UNSIGNED NOT NULL,
154 154
 				  DTT_name VARCHAR(255) NOT NULL DEFAULT '',
155 155
 				  DTT_description TEXT NOT NULL,
@@ -164,9 +164,9 @@  discard block
 block discarded – undo
164 164
 						PRIMARY KEY  (DTT_ID),
165 165
 						KEY EVT_ID (EVT_ID),
166 166
 						KEY DTT_is_primary (DTT_is_primary)";
167
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
168
-        $table_name = 'esp_event_meta';
169
-        $sql = "
167
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
168
+		$table_name = 'esp_event_meta';
169
+		$sql = "
170 170
 			EVTM_ID INT NOT NULL AUTO_INCREMENT,
171 171
 			EVT_ID BIGINT(20) UNSIGNED NOT NULL,
172 172
 			EVT_display_desc TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
@@ -181,31 +181,31 @@  discard block
 block discarded – undo
181 181
 			EVT_external_URL VARCHAR(200) NULL,
182 182
 			EVT_donations TINYINT(1) NULL,
183 183
 			PRIMARY KEY  (EVTM_ID)";
184
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
185
-        $table_name = 'esp_event_question_group';
186
-        $sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
184
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
185
+		$table_name = 'esp_event_question_group';
186
+		$sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
187 187
 					EVT_ID BIGINT(20) UNSIGNED NOT NULL,
188 188
 					QSG_ID INT UNSIGNED NOT NULL,
189 189
 					EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
190 190
 					PRIMARY KEY  (EQG_ID)";
191
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
192
-        $table_name = 'esp_event_venue';
193
-        $sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
191
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
192
+		$table_name = 'esp_event_venue';
193
+		$sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
194 194
 				EVT_ID BIGINT(20) UNSIGNED NOT NULL,
195 195
 				VNU_ID BIGINT(20) UNSIGNED NOT NULL,
196 196
 				EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
197 197
 				PRIMARY KEY  (EVV_ID)";
198
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
199
-        $table_name = 'esp_extra_meta';
200
-        $sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
198
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
199
+		$table_name = 'esp_extra_meta';
200
+		$sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
201 201
 				OBJ_ID INT(11) DEFAULT NULL,
202 202
 				EXM_type VARCHAR(45) DEFAULT NULL,
203 203
 				EXM_key VARCHAR(45) DEFAULT NULL,
204 204
 				EXM_value TEXT,
205 205
 				PRIMARY KEY  (EXM_ID)";
206
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
207
-        $table_name = 'esp_line_item';
208
-        $sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
206
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
207
+		$table_name = 'esp_line_item';
208
+		$sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
209 209
 				LIN_code VARCHAR(245) NOT NULL DEFAULT '',
210 210
 				TXN_ID INT(11) DEFAULT NULL,
211 211
 				LIN_name VARCHAR(245) NOT NULL DEFAULT '',
@@ -221,9 +221,9 @@  discard block
 block discarded – undo
221 221
 				OBJ_ID INT(11) DEFAULT NULL,
222 222
 				OBJ_type VARCHAR(45)DEFAULT NULL,
223 223
 				PRIMARY KEY  (LIN_ID)";
224
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
225
-        $table_name = 'esp_log';
226
-        $sql = "LOG_ID INT(11) NOT NULL AUTO_INCREMENT,
224
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
225
+		$table_name = 'esp_log';
226
+		$sql = "LOG_ID INT(11) NOT NULL AUTO_INCREMENT,
227 227
 				LOG_time DATETIME DEFAULT NULL,
228 228
 				OBJ_ID VARCHAR(45) DEFAULT NULL,
229 229
 				OBJ_type VARCHAR(45) DEFAULT NULL,
@@ -231,19 +231,19 @@  discard block
 block discarded – undo
231 231
 				LOG_message TEXT,
232 232
 				LOG_wp_user INT(11) DEFAULT NULL,
233 233
 				PRIMARY KEY  (LOG_ID)";
234
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
235
-        $table_name = 'esp_message_template';
236
-        $sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
234
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
235
+		$table_name = 'esp_message_template';
236
+		$sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
237 237
 					GRP_ID INT(10) UNSIGNED NOT NULL,
238 238
 					MTP_context VARCHAR(50) NOT NULL,
239 239
 					MTP_template_field VARCHAR(30) NOT NULL,
240 240
 					MTP_content TEXT NOT NULL,
241 241
 					PRIMARY KEY  (MTP_ID),
242 242
 					KEY GRP_ID (GRP_ID)";
243
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
244
-        $this->_get_table_manager()->dropIndex('esp_message_template_group', 'EVT_ID');
245
-        $table_name = 'esp_message_template_group';
246
-        $sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
243
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
244
+		$this->_get_table_manager()->dropIndex('esp_message_template_group', 'EVT_ID');
245
+		$table_name = 'esp_message_template_group';
246
+		$sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
247 247
 					MTP_user_id INT(10) NOT NULL DEFAULT '1',
248 248
 					MTP_name VARCHAR(245) NOT NULL DEFAULT '',
249 249
 					MTP_description VARCHAR(245) NOT NULL DEFAULT '',
@@ -255,17 +255,17 @@  discard block
 block discarded – undo
255 255
 					MTP_is_active TINYINT(1) NOT NULL DEFAULT '1',
256 256
 					PRIMARY KEY  (GRP_ID),
257 257
 					KEY MTP_user_id (MTP_user_id)";
258
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
259
-        $table_name = 'esp_event_message_template';
260
-        $sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
258
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
259
+		$table_name = 'esp_event_message_template';
260
+		$sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
261 261
 					EVT_ID BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
262 262
 					GRP_ID INT(10) UNSIGNED NOT NULL DEFAULT 0,
263 263
 					PRIMARY KEY  (EMT_ID),
264 264
 					KEY EVT_ID (EVT_ID),
265 265
 					KEY GRP_ID (GRP_ID)";
266
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
267
-        $table_name = 'esp_payment';
268
-        $sql = "PAY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
266
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
267
+		$table_name = 'esp_payment';
268
+		$sql = "PAY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
269 269
 					TXN_ID INT(10) UNSIGNED DEFAULT NULL,
270 270
 					STS_ID VARCHAR(3) COLLATE utf8_bin DEFAULT NULL,
271 271
 					PAY_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
@@ -282,9 +282,9 @@  discard block
 block discarded – undo
282 282
 					PRIMARY KEY  (PAY_ID),
283 283
 					KEY TXN_ID (TXN_ID),
284 284
 					KEY PAY_timestamp (PAY_timestamp)";
285
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
286
-        $table_name = 'esp_payment_method';
287
-        $sql = "PMD_ID INT(11) NOT NULL AUTO_INCREMENT,
285
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
286
+		$table_name = 'esp_payment_method';
287
+		$sql = "PMD_ID INT(11) NOT NULL AUTO_INCREMENT,
288 288
 				PMD_type VARCHAR(124) DEFAULT NULL,
289 289
 				PMD_name VARCHAR(255) DEFAULT NULL,
290 290
 				PMD_desc TEXT,
@@ -299,28 +299,28 @@  discard block
 block discarded – undo
299 299
 				PMD_scope VARCHAR(255) NULL DEFAULT 'frontend',
300 300
 				PRIMARY KEY  (PMD_ID),
301 301
 				UNIQUE KEY PMD_slug_UNIQUE (PMD_slug)";
302
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
303
-        $table_name = "esp_ticket_price";
304
-        $sql = "TKP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
302
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
303
+		$table_name = "esp_ticket_price";
304
+		$sql = "TKP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
305 305
 					  TKT_ID INT(10) UNSIGNED NOT NULL,
306 306
 					  PRC_ID INT(10) UNSIGNED NOT NULL,
307 307
 					  PRIMARY KEY  (TKP_ID)";
308
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
309
-        $table_name = "esp_datetime_ticket";
310
-        $sql = "DTK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
308
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
309
+		$table_name = "esp_datetime_ticket";
310
+		$sql = "DTK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
311 311
 					  DTT_ID INT(10) UNSIGNED NOT NULL,
312 312
 					  TKT_ID INT(10) UNSIGNED NOT NULL,
313 313
 					  PRIMARY KEY  (DTK_ID)";
314
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
315
-        $table_name = "esp_ticket_template";
316
-        $sql = "TTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
314
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
315
+		$table_name = "esp_ticket_template";
316
+		$sql = "TTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
317 317
 					  TTM_name VARCHAR(45) NOT NULL,
318 318
 					  TTM_description TEXT,
319 319
 					  TTM_file VARCHAR(45),
320 320
 					  PRIMARY KEY  (TTM_ID)";
321
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
322
-        $table_name = 'esp_question';
323
-        $sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
321
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
322
+		$table_name = 'esp_question';
323
+		$sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
324 324
 					QST_display_text TEXT NOT NULL,
325 325
 					QST_admin_label VARCHAR(255) NOT NULL,
326 326
 					QST_system VARCHAR(25) DEFAULT NULL,
@@ -332,25 +332,25 @@  discard block
 block discarded – undo
332 332
 					QST_wp_user BIGINT UNSIGNED NULL,
333 333
 					QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0,
334 334
 					PRIMARY KEY  (QST_ID)';
335
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
336
-        $table_name = 'esp_question_group_question';
337
-        $sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
335
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
336
+		$table_name = 'esp_question_group_question';
337
+		$sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
338 338
 					QSG_ID INT UNSIGNED NOT NULL,
339 339
 					QST_ID INT UNSIGNED NOT NULL,
340 340
 					QGQ_order INT UNSIGNED NOT NULL DEFAULT 0,
341 341
 					PRIMARY KEY  (QGQ_ID) ";
342
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
343
-        $table_name = 'esp_question_option';
344
-        $sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
342
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
343
+		$table_name = 'esp_question_option';
344
+		$sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
345 345
 					QSO_value VARCHAR(255) NOT NULL,
346 346
 					QSO_desc TEXT NOT NULL,
347 347
 					QST_ID INT UNSIGNED NOT NULL,
348 348
 					QSO_order INT UNSIGNED NOT NULL DEFAULT 0,
349 349
 					QSO_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
350 350
 					PRIMARY KEY  (QSO_ID)";
351
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
352
-        $table_name = 'esp_registration';
353
-        $sql = "REG_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
351
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
352
+		$table_name = 'esp_registration';
353
+		$sql = "REG_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
354 354
 					  EVT_ID BIGINT(20) UNSIGNED NOT NULL,
355 355
 					  ATT_ID BIGINT(20) UNSIGNED NOT NULL,
356 356
 					  TXN_ID INT(10) UNSIGNED NOT NULL,
@@ -373,25 +373,25 @@  discard block
 block discarded – undo
373 373
 					  KEY STS_ID (STS_ID),
374 374
 					  KEY REG_url_link (REG_url_link),
375 375
 					  KEY REG_code (REG_code)";
376
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
377
-        $table_name = 'esp_checkin';
378
-        $sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
376
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
377
+		$table_name = 'esp_checkin';
378
+		$sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
379 379
 					REG_ID INT(10) UNSIGNED NOT NULL,
380 380
 					DTT_ID INT(10) UNSIGNED NOT NULL,
381 381
 					CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
382 382
 					CHK_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
383 383
 					PRIMARY KEY  (CHK_ID)";
384
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
385
-        $table_name = 'esp_state';
386
-        $sql = "STA_ID smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT,
384
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
385
+		$table_name = 'esp_state';
386
+		$sql = "STA_ID smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT,
387 387
 					  CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL,
388 388
 					  STA_abbrev VARCHAR(24) COLLATE utf8_bin NOT NULL,
389 389
 					  STA_name VARCHAR(100) COLLATE utf8_bin NOT NULL,
390 390
 					  STA_active TINYINT(1) DEFAULT '1',
391 391
 					  PRIMARY KEY  (STA_ID)";
392
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
393
-        $table_name = 'esp_status';
394
-        $sql = "STS_ID VARCHAR(3) COLLATE utf8_bin NOT NULL,
392
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
393
+		$table_name = 'esp_status';
394
+		$sql = "STS_ID VARCHAR(3) COLLATE utf8_bin NOT NULL,
395 395
 					  STS_code VARCHAR(45) COLLATE utf8_bin NOT NULL,
396 396
 					  STS_type set('event','registration','transaction','payment','email') COLLATE utf8_bin NOT NULL,
397 397
 					  STS_can_edit TINYINT(1) NOT NULL DEFAULT 0,
@@ -399,9 +399,9 @@  discard block
 block discarded – undo
399 399
 					  STS_open TINYINT(1) NOT NULL DEFAULT 1,
400 400
 					  UNIQUE KEY STS_ID_UNIQUE (STS_ID),
401 401
 					  KEY STS_type (STS_type)";
402
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
403
-        $table_name = 'esp_transaction';
404
-        $sql = "TXN_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
402
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
403
+		$table_name = 'esp_transaction';
404
+		$sql = "TXN_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
405 405
 					  TXN_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
406 406
 					  TXN_total DECIMAL(10,3) DEFAULT '0.00',
407 407
 					  TXN_paid DECIMAL(10,3) NOT NULL DEFAULT '0.00',
@@ -413,9 +413,9 @@  discard block
 block discarded – undo
413 413
 					  PRIMARY KEY  (TXN_ID),
414 414
 					  KEY TXN_timestamp (TXN_timestamp),
415 415
 					  KEY STS_ID (STS_ID)";
416
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
417
-        $table_name = 'esp_venue_meta';
418
-        $sql = "VNUM_ID INT(11) NOT NULL AUTO_INCREMENT,
416
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
417
+		$table_name = 'esp_venue_meta';
418
+		$sql = "VNUM_ID INT(11) NOT NULL AUTO_INCREMENT,
419 419
 			VNU_ID BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
420 420
 			VNU_address VARCHAR(255) DEFAULT NULL,
421 421
 			VNU_address2 VARCHAR(255) DEFAULT NULL,
@@ -433,10 +433,10 @@  discard block
 block discarded – undo
433 433
 			PRIMARY KEY  (VNUM_ID),
434 434
 			KEY STA_ID (STA_ID),
435 435
 			KEY CNT_ISO (CNT_ISO)";
436
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
437
-        //modified tables
438
-        $table_name = "esp_price";
439
-        $sql = "PRC_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
436
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
437
+		//modified tables
438
+		$table_name = "esp_price";
439
+		$sql = "PRC_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
440 440
 					  PRT_ID TINYINT(3) UNSIGNED NOT NULL,
441 441
 					  PRC_amount DECIMAL(10,3) NOT NULL DEFAULT '0.00',
442 442
 					  PRC_name VARCHAR(245) NOT NULL,
@@ -448,9 +448,9 @@  discard block
 block discarded – undo
448 448
 					  PRC_wp_user BIGINT UNSIGNED NULL,
449 449
 					  PRC_parent INT(10) UNSIGNED DEFAULT 0,
450 450
 					  PRIMARY KEY  (PRC_ID)";
451
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
452
-        $table_name = "esp_price_type";
453
-        $sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
451
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
452
+		$table_name = "esp_price_type";
453
+		$sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
454 454
 				  PRT_name VARCHAR(45) NOT NULL,
455 455
 				  PBT_ID TINYINT(3) UNSIGNED NOT NULL DEFAULT '1',
456 456
 				  PRT_is_percent TINYINT(1) NOT NULL DEFAULT '0',
@@ -459,9 +459,9 @@  discard block
 block discarded – undo
459 459
 				  PRT_deleted TINYINT(1) NOT NULL DEFAULT '0',
460 460
 				  UNIQUE KEY PRT_name_UNIQUE (PRT_name),
461 461
 				  PRIMARY KEY  (PRT_ID)";
462
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
463
-        $table_name = "esp_ticket";
464
-        $sql = "TKT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
462
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
463
+		$table_name = "esp_ticket";
464
+		$sql = "TKT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
465 465
 					  TTM_ID INT(10) UNSIGNED NOT NULL,
466 466
 					  TKT_name VARCHAR(245) NOT NULL DEFAULT '',
467 467
 					  TKT_description TEXT NOT NULL,
@@ -482,10 +482,10 @@  discard block
 block discarded – undo
482 482
 					  TKT_parent INT(10) UNSIGNED DEFAULT '0',
483 483
 					  TKT_deleted TINYINT(1) NOT NULL DEFAULT '0',
484 484
 					  PRIMARY KEY  (TKT_ID)";
485
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
486
-        $this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE');
487
-        $table_name = 'esp_question_group';
488
-        $sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
485
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
486
+		$this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE');
487
+		$table_name = 'esp_question_group';
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,119 +497,119 @@  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');
501
-        /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */
502
-        $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
503
-        //(because many need to convert old string states to foreign keys into the states table)
504
-        $script_4_1_defaults->insert_default_states();
505
-        $script_4_1_defaults->insert_default_countries();
506
-        /** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */
507
-        $script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0');
508
-        $script_4_5_defaults->insert_default_price_types();
509
-        $script_4_5_defaults->insert_default_prices();
510
-        $script_4_5_defaults->insert_default_tickets();
511
-        //setting up the config wp option pretty well counts as a 'schema change', or at least should happen here
512
-        EE_Config::instance()->update_espresso_config(false, true);
513
-        $this->add_default_admin_only_payments();
514
-        $this->insert_default_currencies();
515
-        return true;
516
-    }
517
-
518
-
519
-
520
-    /**
521
-     * @return boolean
522
-     */
523
-    public function schema_changes_after_migration()
524
-    {
525
-        return true;
526
-    }
527
-
528
-
529
-
530
-    public function migration_page_hooks()
531
-    {
532
-    }
533
-
534
-
535
-
536
-    public function add_default_admin_only_payments()
537
-    {
538
-        global $wpdb;
539
-        $table_name = $wpdb->prefix . "esp_payment_method";
540
-        $user_id = EEH_Activation::get_default_creator_id();
541
-        if ($this->_get_table_analysis()->tableExists($table_name)) {
542
-            $SQL = "SELECT COUNT( * ) FROM $table_name";
543
-            $existing_payment_methods = $wpdb->get_var($SQL);
544
-            $default_admin_only_payment_methods = apply_filters(
545
-                'FHEE__EEH_Activation__add_default_admin_only_payments__default_admin_only_payment_methods',
546
-                array(
547
-                    __("Bank", 'event_espresso')        => __("Bank Draft", 'event_espresso'),
548
-                    __("Cash", 'event_espresso')        => __("Cash Delivered Physically", 'event_espresso'),
549
-                    __("Check", 'event_espresso')       => __("Paper Check", 'event_espresso'),
550
-                    __("Credit Card", 'event_espresso') => __("Offline Credit Card Payment", 'event_espresso'),
551
-                    __("Debit Card", 'event_espresso')  => __("Offline Debit Payment", 'event_espresso'),
552
-                    __("Invoice", 'event_espresso')     => __("Invoice received with monies included",
553
-                        'event_espresso'),
554
-                    __("Money Order", 'event_espresso') => '',
555
-                    __("Paypal", 'event_espresso')      => __("Paypal eCheck, Invoice, etc", 'event_espresso'),
556
-                    __('Other', 'event_espresso')       => __('Other method of payment', 'event_espresso'),
557
-                ));
558
-            //make sure we hae payment method records for the following
559
-            //so admins can record payments for them from the admin page
560
-            foreach ($default_admin_only_payment_methods as $nicename => $description) {
561
-                $slug = sanitize_key($nicename);
562
-                //check that such a payment method exists
563
-                $exists = $wpdb->get_var($wpdb->prepare("SELECT count(*) FROM $table_name WHERE PMD_slug = %s", $slug));
564
-                if ( ! $exists) {
565
-                    $values = array(
566
-                        'PMD_type'       => 'Admin_Only',
567
-                        'PMD_name'       => $nicename,
568
-                        'PMD_admin_name' => $nicename,
569
-                        'PMD_admin_desc' => $description,
570
-                        'PMD_slug'       => $slug,
571
-                        'PMD_wp_user'    => $user_id,
572
-                        'PMD_scope'      => serialize(array('ADMIN')),
573
-                    );
574
-                    $success = $wpdb->insert(
575
-                        $table_name,
576
-                        $values,
577
-                        array(
578
-                            '%s',//PMD_type
579
-                            '%s',//PMD_name
580
-                            '%s',//PMD_admin_name
581
-                            '%s',//PMD_admin_desc
582
-                            '%s',//PMD_slug
583
-                            '%d',//PMD_wp_user
584
-                            '%s',//PMD_scope
585
-                        )
586
-                    );
587
-                    if ( ! $success) {
588
-                        $this->add_error(sprintf(__("Could not insert new admin-only payment method with values %s during migration",
589
-                            "event_espresso"), $this->_json_encode($values)));
590
-                    }
591
-                }
592
-            }
593
-        }
594
-    }
595
-
596
-
597
-
598
-    /**
599
-     * insert_default_countries
600
-     *
601
-     * @static
602
-     * @return void
603
-     */
604
-    public function insert_default_currencies()
605
-    {
606
-        global $wpdb;
607
-        $currency_table = $wpdb->prefix . "esp_currency";
608
-        if ($this->_get_table_analysis()->tableExists($currency_table)) {
609
-            $SQL = "SELECT COUNT('CUR_code') FROM $currency_table";
610
-            $countries = $wpdb->get_var($SQL);
611
-            if ( ! $countries) {
612
-                $SQL = "INSERT INTO $currency_table
500
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
501
+		/** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */
502
+		$script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
503
+		//(because many need to convert old string states to foreign keys into the states table)
504
+		$script_4_1_defaults->insert_default_states();
505
+		$script_4_1_defaults->insert_default_countries();
506
+		/** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */
507
+		$script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0');
508
+		$script_4_5_defaults->insert_default_price_types();
509
+		$script_4_5_defaults->insert_default_prices();
510
+		$script_4_5_defaults->insert_default_tickets();
511
+		//setting up the config wp option pretty well counts as a 'schema change', or at least should happen here
512
+		EE_Config::instance()->update_espresso_config(false, true);
513
+		$this->add_default_admin_only_payments();
514
+		$this->insert_default_currencies();
515
+		return true;
516
+	}
517
+
518
+
519
+
520
+	/**
521
+	 * @return boolean
522
+	 */
523
+	public function schema_changes_after_migration()
524
+	{
525
+		return true;
526
+	}
527
+
528
+
529
+
530
+	public function migration_page_hooks()
531
+	{
532
+	}
533
+
534
+
535
+
536
+	public function add_default_admin_only_payments()
537
+	{
538
+		global $wpdb;
539
+		$table_name = $wpdb->prefix . "esp_payment_method";
540
+		$user_id = EEH_Activation::get_default_creator_id();
541
+		if ($this->_get_table_analysis()->tableExists($table_name)) {
542
+			$SQL = "SELECT COUNT( * ) FROM $table_name";
543
+			$existing_payment_methods = $wpdb->get_var($SQL);
544
+			$default_admin_only_payment_methods = apply_filters(
545
+				'FHEE__EEH_Activation__add_default_admin_only_payments__default_admin_only_payment_methods',
546
+				array(
547
+					__("Bank", 'event_espresso')        => __("Bank Draft", 'event_espresso'),
548
+					__("Cash", 'event_espresso')        => __("Cash Delivered Physically", 'event_espresso'),
549
+					__("Check", 'event_espresso')       => __("Paper Check", 'event_espresso'),
550
+					__("Credit Card", 'event_espresso') => __("Offline Credit Card Payment", 'event_espresso'),
551
+					__("Debit Card", 'event_espresso')  => __("Offline Debit Payment", 'event_espresso'),
552
+					__("Invoice", 'event_espresso')     => __("Invoice received with monies included",
553
+						'event_espresso'),
554
+					__("Money Order", 'event_espresso') => '',
555
+					__("Paypal", 'event_espresso')      => __("Paypal eCheck, Invoice, etc", 'event_espresso'),
556
+					__('Other', 'event_espresso')       => __('Other method of payment', 'event_espresso'),
557
+				));
558
+			//make sure we hae payment method records for the following
559
+			//so admins can record payments for them from the admin page
560
+			foreach ($default_admin_only_payment_methods as $nicename => $description) {
561
+				$slug = sanitize_key($nicename);
562
+				//check that such a payment method exists
563
+				$exists = $wpdb->get_var($wpdb->prepare("SELECT count(*) FROM $table_name WHERE PMD_slug = %s", $slug));
564
+				if ( ! $exists) {
565
+					$values = array(
566
+						'PMD_type'       => 'Admin_Only',
567
+						'PMD_name'       => $nicename,
568
+						'PMD_admin_name' => $nicename,
569
+						'PMD_admin_desc' => $description,
570
+						'PMD_slug'       => $slug,
571
+						'PMD_wp_user'    => $user_id,
572
+						'PMD_scope'      => serialize(array('ADMIN')),
573
+					);
574
+					$success = $wpdb->insert(
575
+						$table_name,
576
+						$values,
577
+						array(
578
+							'%s',//PMD_type
579
+							'%s',//PMD_name
580
+							'%s',//PMD_admin_name
581
+							'%s',//PMD_admin_desc
582
+							'%s',//PMD_slug
583
+							'%d',//PMD_wp_user
584
+							'%s',//PMD_scope
585
+						)
586
+					);
587
+					if ( ! $success) {
588
+						$this->add_error(sprintf(__("Could not insert new admin-only payment method with values %s during migration",
589
+							"event_espresso"), $this->_json_encode($values)));
590
+					}
591
+				}
592
+			}
593
+		}
594
+	}
595
+
596
+
597
+
598
+	/**
599
+	 * insert_default_countries
600
+	 *
601
+	 * @static
602
+	 * @return void
603
+	 */
604
+	public function insert_default_currencies()
605
+	{
606
+		global $wpdb;
607
+		$currency_table = $wpdb->prefix . "esp_currency";
608
+		if ($this->_get_table_analysis()->tableExists($currency_table)) {
609
+			$SQL = "SELECT COUNT('CUR_code') FROM $currency_table";
610
+			$countries = $wpdb->get_var($SQL);
611
+			if ( ! $countries) {
612
+				$SQL = "INSERT INTO $currency_table
613 613
 				( CUR_code, CUR_single, CUR_plural, CUR_sign, CUR_dec_plc, CUR_active) VALUES
614 614
 				( 'EUR',  'Euro',  'Euros',  '€',  2,1),
615 615
 				( 'AED',  'Dirham',  'Dirhams', 'د.إ',2,1),
@@ -763,10 +763,10 @@  discard block
 block discarded – undo
763 763
 				( 'ZAR',  'Rand',  'Rands',  'R',  2,1),
764 764
 				( 'ZMK',  'Kwacha',  'Kwachas',  '',  2,1),
765 765
 				( 'ZWD', 'Dollar', 'Dollars', 'Z$', 2,1);";
766
-                $wpdb->query($SQL);
767
-            }
768
-        }
769
-    }
766
+				$wpdb->query($SQL);
767
+			}
768
+		}
769
+	}
770 770
 
771 771
 }
772 772
 
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_DMS_Core_4_1_0.dms.php 2 patches
Indentation   +1137 added lines, -1137 removed lines patch added patch discarded remove patch
@@ -12,11 +12,11 @@  discard block
 block discarded – undo
12 12
 $stages = glob(EE_CORE . 'data_migration_scripts/4_1_0_stages/*');
13 13
 $class_to_filepath = array();
14 14
 if ( ! empty($stages)) {
15
-    foreach ($stages as $filepath) {
16
-        $matches = array();
17
-        preg_match('~4_1_0_stages/(.*).dmsstage.php~', $filepath, $matches);
18
-        $class_to_filepath[$matches[1]] = $filepath;
19
-    }
15
+	foreach ($stages as $filepath) {
16
+		$matches = array();
17
+		preg_match('~4_1_0_stages/(.*).dmsstage.php~', $filepath, $matches);
18
+		$class_to_filepath[$matches[1]] = $filepath;
19
+	}
20 20
 }
21 21
 //give addons a chance to autoload their stages too
22 22
 $class_to_filepath = apply_filters('FHEE__EE_DMS_4_1_0__autoloaded_stages', $class_to_filepath);
@@ -44,91 +44,91 @@  discard block
 block discarded – undo
44 44
 
45 45
 
46 46
 
47
-    /**
48
-     * EE_DMS_Core_4_1_0 constructor.
49
-     *
50
-     * @param TableManager  $table_manager
51
-     * @param TableAnalysis $table_analysis
52
-     */
53
-    public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null)
54
-    {
55
-        $this->_pretty_name = esc_html__("Data Migration from Event Espresso 3 to Event Espresso 4.1.0", "event_espresso");
56
-        $this->_priority = 10;
57
-        $this->_migration_stages = array(
58
-                new EE_DMS_4_1_0_org_options(),
59
-                new EE_DMS_4_1_0_shortcodes(),
60
-                new EE_DMS_4_1_0_gateways(),
61
-                new EE_DMS_4_1_0_events(),
62
-                new EE_DMS_4_1_0_prices(),
63
-                new EE_DMS_4_1_0_category_details(),
64
-                new EE_DMS_4_1_0_event_category(),
65
-                new EE_DMS_4_1_0_venues(),
66
-                new EE_DMS_4_1_0_event_venue(),
67
-                new EE_DMS_4_1_0_question_groups(),
68
-                new EE_DMS_4_1_0_questions(),
69
-                new EE_DMS_4_1_0_question_group_question(),
70
-                new EE_DMS_4_1_0_event_question_group(),
71
-                new EE_DMS_4_1_0_attendees(),
72
-                new EE_DMS_4_1_0_line_items(),
73
-                new EE_DMS_4_1_0_answers(),
74
-                new EE_DMS_4_1_0_checkins(),
75
-        );
76
-        parent::__construct($table_manager, $table_analysis);
77
-    }
78
-
79
-
80
-
81
-    /**
82
-     * Checks if this 3.1 Check-in table exists. If it doesn't we can't migrate Check-ins
83
-     *
84
-     * @global wpdb $wpdb
85
-     * @return boolean
86
-     */
87
-    private function _checkin_table_exists()
88
-    {
89
-        global $wpdb;
90
-        $results = $wpdb->get_results("SHOW TABLES LIKE '" . $wpdb->prefix . "events_attendee_checkin" . "'");
91
-        if ($results) {
92
-            return true;
93
-        } else {
94
-            return false;
95
-        }
96
-    }
97
-
98
-
99
-
100
-    public function can_migrate_from_version($version_array)
101
-    {
102
-        $version_string = $version_array['Core'];
103
-        if (version_compare($version_string, '4.0.0', '<=') && version_compare($version_string, '3.1.26', '>=')) {
47
+	/**
48
+	 * EE_DMS_Core_4_1_0 constructor.
49
+	 *
50
+	 * @param TableManager  $table_manager
51
+	 * @param TableAnalysis $table_analysis
52
+	 */
53
+	public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null)
54
+	{
55
+		$this->_pretty_name = esc_html__("Data Migration from Event Espresso 3 to Event Espresso 4.1.0", "event_espresso");
56
+		$this->_priority = 10;
57
+		$this->_migration_stages = array(
58
+				new EE_DMS_4_1_0_org_options(),
59
+				new EE_DMS_4_1_0_shortcodes(),
60
+				new EE_DMS_4_1_0_gateways(),
61
+				new EE_DMS_4_1_0_events(),
62
+				new EE_DMS_4_1_0_prices(),
63
+				new EE_DMS_4_1_0_category_details(),
64
+				new EE_DMS_4_1_0_event_category(),
65
+				new EE_DMS_4_1_0_venues(),
66
+				new EE_DMS_4_1_0_event_venue(),
67
+				new EE_DMS_4_1_0_question_groups(),
68
+				new EE_DMS_4_1_0_questions(),
69
+				new EE_DMS_4_1_0_question_group_question(),
70
+				new EE_DMS_4_1_0_event_question_group(),
71
+				new EE_DMS_4_1_0_attendees(),
72
+				new EE_DMS_4_1_0_line_items(),
73
+				new EE_DMS_4_1_0_answers(),
74
+				new EE_DMS_4_1_0_checkins(),
75
+		);
76
+		parent::__construct($table_manager, $table_analysis);
77
+	}
78
+
79
+
80
+
81
+	/**
82
+	 * Checks if this 3.1 Check-in table exists. If it doesn't we can't migrate Check-ins
83
+	 *
84
+	 * @global wpdb $wpdb
85
+	 * @return boolean
86
+	 */
87
+	private function _checkin_table_exists()
88
+	{
89
+		global $wpdb;
90
+		$results = $wpdb->get_results("SHOW TABLES LIKE '" . $wpdb->prefix . "events_attendee_checkin" . "'");
91
+		if ($results) {
92
+			return true;
93
+		} else {
94
+			return false;
95
+		}
96
+	}
97
+
98
+
99
+
100
+	public function can_migrate_from_version($version_array)
101
+	{
102
+		$version_string = $version_array['Core'];
103
+		if (version_compare($version_string, '4.0.0', '<=') && version_compare($version_string, '3.1.26', '>=')) {
104 104
 //			echo "$version_string can be migrated fro";
105
-            return true;
106
-        } elseif ( ! $version_string) {
105
+			return true;
106
+		} elseif ( ! $version_string) {
107 107
 //			echo "no version string provided: $version_string";
108
-            //no version string provided... this must be pre 4.1
109
-            //because since 4.1 we're
110
-            return false;//changed mind. dont want people thinking they should migrate yet because they cant
111
-        } else {
108
+			//no version string provided... this must be pre 4.1
109
+			//because since 4.1 we're
110
+			return false;//changed mind. dont want people thinking they should migrate yet because they cant
111
+		} else {
112 112
 //			echo "$version_string doesnt apply";
113
-            return false;
114
-        }
115
-    }
113
+			return false;
114
+		}
115
+	}
116 116
 
117 117
 
118 118
 
119
-    public function schema_changes_before_migration()
120
-    {
121
-        //relies on 4.1's EEH_Activation::create_table
122
-        require_once(EE_HELPERS . 'EEH_Activation.helper.php');
123
-        $table_name = 'esp_answer';
124
-        $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
119
+	public function schema_changes_before_migration()
120
+	{
121
+		//relies on 4.1's EEH_Activation::create_table
122
+		require_once(EE_HELPERS . 'EEH_Activation.helper.php');
123
+		$table_name = 'esp_answer';
124
+		$sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
125 125
 					REG_ID INT UNSIGNED NOT NULL,
126 126
 					QST_ID INT UNSIGNED NOT NULL,
127 127
 					ANS_value TEXT NOT NULL,
128 128
 					PRIMARY KEY  (ANS_ID)";
129
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
130
-        $table_name = 'esp_attendee_meta';
131
-        $sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
129
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
130
+		$table_name = 'esp_attendee_meta';
131
+		$sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
132 132
 						ATT_ID BIGINT(20) UNSIGNED NOT NULL,
133 133
 						ATT_fname VARCHAR(45) NOT NULL,
134 134
 						ATT_lname VARCHAR(45) NOT	NULL,
@@ -144,9 +144,9 @@  discard block
 block discarded – undo
144 144
 								KEY ATT_fname (ATT_fname),
145 145
 								KEY ATT_lname (ATT_lname),
146 146
 								KEY ATT_email (ATT_email)";
147
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
148
-        $table_name = 'esp_country';
149
-        $sql = "CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL,
147
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
148
+		$table_name = 'esp_country';
149
+		$sql = "CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL,
150 150
 					  CNT_ISO3 VARCHAR(3) COLLATE utf8_bin NOT NULL,
151 151
 					  RGN_ID TINYINT(3) UNSIGNED DEFAULT NULL,
152 152
 					  CNT_name VARCHAR(45) COLLATE utf8_bin NOT NULL,
@@ -162,9 +162,9 @@  discard block
 block discarded – undo
162 162
 					  CNT_is_EU TINYINT(1) DEFAULT '0',
163 163
 					  CNT_active TINYINT(1) DEFAULT '0',
164 164
 					  PRIMARY KEY  (CNT_ISO)";
165
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
166
-        $table_name = 'esp_datetime';
167
-        $sql = "DTT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
165
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
166
+		$table_name = 'esp_datetime';
167
+		$sql = "DTT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
168 168
 				  EVT_ID BIGINT(20) UNSIGNED NOT NULL,
169 169
 				  DTT_EVT_start DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
170 170
 				  DTT_EVT_end DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
@@ -177,9 +177,9 @@  discard block
 block discarded – undo
177 177
 						PRIMARY KEY  (DTT_ID),
178 178
 						KEY EVT_ID (EVT_ID),
179 179
 						KEY DTT_is_primary (DTT_is_primary)";
180
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
181
-        $table_name = 'esp_event_meta';
182
-        $sql = "
180
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
181
+		$table_name = 'esp_event_meta';
182
+		$sql = "
183 183
 			EVTM_ID INT NOT NULL AUTO_INCREMENT,
184 184
 			EVT_ID BIGINT(20) UNSIGNED NOT NULL,
185 185
 			EVT_display_desc TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
@@ -194,31 +194,31 @@  discard block
 block discarded – undo
194 194
 			EVT_external_URL VARCHAR(200) NULL,
195 195
 			EVT_donations TINYINT(1) NULL,
196 196
 			PRIMARY KEY  (EVTM_ID)";
197
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
198
-        $table_name = 'esp_event_question_group';
199
-        $sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
197
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
198
+		$table_name = 'esp_event_question_group';
199
+		$sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
200 200
 					EVT_ID BIGINT(20) UNSIGNED NOT NULL,
201 201
 					QSG_ID INT UNSIGNED NOT NULL,
202 202
 					EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
203 203
 					PRIMARY KEY  (EQG_ID)";
204
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
205
-        $table_name = 'esp_event_venue';
206
-        $sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
204
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
205
+		$table_name = 'esp_event_venue';
206
+		$sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
207 207
 				EVT_ID BIGINT(20) UNSIGNED NOT NULL,
208 208
 				VNU_ID BIGINT(20) UNSIGNED NOT NULL,
209 209
 				EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
210 210
 				PRIMARY KEY  (EVV_ID)";
211
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
212
-        $table_name = 'esp_extra_meta';
213
-        $sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
211
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
212
+		$table_name = 'esp_extra_meta';
213
+		$sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
214 214
 				OBJ_ID INT(11) DEFAULT NULL,
215 215
 				EXM_type VARCHAR(45) DEFAULT NULL,
216 216
 				EXM_key VARCHAR(45) DEFAULT NULL,
217 217
 				EXM_value TEXT,
218 218
 				PRIMARY KEY  (EXM_ID)";
219
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
220
-        $table_name = 'esp_line_item';
221
-        $sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
219
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
220
+		$table_name = 'esp_line_item';
221
+		$sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
222 222
 				LIN_code VARCHAR(245) NOT NULL DEFAULT '',
223 223
 				TXN_ID INT(11) DEFAULT NULL,
224 224
 				LIN_name VARCHAR(245) NOT NULL DEFAULT '',
@@ -234,18 +234,18 @@  discard block
 block discarded – undo
234 234
 				OBJ_ID INT(11) DEFAULT NULL,
235 235
 				OBJ_type VARCHAR(45)DEFAULT NULL,
236 236
 				PRIMARY KEY  (LIN_ID)";
237
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
238
-        $table_name = 'esp_message_template';
239
-        $sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
237
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
238
+		$table_name = 'esp_message_template';
239
+		$sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
240 240
 					GRP_ID INT(10) UNSIGNED NOT NULL,
241 241
 					MTP_context VARCHAR(50) NOT NULL,
242 242
 					MTP_template_field VARCHAR(30) NOT NULL,
243 243
 					MTP_content TEXT NOT NULL,
244 244
 					PRIMARY KEY  (MTP_ID),
245 245
 					KEY GRP_ID (GRP_ID)";
246
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
247
-        $table_name = 'esp_message_template_group';
248
-        $sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
246
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
247
+		$table_name = 'esp_message_template_group';
248
+		$sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
249 249
 					EVT_ID BIGINT(20) UNSIGNED DEFAULT NULL,
250 250
 					MTP_user_id INT(10) NOT NULL DEFAULT '1',
251 251
 					MTP_messenger VARCHAR(30) NOT NULL,
@@ -257,9 +257,9 @@  discard block
 block discarded – undo
257 257
 					PRIMARY KEY  (GRP_ID),
258 258
 					KEY EVT_ID (EVT_ID),
259 259
 					KEY MTP_user_id (MTP_user_id)";
260
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
261
-        $table_name = 'esp_payment';
262
-        $sql = "PAY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
260
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
261
+		$table_name = 'esp_payment';
262
+		$sql = "PAY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
263 263
 					TXN_ID INT(10) UNSIGNED DEFAULT NULL,
264 264
 					STS_ID VARCHAR(3) COLLATE utf8_bin DEFAULT NULL,
265 265
 					PAY_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
@@ -275,9 +275,9 @@  discard block
 block discarded – undo
275 275
 					PRIMARY KEY  (PAY_ID),
276 276
 					KEY TXN_ID (TXN_ID),
277 277
 					KEY PAY_timestamp (PAY_timestamp)";
278
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
279
-        $table_name = "esp_ticket";
280
-        $sql = "TKT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
278
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
279
+		$table_name = "esp_ticket";
280
+		$sql = "TKT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
281 281
 					  TTM_ID INT(10) UNSIGNED NOT NULL,
282 282
 					  TKT_name VARCHAR(245) NOT NULL DEFAULT '',
283 283
 					  TKT_description TEXT NOT NULL,
@@ -296,28 +296,28 @@  discard block
 block discarded – undo
296 296
 					  TKT_parent INT(10) UNSIGNED DEFAULT '0',
297 297
 					  TKT_deleted TINYINT(1) NOT NULL DEFAULT '0',
298 298
 					  PRIMARY KEY  (TKT_ID)";
299
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
300
-        $table_name = "esp_ticket_price";
301
-        $sql = "TKP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
299
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
300
+		$table_name = "esp_ticket_price";
301
+		$sql = "TKP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
302 302
 					  TKT_ID INT(10) UNSIGNED NOT NULL,
303 303
 					  PRC_ID INT(10) UNSIGNED NOT NULL,
304 304
 					  PRIMARY KEY  (TKP_ID)";
305
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
306
-        $table_name = "esp_datetime_ticket";
307
-        $sql = "DTK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
305
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
306
+		$table_name = "esp_datetime_ticket";
307
+		$sql = "DTK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
308 308
 					  DTT_ID INT(10) UNSIGNED NOT NULL,
309 309
 					  TKT_ID INT(10) UNSIGNED NOT NULL,
310 310
 					  PRIMARY KEY  (DTK_ID)";
311
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
312
-        $table_name = "esp_ticket_template";
313
-        $sql = "TTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
311
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
312
+		$table_name = "esp_ticket_template";
313
+		$sql = "TTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
314 314
 					  TTM_name VARCHAR(45) NOT NULL,
315 315
 					  TTM_description TEXT,
316 316
 					  TTM_file VARCHAR(45),
317 317
 					  PRIMARY KEY  (TTM_ID)";
318
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
319
-        $table_name = "esp_price";
320
-        $sql = "PRC_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
318
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
319
+		$table_name = "esp_price";
320
+		$sql = "PRC_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
321 321
 					  PRT_ID TINYINT(3) UNSIGNED NOT NULL,
322 322
 					  PRC_amount DECIMAL(10,3) NOT NULL DEFAULT '0.00',
323 323
 					  PRC_name VARCHAR(245) NOT NULL,
@@ -328,9 +328,9 @@  discard block
 block discarded – undo
328 328
 					  PRC_order TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
329 329
 					  PRC_parent INT(10) UNSIGNED DEFAULT 0,
330 330
 					  PRIMARY KEY  (PRC_ID)";
331
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
332
-        $table_name = "esp_price_type";
333
-        $sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
331
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
332
+		$table_name = "esp_price_type";
333
+		$sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
334 334
 				  PRT_name VARCHAR(45) NOT NULL,
335 335
 				  PBT_ID TINYINT(3) UNSIGNED NOT NULL DEFAULT '1',
336 336
 				  PRT_is_percent TINYINT(1) NOT NULL DEFAULT '0',
@@ -338,9 +338,9 @@  discard block
 block discarded – undo
338 338
 				  PRT_deleted TINYINT(1) NOT NULL DEFAULT '0',
339 339
 				  UNIQUE KEY PRT_name_UNIQUE (PRT_name),
340 340
 				  PRIMARY KEY  (PRT_ID)";
341
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
342
-        $table_name = 'esp_question';
343
-        $sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
341
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
342
+		$table_name = 'esp_question';
343
+		$sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
344 344
 					QST_display_text TEXT NOT NULL,
345 345
 					QST_admin_label VARCHAR(255) NOT NULL,
346 346
 					QST_system VARCHAR(25) DEFAULT NULL,
@@ -352,10 +352,10 @@  discard block
 block discarded – undo
352 352
 					QST_wp_user BIGINT UNSIGNED NULL,
353 353
 					QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0,
354 354
 					PRIMARY KEY  (QST_ID)';
355
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
356
-        $this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE');
357
-        $table_name = 'esp_question_group';
358
-        $sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
355
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
356
+		$this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE');
357
+		$table_name = 'esp_question_group';
358
+		$sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
359 359
 					QSG_name VARCHAR(255) NOT NULL,
360 360
 					QSG_identifier VARCHAR(100) NOT NULL,
361 361
 					QSG_desc TEXT NULL,
@@ -366,23 +366,23 @@  discard block
 block discarded – undo
366 366
 					QSG_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
367 367
 					PRIMARY KEY  (QSG_ID),
368 368
 					UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier ASC)';
369
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
370
-        $table_name = 'esp_question_group_question';
371
-        $sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
369
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
370
+		$table_name = 'esp_question_group_question';
371
+		$sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
372 372
 					QSG_ID INT UNSIGNED NOT NULL,
373 373
 					QST_ID INT UNSIGNED NOT NULL,
374 374
 					PRIMARY KEY  (QGQ_ID) ";
375
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
376
-        $table_name = 'esp_question_option';
377
-        $sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
375
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
376
+		$table_name = 'esp_question_option';
377
+		$sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
378 378
 					QSO_value VARCHAR(255) NOT NULL,
379 379
 					QSO_desc TEXT NOT NULL,
380 380
 					QST_ID INT UNSIGNED NOT NULL,
381 381
 					QSO_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
382 382
 					PRIMARY KEY  (QSO_ID)";
383
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
384
-        $table_name = 'esp_registration';
385
-        $sql = "REG_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
383
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
384
+		$table_name = 'esp_registration';
385
+		$sql = "REG_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
386 386
 					  EVT_ID BIGINT(20) UNSIGNED NOT NULL,
387 387
 					  ATT_ID BIGINT(20) UNSIGNED NOT NULL,
388 388
 					  TXN_ID INT(10) UNSIGNED NOT NULL,
@@ -405,25 +405,25 @@  discard block
 block discarded – undo
405 405
 					  KEY STS_ID (STS_ID),
406 406
 					  KEY REG_url_link (REG_url_link),
407 407
 					  KEY REG_code (REG_code)";
408
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
409
-        $table_name = 'esp_checkin';
410
-        $sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
408
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
409
+		$table_name = 'esp_checkin';
410
+		$sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
411 411
 					REG_ID INT(10) UNSIGNED NOT NULL,
412 412
 					DTT_ID INT(10) UNSIGNED NOT NULL,
413 413
 					CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
414 414
 					CHK_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
415 415
 					PRIMARY KEY  (CHK_ID)";
416
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
417
-        $table_name = 'esp_state';
418
-        $sql = "STA_ID smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT,
416
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
417
+		$table_name = 'esp_state';
418
+		$sql = "STA_ID smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT,
419 419
 					  CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL,
420 420
 					  STA_abbrev VARCHAR(6) COLLATE utf8_bin NOT NULL,
421 421
 					  STA_name VARCHAR(100) COLLATE utf8_bin NOT NULL,
422 422
 					  STA_active TINYINT(1) DEFAULT '1',
423 423
 					  PRIMARY KEY  (STA_ID)";
424
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
425
-        $table_name = 'esp_status';
426
-        $sql = "STS_ID VARCHAR(3) COLLATE utf8_bin NOT NULL,
424
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
425
+		$table_name = 'esp_status';
426
+		$sql = "STS_ID VARCHAR(3) COLLATE utf8_bin NOT NULL,
427 427
 					  STS_code VARCHAR(45) COLLATE utf8_bin NOT NULL,
428 428
 					  STS_type set('event','registration','transaction','payment','email') COLLATE utf8_bin NOT NULL,
429 429
 					  STS_can_edit TINYINT(1) NOT NULL DEFAULT 0,
@@ -431,9 +431,9 @@  discard block
 block discarded – undo
431 431
 					  STS_open TINYINT(1) NOT NULL DEFAULT 1,
432 432
 					  UNIQUE KEY STS_ID_UNIQUE (STS_ID),
433 433
 					  KEY STS_type (STS_type)";
434
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
435
-        $table_name = 'esp_transaction';
436
-        $sql = "TXN_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
434
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
435
+		$table_name = 'esp_transaction';
436
+		$sql = "TXN_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
437 437
 					  TXN_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
438 438
 					  TXN_total DECIMAL(10,3) DEFAULT '0.00',
439 439
 					  TXN_paid DECIMAL(10,3) NOT NULL DEFAULT '0.00',
@@ -443,9 +443,9 @@  discard block
 block discarded – undo
443 443
 					  PRIMARY KEY  (TXN_ID),
444 444
 					  KEY TXN_timestamp (TXN_timestamp),
445 445
 					  KEY STS_ID (STS_ID)";
446
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
447
-        $table_name = 'esp_venue_meta';
448
-        $sql = "VNUM_ID INT(11) NOT NULL AUTO_INCREMENT,
446
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
447
+		$table_name = 'esp_venue_meta';
448
+		$sql = "VNUM_ID INT(11) NOT NULL AUTO_INCREMENT,
449 449
 			VNU_ID BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
450 450
 			VNU_address VARCHAR(255) DEFAULT NULL,
451 451
 			VNU_address2 VARCHAR(255) DEFAULT NULL,
@@ -463,52 +463,52 @@  discard block
 block discarded – undo
463 463
 			PRIMARY KEY  (VNUM_ID),
464 464
 			KEY STA_ID (STA_ID),
465 465
 			KEY CNT_ISO (CNT_ISO)";
466
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
467
-        //setting up the DEFAULT stats and countries is also essential for the data migrations to run
468
-        //(because many need to convert old string states to foreign keys into the states table)
469
-        $this->insert_default_states();
470
-        $this->insert_default_countries();
471
-        //setting up DEFAULT prices, price types, and tickets is also essential for the price migrations
472
-        $this->insert_default_price_types();
473
-        $this->insert_default_prices();
474
-        $this->insert_default_tickets();
475
-        //setting up the config wp option pretty well counts as a 'schema change', or at least should happen ehre
476
-        EE_Config::instance()->update_espresso_config(false, true);
477
-        return true;
478
-    }
479
-
480
-
481
-
482
-    /**
483
-     * Yes we could have cleaned up the ee3 tables here. But just in case someone
484
-     * didn't backup their DB, and decides they want ot keep using EE3, we'll
485
-     * leave them for now. Mayeb remove them in 4.5 or something.
486
-     *
487
-     * @return boolean
488
-     */
489
-    public function schema_changes_after_migration()
490
-    {
491
-        return true;
492
-    }
493
-
494
-
495
-
496
-    /**
497
-     * insert_default_states
498
-     *
499
-     * @access public
500
-     * @static
501
-     * @return void
502
-     */
503
-    public function insert_default_states()
504
-    {
505
-        global $wpdb;
506
-        $state_table = $wpdb->prefix . "esp_state";
507
-        if ($this->_get_table_analysis()->tableExists($state_table)) {
508
-            $SQL = "SELECT COUNT('STA_ID') FROM " . $state_table;
509
-            $states = $wpdb->get_var($SQL);
510
-            if ( ! $states) {
511
-                $SQL = "INSERT INTO " . $state_table . "
466
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
467
+		//setting up the DEFAULT stats and countries is also essential for the data migrations to run
468
+		//(because many need to convert old string states to foreign keys into the states table)
469
+		$this->insert_default_states();
470
+		$this->insert_default_countries();
471
+		//setting up DEFAULT prices, price types, and tickets is also essential for the price migrations
472
+		$this->insert_default_price_types();
473
+		$this->insert_default_prices();
474
+		$this->insert_default_tickets();
475
+		//setting up the config wp option pretty well counts as a 'schema change', or at least should happen ehre
476
+		EE_Config::instance()->update_espresso_config(false, true);
477
+		return true;
478
+	}
479
+
480
+
481
+
482
+	/**
483
+	 * Yes we could have cleaned up the ee3 tables here. But just in case someone
484
+	 * didn't backup their DB, and decides they want ot keep using EE3, we'll
485
+	 * leave them for now. Mayeb remove them in 4.5 or something.
486
+	 *
487
+	 * @return boolean
488
+	 */
489
+	public function schema_changes_after_migration()
490
+	{
491
+		return true;
492
+	}
493
+
494
+
495
+
496
+	/**
497
+	 * insert_default_states
498
+	 *
499
+	 * @access public
500
+	 * @static
501
+	 * @return void
502
+	 */
503
+	public function insert_default_states()
504
+	{
505
+		global $wpdb;
506
+		$state_table = $wpdb->prefix . "esp_state";
507
+		if ($this->_get_table_analysis()->tableExists($state_table)) {
508
+			$SQL = "SELECT COUNT('STA_ID') FROM " . $state_table;
509
+			$states = $wpdb->get_var($SQL);
510
+			if ( ! $states) {
511
+				$SQL = "INSERT INTO " . $state_table . "
512 512
 				(STA_ID, CNT_ISO, STA_abbrev, STA_name, STA_active) VALUES
513 513
 				(1, 'US', 'AK', 'Alaska', 1),
514 514
 				(2, 'US', 'AL', 'Alabama', 1),
@@ -579,29 +579,29 @@  discard block
 block discarded – undo
579 579
 				(67, 'CA', 'PE', 'Prince Edward Island', 1),
580 580
 				(68, 'CA', 'QC', 'Quebec', 1),
581 581
 				(69, 'CA', 'SK', 'Saskatchewan', 1);";
582
-                $wpdb->query($SQL);
583
-            }
584
-        }
585
-    }
586
-
587
-
588
-
589
-    /**
590
-     * insert_default_countries
591
-     *
592
-     * @access public
593
-     * @static
594
-     * @return void
595
-     */
596
-    public function insert_default_countries()
597
-    {
598
-        global $wpdb;
599
-        $country_table = $wpdb->prefix . "esp_country";
600
-        if ($this->_get_table_analysis()->tableExists($country_table)) {
601
-            $SQL = "SELECT COUNT('CNT_ISO') FROM " . $country_table;
602
-            $countries = $wpdb->get_var($SQL);
603
-            if ( ! $countries) {
604
-                $SQL = "INSERT INTO " . $country_table . "
582
+				$wpdb->query($SQL);
583
+			}
584
+		}
585
+	}
586
+
587
+
588
+
589
+	/**
590
+	 * insert_default_countries
591
+	 *
592
+	 * @access public
593
+	 * @static
594
+	 * @return void
595
+	 */
596
+	public function insert_default_countries()
597
+	{
598
+		global $wpdb;
599
+		$country_table = $wpdb->prefix . "esp_country";
600
+		if ($this->_get_table_analysis()->tableExists($country_table)) {
601
+			$SQL = "SELECT COUNT('CNT_ISO') FROM " . $country_table;
602
+			$countries = $wpdb->get_var($SQL);
603
+			if ( ! $countries) {
604
+				$SQL = "INSERT INTO " . $country_table . "
605 605
 				(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
606 606
 				('AD', 'AND', 0, 'Andorra', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+376', 0, 0),
607 607
 				('AE', 'ARE', 0, 'United Arab Emirates', 'AED', 'Dirham', 'Dirhams', 'د.إ', 1, 2, '+971', 0, 0),
@@ -829,941 +829,941 @@  discard block
 block discarded – undo
829 829
 				('ZA', 'ZAF', 0, 'South Africa', 'ZAR', 'Rand', 'Rands', 'R', 1, 2, '+27', 0, 0),
830 830
 				('ZM', 'ZMB', 0, 'Zambia', 'ZMK', 'Kwacha', 'Kwachas', '', 1, 2, '+260', 0, 0),
831 831
 				('ZW', 'ZWE', 0, 'Zimbabwe', 'ZWD', 'Dollar', 'Dollars', 'Z$', 1, 2, '+263', 0, 0);";
832
-                $wpdb->query($SQL);
833
-            }
834
-        }
835
-    }
836
-
837
-
838
-
839
-    /**
840
-     * insert_default_price_types
841
-     *
842
-     * @access public
843
-     * @static
844
-     * @return void
845
-     */
846
-    public function insert_default_price_types()
847
-    {
848
-        global $wpdb;
849
-        $price_type_table = $wpdb->prefix . "esp_price_type";
850
-        if ($this->_get_table_analysis()->tableExists($price_type_table)) {
851
-            $SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table;
852
-            $price_types_exist = $wpdb->get_var($SQL);
853
-            if ( ! $price_types_exist) {
854
-                $SQL = "INSERT INTO $price_type_table ( PRT_ID, PRT_name, PBT_ID, PRT_is_percent, PRT_order, PRT_deleted ) VALUES
832
+				$wpdb->query($SQL);
833
+			}
834
+		}
835
+	}
836
+
837
+
838
+
839
+	/**
840
+	 * insert_default_price_types
841
+	 *
842
+	 * @access public
843
+	 * @static
844
+	 * @return void
845
+	 */
846
+	public function insert_default_price_types()
847
+	{
848
+		global $wpdb;
849
+		$price_type_table = $wpdb->prefix . "esp_price_type";
850
+		if ($this->_get_table_analysis()->tableExists($price_type_table)) {
851
+			$SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table;
852
+			$price_types_exist = $wpdb->get_var($SQL);
853
+			if ( ! $price_types_exist) {
854
+				$SQL = "INSERT INTO $price_type_table ( PRT_ID, PRT_name, PBT_ID, PRT_is_percent, PRT_order, PRT_deleted ) VALUES
855 855
 							(1, '" . esc_html__('Base Price', 'event_espresso') . "', 1,  0, 0, 0),
856 856
 							(2, '" . esc_html__('Percent Discount', 'event_espresso') . "', 2,  1, 20, 0),
857 857
 							(3, '" . esc_html__('Fixed Discount', 'event_espresso') . "', 2,  0, 30, 0),
858 858
 							(4, '" . esc_html__('Percent Surcharge', 'event_espresso') . "', 3,  1, 40, 0),
859 859
 							(5, '" . esc_html__('Fixed Surcharge', 'event_espresso') . "', 3,  0, 50, 0);";
860
-                $SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_price_types__SQL', $SQL);
861
-                $wpdb->query($SQL);
862
-            }
863
-        }
864
-    }
865
-
866
-
867
-
868
-    /**
869
-     * insert_default_prices. We assume we're upgrading to regular here.
870
-     * If we're INSTALLING 4.1 CAF, then we add a few extra DEFAULT prices
871
-     * when EEH_Activaion's initialize_db_content is called via  ahook in
872
-     * EE_BRewing_regular
873
-     *
874
-     * @access public
875
-     * @static
876
-     * @return void
877
-     */
878
-    public function insert_default_prices()
879
-    {
880
-        global $wpdb;
881
-        $price_table = $wpdb->prefix . "esp_price";
882
-        if ($this->_get_table_analysis()->tableExists($price_table)) {
883
-            $SQL = 'SELECT COUNT(PRC_ID) FROM ' . $price_table;
884
-            $prices_exist = $wpdb->get_var($SQL);
885
-            if ( ! $prices_exist) {
886
-                $SQL = "INSERT INTO $price_table
860
+				$SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_price_types__SQL', $SQL);
861
+				$wpdb->query($SQL);
862
+			}
863
+		}
864
+	}
865
+
866
+
867
+
868
+	/**
869
+	 * insert_default_prices. We assume we're upgrading to regular here.
870
+	 * If we're INSTALLING 4.1 CAF, then we add a few extra DEFAULT prices
871
+	 * when EEH_Activaion's initialize_db_content is called via  ahook in
872
+	 * EE_BRewing_regular
873
+	 *
874
+	 * @access public
875
+	 * @static
876
+	 * @return void
877
+	 */
878
+	public function insert_default_prices()
879
+	{
880
+		global $wpdb;
881
+		$price_table = $wpdb->prefix . "esp_price";
882
+		if ($this->_get_table_analysis()->tableExists($price_table)) {
883
+			$SQL = 'SELECT COUNT(PRC_ID) FROM ' . $price_table;
884
+			$prices_exist = $wpdb->get_var($SQL);
885
+			if ( ! $prices_exist) {
886
+				$SQL = "INSERT INTO $price_table
887 887
 							(PRC_ID, PRT_ID, PRC_amount, PRC_name, PRC_desc,  PRC_is_default, PRC_overrides, PRC_order, PRC_deleted, PRC_parent ) VALUES
888 888
 							(1, 1, '0.00', 'Free Admission', '', 1, NULL, 0, 0, 0);";
889
-                $SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_prices__SQL', $SQL);
890
-                $wpdb->query($SQL);
891
-            }
892
-        }
893
-    }
894
-
895
-
896
-
897
-    /**
898
-     * insert DEFAULT ticket
899
-     *
900
-     * @access public
901
-     * @static
902
-     * @return void
903
-     */
904
-    public function insert_default_tickets()
905
-    {
906
-        global $wpdb;
907
-        $ticket_table = $wpdb->prefix . "esp_ticket";
908
-        if ($this->_get_table_analysis()->tableExists($ticket_table)) {
909
-            $SQL = 'SELECT COUNT(TKT_ID) FROM ' . $ticket_table;
910
-            $tickets_exist = $wpdb->get_var($SQL);
911
-            if ( ! $tickets_exist) {
912
-                $SQL = "INSERT INTO $ticket_table
889
+				$SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_prices__SQL', $SQL);
890
+				$wpdb->query($SQL);
891
+			}
892
+		}
893
+	}
894
+
895
+
896
+
897
+	/**
898
+	 * insert DEFAULT ticket
899
+	 *
900
+	 * @access public
901
+	 * @static
902
+	 * @return void
903
+	 */
904
+	public function insert_default_tickets()
905
+	{
906
+		global $wpdb;
907
+		$ticket_table = $wpdb->prefix . "esp_ticket";
908
+		if ($this->_get_table_analysis()->tableExists($ticket_table)) {
909
+			$SQL = 'SELECT COUNT(TKT_ID) FROM ' . $ticket_table;
910
+			$tickets_exist = $wpdb->get_var($SQL);
911
+			if ( ! $tickets_exist) {
912
+				$SQL = "INSERT INTO $ticket_table
913 913
 					( 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
914 914
 					( 1, 0, '"
915
-                       . esc_html__("Free Ticket", "event_espresso")
916
-                       . "', '', 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);";
917
-                $SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL', $SQL);
918
-                $wpdb->query($SQL);
919
-            }
920
-        }
921
-        $ticket_price_table = $wpdb->prefix . "esp_ticket_price";
922
-        if ($this->_get_table_analysis()->tableExists($ticket_price_table)) {
923
-            $SQL = 'SELECT COUNT(TKP_ID) FROM ' . $ticket_price_table;
924
-            $ticket_prc_exist = $wpdb->get_var($SQL);
925
-            if ( ! $ticket_prc_exist) {
926
-                $SQL = "INSERT INTO $ticket_price_table
915
+					   . esc_html__("Free Ticket", "event_espresso")
916
+					   . "', '', 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);";
917
+				$SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL', $SQL);
918
+				$wpdb->query($SQL);
919
+			}
920
+		}
921
+		$ticket_price_table = $wpdb->prefix . "esp_ticket_price";
922
+		if ($this->_get_table_analysis()->tableExists($ticket_price_table)) {
923
+			$SQL = 'SELECT COUNT(TKP_ID) FROM ' . $ticket_price_table;
924
+			$ticket_prc_exist = $wpdb->get_var($SQL);
925
+			if ( ! $ticket_prc_exist) {
926
+				$SQL = "INSERT INTO $ticket_price_table
927 927
 				( TKP_ID, TKT_ID, PRC_ID ) VALUES
928 928
 				( 1, 1, 1 )
929 929
 				";
930
-                $SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL__ticket_price', $SQL);
931
-                $wpdb->query($SQL);
932
-            }
933
-        }
934
-    }
935
-
936
-
937
-
938
-    /**
939
-     * Gets a country entry as an array, or creates one if none is found. Much like EEM_Country::instance()->get_one(),
940
-     * but is independent of outside code which can change in future versions of EE. Also, $country_name CAN be a 3.1
941
-     * country ID (int), a 2-letter ISO, 3-letter ISO, or name
942
-     *
943
-     * @global type  $wpdb
944
-     * @param string $country_name
945
-     * @return array where keys are columns, values are column values
946
-     */
947
-    public function get_or_create_country($country_name)
948
-    {
949
-        if ( ! $country_name) {
950
-            throw new EE_Error(esc_html__("Could not get a country because country name is blank", "event_espresso"));
951
-        }
952
-        global $wpdb;
953
-        $country_table = $wpdb->prefix . "esp_country";
954
-        if (is_int($country_name)) {
955
-            $country_name = $this->get_iso_from_3_1_country_id($country_name);
956
-        }
957
-        $country = $wpdb->get_row($wpdb->prepare("SELECT * FROM $country_table WHERE
930
+				$SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL__ticket_price', $SQL);
931
+				$wpdb->query($SQL);
932
+			}
933
+		}
934
+	}
935
+
936
+
937
+
938
+	/**
939
+	 * Gets a country entry as an array, or creates one if none is found. Much like EEM_Country::instance()->get_one(),
940
+	 * but is independent of outside code which can change in future versions of EE. Also, $country_name CAN be a 3.1
941
+	 * country ID (int), a 2-letter ISO, 3-letter ISO, or name
942
+	 *
943
+	 * @global type  $wpdb
944
+	 * @param string $country_name
945
+	 * @return array where keys are columns, values are column values
946
+	 */
947
+	public function get_or_create_country($country_name)
948
+	{
949
+		if ( ! $country_name) {
950
+			throw new EE_Error(esc_html__("Could not get a country because country name is blank", "event_espresso"));
951
+		}
952
+		global $wpdb;
953
+		$country_table = $wpdb->prefix . "esp_country";
954
+		if (is_int($country_name)) {
955
+			$country_name = $this->get_iso_from_3_1_country_id($country_name);
956
+		}
957
+		$country = $wpdb->get_row($wpdb->prepare("SELECT * FROM $country_table WHERE
958 958
 			CNT_ISO LIKE %s OR
959 959
 			CNT_ISO3 LIKE %s OR
960 960
 			CNT_name LIKE %s LIMIT 1", $country_name, $country_name, $country_name), ARRAY_A);
961
-        if ( ! $country) {
962
-            //insert a new one then
963
-            $cols_n_values = array(
964
-                    'CNT_ISO'         => $this->_find_available_country_iso(2),
965
-                    'CNT_ISO3'        => $this->_find_available_country_iso(3),
966
-                    'RGN_ID'          => 0,
967
-                    'CNT_name'        => $country_name,
968
-                    'CNT_cur_code'    => 'USD',
969
-                    'CNT_cur_single'  => 'Dollar',
970
-                    'CNT_cur_plural'  => 'Dollars',
971
-                    'CNT_cur_sign'    => '&#36;',
972
-                    'CNT_cur_sign_b4' => true,
973
-                    'CNT_cur_dec_plc' => 2,
974
-                    'CNT_cur_dec_mrk' => '.',
975
-                    'CNT_cur_thsnds'  => ',',
976
-                    'CNT_tel_code'    => '+1',
977
-                    'CNT_is_EU'       => false,
978
-                    'CNT_active'      => true,
979
-            );
980
-            $data_types = array(
981
-                    '%s',//CNT_ISO
982
-                    '%s',//CNT_ISO3
983
-                    '%d',//RGN_ID
984
-                    '%s',//CNT_name
985
-                    '%s',//CNT_cur_code
986
-                    '%s',//CNT_cur_single
987
-                    '%s',//CNT_cur_plural
988
-                    '%s',//CNT_cur_sign
989
-                    '%d',//CNT_cur_sign_b4
990
-                    '%d',//CNT_cur_dec_plc
991
-                    '%s',//CNT_cur_dec_mrk
992
-                    '%s',//CNT_cur_thsnds
993
-                    '%s',//CNT_tel_code
994
-                    '%d',//CNT_is_EU
995
-                    '%d',//CNT_active
996
-            );
997
-            $success = $wpdb->insert($country_table,
998
-                    $cols_n_values,
999
-                    $data_types);
1000
-            if ( ! $success) {
1001
-                throw new EE_Error($this->_create_error_message_for_db_insertion('N/A',
1002
-                        array('country_id' => $country_name), $country_table, $cols_n_values, $data_types));
1003
-            }
1004
-            $country = $cols_n_values;
1005
-        }
1006
-        return $country;
1007
-    }
1008
-
1009
-
1010
-
1011
-    /**
1012
-     * finds a country iso which hasnt been used yet
1013
-     *
1014
-     * @global type $wpdb
1015
-     * @return string
1016
-     */
1017
-    private function _find_available_country_iso($num_letters = 2)
1018
-    {
1019
-        global $wpdb;
1020
-        $country_table = $wpdb->prefix . "esp_country";
1021
-        $attempts = 0;
1022
-        do {
1023
-            $current_iso = strtoupper(wp_generate_password($num_letters, false));
1024
-            $country_with_that_iso = $wpdb->get_var($wpdb->prepare("SELECT count(CNT_ISO) FROM "
1025
-                                                                   . $country_table
1026
-                                                                   . " WHERE CNT_ISO=%s", $current_iso));
1027
-            $attempts++;
1028
-            //keep going until we find an available country code, or we arbitrarily
1029
-            //decide we've tried this enough. Somehow they have way too many countries
1030
-            //(probably because they're mis-using the EE3 country_id like a custom question)
1031
-        } while (intval($country_with_that_iso) && $attempts < 200);
1032
-        return $current_iso;
1033
-    }
1034
-
1035
-
1036
-
1037
-    /**
1038
-     * Gets a state entry as an array, or creates one if none is found. Much like EEM_State::instance()->get_one(), but
1039
-     * is independent of outside code which can change in future versions of EE
1040
-     *
1041
-     * @global type  $wpdb
1042
-     * @param string $state_name
1043
-     * @return array where keys are columns, values are column values
1044
-     */
1045
-    public function get_or_create_state($state_name, $country_name = '')
1046
-    {
1047
-        if ( ! $state_name) {
1048
-            throw new EE_Error(esc_html__("Could not get-or-create state because no state name was provided",
1049
-                    "event_espresso"));
1050
-        }
1051
-        try {
1052
-            $country = $this->get_or_create_country($country_name);
1053
-            $country_iso = $country['CNT_ISO'];
1054
-        } catch (EE_Error $e) {
1055
-            $country_iso = $this->get_default_country_iso();
1056
-        }
1057
-        global $wpdb;
1058
-        $state_table = $wpdb->prefix . "esp_state";
1059
-        $state = $wpdb->get_row($wpdb->prepare("SELECT * FROM $state_table WHERE
961
+		if ( ! $country) {
962
+			//insert a new one then
963
+			$cols_n_values = array(
964
+					'CNT_ISO'         => $this->_find_available_country_iso(2),
965
+					'CNT_ISO3'        => $this->_find_available_country_iso(3),
966
+					'RGN_ID'          => 0,
967
+					'CNT_name'        => $country_name,
968
+					'CNT_cur_code'    => 'USD',
969
+					'CNT_cur_single'  => 'Dollar',
970
+					'CNT_cur_plural'  => 'Dollars',
971
+					'CNT_cur_sign'    => '&#36;',
972
+					'CNT_cur_sign_b4' => true,
973
+					'CNT_cur_dec_plc' => 2,
974
+					'CNT_cur_dec_mrk' => '.',
975
+					'CNT_cur_thsnds'  => ',',
976
+					'CNT_tel_code'    => '+1',
977
+					'CNT_is_EU'       => false,
978
+					'CNT_active'      => true,
979
+			);
980
+			$data_types = array(
981
+					'%s',//CNT_ISO
982
+					'%s',//CNT_ISO3
983
+					'%d',//RGN_ID
984
+					'%s',//CNT_name
985
+					'%s',//CNT_cur_code
986
+					'%s',//CNT_cur_single
987
+					'%s',//CNT_cur_plural
988
+					'%s',//CNT_cur_sign
989
+					'%d',//CNT_cur_sign_b4
990
+					'%d',//CNT_cur_dec_plc
991
+					'%s',//CNT_cur_dec_mrk
992
+					'%s',//CNT_cur_thsnds
993
+					'%s',//CNT_tel_code
994
+					'%d',//CNT_is_EU
995
+					'%d',//CNT_active
996
+			);
997
+			$success = $wpdb->insert($country_table,
998
+					$cols_n_values,
999
+					$data_types);
1000
+			if ( ! $success) {
1001
+				throw new EE_Error($this->_create_error_message_for_db_insertion('N/A',
1002
+						array('country_id' => $country_name), $country_table, $cols_n_values, $data_types));
1003
+			}
1004
+			$country = $cols_n_values;
1005
+		}
1006
+		return $country;
1007
+	}
1008
+
1009
+
1010
+
1011
+	/**
1012
+	 * finds a country iso which hasnt been used yet
1013
+	 *
1014
+	 * @global type $wpdb
1015
+	 * @return string
1016
+	 */
1017
+	private function _find_available_country_iso($num_letters = 2)
1018
+	{
1019
+		global $wpdb;
1020
+		$country_table = $wpdb->prefix . "esp_country";
1021
+		$attempts = 0;
1022
+		do {
1023
+			$current_iso = strtoupper(wp_generate_password($num_letters, false));
1024
+			$country_with_that_iso = $wpdb->get_var($wpdb->prepare("SELECT count(CNT_ISO) FROM "
1025
+																   . $country_table
1026
+																   . " WHERE CNT_ISO=%s", $current_iso));
1027
+			$attempts++;
1028
+			//keep going until we find an available country code, or we arbitrarily
1029
+			//decide we've tried this enough. Somehow they have way too many countries
1030
+			//(probably because they're mis-using the EE3 country_id like a custom question)
1031
+		} while (intval($country_with_that_iso) && $attempts < 200);
1032
+		return $current_iso;
1033
+	}
1034
+
1035
+
1036
+
1037
+	/**
1038
+	 * Gets a state entry as an array, or creates one if none is found. Much like EEM_State::instance()->get_one(), but
1039
+	 * is independent of outside code which can change in future versions of EE
1040
+	 *
1041
+	 * @global type  $wpdb
1042
+	 * @param string $state_name
1043
+	 * @return array where keys are columns, values are column values
1044
+	 */
1045
+	public function get_or_create_state($state_name, $country_name = '')
1046
+	{
1047
+		if ( ! $state_name) {
1048
+			throw new EE_Error(esc_html__("Could not get-or-create state because no state name was provided",
1049
+					"event_espresso"));
1050
+		}
1051
+		try {
1052
+			$country = $this->get_or_create_country($country_name);
1053
+			$country_iso = $country['CNT_ISO'];
1054
+		} catch (EE_Error $e) {
1055
+			$country_iso = $this->get_default_country_iso();
1056
+		}
1057
+		global $wpdb;
1058
+		$state_table = $wpdb->prefix . "esp_state";
1059
+		$state = $wpdb->get_row($wpdb->prepare("SELECT * FROM $state_table WHERE
1060 1060
 			(STA_abbrev LIKE %s OR
1061 1061
 			STA_name LIKE %s) AND
1062 1062
 			CNT_ISO LIKE %s LIMIT 1", $state_name, $state_name, $country_iso), ARRAY_A);
1063
-        if ( ! $state) {
1064
-            //insert a new one then
1065
-            $cols_n_values = array(
1066
-                    'CNT_ISO'    => $country_iso,
1067
-                    'STA_abbrev' => substr($state_name, 0, 6),
1068
-                    'STA_name'   => $state_name,
1069
-                    'STA_active' => true,
1070
-            );
1071
-            $data_types = array(
1072
-                    '%s',//CNT_ISO
1073
-                    '%s',//STA_abbrev
1074
-                    '%s',//STA_name
1075
-                    '%d',//STA_active
1076
-            );
1077
-            $success = $wpdb->insert($state_table, $cols_n_values, $data_types);
1078
-            if ( ! $success) {
1079
-                throw new EE_Error($this->_create_error_message_for_db_insertion('N/A',
1080
-                        array('state' => $state_name, 'country_id' => $country_name), $state_table, $cols_n_values,
1081
-                        $data_types));
1082
-            }
1083
-            $state = $cols_n_values;
1084
-            $state['STA_ID'] = $wpdb->insert_id;
1085
-        }
1086
-        return $state;
1087
-    }
1088
-
1089
-
1090
-
1091
-    /**
1092
-     * Fixes times like "5:00 PM" into the expected 24-hour format "17:00".
1093
-     * THis is actually just copied from the 3.1 JSON API because it needed to do the exact same thing
1094
-     *
1095
-     * @param type $timeString
1096
-     * @return string in the php DATETIME format: "G:i" (24-hour format hour with leading zeros, a colon, and minutes
1097
-     *                with leading zeros)
1098
-     */
1099
-    public function convertTimeFromAMPM($timeString)
1100
-    {
1101
-        $matches = array();
1102
-        preg_match("~(\\d*):(\\d*)~", $timeString, $matches);
1103
-        if ( ! $matches || count($matches) < 3) {
1104
-            $hour = '00';
1105
-            $minutes = '00';
1106
-        } else {
1107
-            $hour = intval($matches[1]);
1108
-            $minutes = $matches[2];
1109
-        }
1110
-        if (strpos($timeString, 'PM') || strpos($timeString, 'pm')) {
1111
-            $hour = intval($hour) + 12;
1112
-        }
1113
-        $hour = str_pad("$hour", 2, '0', STR_PAD_LEFT);
1114
-        $minutes = str_pad("$minutes", 2, '0', STR_PAD_LEFT);
1115
-        return "$hour:$minutes";
1116
-    }
1117
-
1118
-
1119
-
1120
-    /**
1121
-     * Gets the ISO3 fora country given its 3.1 country ID.
1122
-     *
1123
-     * @param int $country_id
1124
-     * @return string the country's ISO3 code
1125
-     */
1126
-    public function get_iso_from_3_1_country_id($country_id)
1127
-    {
1128
-        $old_countries = array(
1129
-                array(64, 'United States', 'US', 'USA', 1),
1130
-                array(15, 'Australia', 'AU', 'AUS', 1),
1131
-                array(39, 'Canada', 'CA', 'CAN', 1),
1132
-                array(171, 'United Kingdom', 'GB', 'GBR', 1),
1133
-                array(70, 'France', 'FR', 'FRA', 2),
1134
-                array(111, 'Italy', 'IT', 'ITA', 2),
1135
-                array(63, 'Spain', 'ES', 'ESP', 2),
1136
-                array(1, 'Afghanistan', 'AF', 'AFG', 1),
1137
-                array(2, 'Albania', 'AL', 'ALB', 1),
1138
-                array(3, 'Germany', 'DE', 'DEU', 2),
1139
-                array(198, 'Switzerland', 'CH', 'CHE', 1),
1140
-                array(87, 'Netherlands', 'NL', 'NLD', 2),
1141
-                array(197, 'Sweden', 'SE', 'SWE', 1),
1142
-                array(230, 'Akrotiri and Dhekelia', 'CY', 'CYP', 2),
1143
-                array(4, 'Andorra', 'AD', 'AND', 2),
1144
-                array(5, 'Angola', 'AO', 'AGO', 1),
1145
-                array(6, 'Anguilla', 'AI', 'AIA', 1),
1146
-                array(7, 'Antarctica', 'AQ', 'ATA', 1),
1147
-                array(8, 'Antigua and Barbuda', 'AG', 'ATG', 1),
1148
-                array(10, 'Saudi Arabia', 'SA', 'SAU', 1),
1149
-                array(11, 'Algeria', 'DZ', 'DZA', 1),
1150
-                array(12, 'Argentina', 'AR', 'ARG', 1),
1151
-                array(13, 'Armenia', 'AM', 'ARM', 1),
1152
-                array(14, 'Aruba', 'AW', 'ABW', 1),
1153
-                array(16, 'Austria', 'AT', 'AUT', 2),
1154
-                array(17, 'Azerbaijan', 'AZ', 'AZE', 1),
1155
-                array(18, 'Bahamas', 'BS', 'BHS', 1),
1156
-                array(19, 'Bahrain', 'BH', 'BHR', 1),
1157
-                array(20, 'Bangladesh', 'BD', 'BGD', 1),
1158
-                array(21, 'Barbados', 'BB', 'BRB', 1),
1159
-                array(22, 'Belgium ', 'BE', 'BEL', 2),
1160
-                array(23, 'Belize', 'BZ', 'BLZ', 1),
1161
-                array(24, 'Benin', 'BJ', 'BEN', 1),
1162
-                array(25, 'Bermudas', 'BM', 'BMU', 1),
1163
-                array(26, 'Belarus', 'BY', 'BLR', 1),
1164
-                array(27, 'Bolivia', 'BO', 'BOL', 1),
1165
-                array(28, 'Bosnia and Herzegovina', 'BA', 'BIH', 1),
1166
-                array(29, 'Botswana', 'BW', 'BWA', 1),
1167
-                array(96, 'Bouvet Island', 'BV', 'BVT', 1),
1168
-                array(30, 'Brazil', 'BR', 'BRA', 1),
1169
-                array(31, 'Brunei', 'BN', 'BRN', 1),
1170
-                array(32, 'Bulgaria', 'BG', 'BGR', 1),
1171
-                array(33, 'Burkina Faso', 'BF', 'BFA', 1),
1172
-                array(34, 'Burundi', 'BI', 'BDI', 1),
1173
-                array(35, 'Bhutan', 'BT', 'BTN', 1),
1174
-                array(36, 'Cape Verde', 'CV', 'CPV', 1),
1175
-                array(37, 'Cambodia', 'KH', 'KHM', 1),
1176
-                array(38, 'Cameroon', 'CM', 'CMR', 1),
1177
-                array(98, 'Cayman Islands', 'KY', 'CYM', 1),
1178
-                array(172, 'Central African Republic', 'CF', 'CAF', 1),
1179
-                array(40, 'Chad', 'TD', 'TCD', 1),
1180
-                array(41, 'Chile', 'CL', 'CHL', 1),
1181
-                array(42, 'China', 'CN', 'CHN', 1),
1182
-                array(105, 'Christmas Island', 'CX', 'CXR', 1),
1183
-                array(43, 'Cyprus', 'CY', 'CYP', 2),
1184
-                array(99, 'Cocos Island', 'CC', 'CCK', 1),
1185
-                array(100, 'Cook Islands', 'CK', 'COK', 1),
1186
-                array(44, 'Colombia', 'CO', 'COL', 1),
1187
-                array(45, 'Comoros', 'KM', 'COM', 1),
1188
-                array(46, 'Congo', 'CG', 'COG', 1),
1189
-                array(47, 'North Korea', 'KP', 'PRK', 1),
1190
-                array(50, 'Costa Rica', 'CR', 'CRI', 1),
1191
-                array(51, 'Croatia', 'HR', 'HRV', 1),
1192
-                array(52, 'Cuba', 'CU', 'CUB', 1),
1193
-                array(173, 'Czech Republic', 'CZ', 'CZE', 1),
1194
-                array(53, 'Denmark', 'DK', 'DNK', 1),
1195
-                array(54, 'Djibouti', 'DJ', 'DJI', 1),
1196
-                array(55, 'Dominica', 'DM', 'DMA', 1),
1197
-                array(174, 'Dominican Republic', 'DO', 'DOM', 1),
1198
-                array(56, 'Ecuador', 'EC', 'ECU', 1),
1199
-                array(57, 'Egypt', 'EG', 'EGY', 1),
1200
-                array(58, 'El Salvador', 'SV', 'SLV', 1),
1201
-                array(60, 'Eritrea', 'ER', 'ERI', 1),
1202
-                array(61, 'Slovakia', 'SK', 'SVK', 2),
1203
-                array(62, 'Slovenia', 'SI', 'SVN', 2),
1204
-                array(65, 'Estonia', 'EE', 'EST', 2),
1205
-                array(66, 'Ethiopia', 'ET', 'ETH', 1),
1206
-                array(102, 'Faroe islands', 'FO', 'FRO', 1),
1207
-                array(103, 'Falkland Islands', 'FK', 'FLK', 1),
1208
-                array(67, 'Fiji', 'FJ', 'FJI', 1),
1209
-                array(69, 'Finland', 'FI', 'FIN', 2),
1210
-                array(71, 'Gabon', 'GA', 'GAB', 1),
1211
-                array(72, 'Gambia', 'GM', 'GMB', 1),
1212
-                array(73, 'Georgia', 'GE', 'GEO', 1),
1213
-                array(74, 'Ghana', 'GH', 'GHA', 1),
1214
-                array(75, 'Gibraltar', 'GI', 'GIB', 1),
1215
-                array(76, 'Greece', 'GR', 'GRC', 2),
1216
-                array(77, 'Grenada', 'GD', 'GRD', 1),
1217
-                array(78, 'Greenland', 'GL', 'GRL', 1),
1218
-                array(79, 'Guadeloupe', 'GP', 'GLP', 1),
1219
-                array(80, 'Guam', 'GU', 'GUM', 1),
1220
-                array(81, 'Guatemala', 'GT', 'GTM', 1),
1221
-                array(82, 'Guinea', 'GN', 'GIN', 1),
1222
-                array(83, 'Equatorial Guinea', 'GQ', 'GNQ', 1),
1223
-                array(84, 'Guinea-Bissau', 'GW', 'GNB', 1),
1224
-                array(85, 'Guyana', 'GY', 'GUY', 1),
1225
-                array(86, 'Haiti', 'HT', 'HTI', 1),
1226
-                array(88, 'Honduras', 'HN', 'HND', 1),
1227
-                array(89, 'Hong Kong', 'HK', 'HKG', 1),
1228
-                array(90, 'Hungary', 'HU', 'HUN', 1),
1229
-                array(91, 'India', 'IN', 'IND', 1),
1230
-                array(205, 'British Indian Ocean Territory', 'IO', 'IOT', 1),
1231
-                array(92, 'Indonesia', 'ID', 'IDN', 1),
1232
-                array(93, 'Iraq', 'IQ', 'IRQ', 1),
1233
-                array(94, 'Iran', 'IR', 'IRN', 1),
1234
-                array(95, 'Ireland', 'IE', 'IRL', 2),
1235
-                array(97, 'Iceland', 'IS', 'ISL', 1),
1236
-                array(110, 'Israel', 'IL', 'ISR', 1),
1237
-                array(49, 'Ivory Coast ', 'CI', 'CIV', 1),
1238
-                array(112, 'Jamaica', 'JM', 'JAM', 1),
1239
-                array(113, 'Japan', 'JP', 'JPN', 1),
1240
-                array(114, 'Jordan', 'JO', 'JOR', 1),
1241
-                array(115, 'Kazakhstan', 'KZ', 'KAZ', 1),
1242
-                array(116, 'Kenya', 'KE', 'KEN', 1),
1243
-                array(117, 'Kyrgyzstan', 'KG', 'KGZ', 1),
1244
-                array(118, 'Kiribati', 'KI', 'KIR', 1),
1245
-                array(48, 'South Korea', 'KR', 'KOR', 1),
1246
-                array(228, 'Kosovo', 'XK', 'XKV', 2),
1247
-                // there is no official ISO code for Kosovo yet (http://geonames.wordpress.com/2010/03/08/xk-country-code-for-kosovo/) so using a temporary country code and a modified 3 character code for ISO code -- this should be updated if/when Kosovo gets its own ISO code
1248
-                array(119, 'Kuwait', 'KW', 'KWT', 1),
1249
-                array(120, 'Laos', 'LA', 'LAO', 1),
1250
-                array(121, 'Latvia', 'LV', 'LVA', 2),
1251
-                array(122, 'Lesotho', 'LS', 'LSO', 1),
1252
-                array(123, 'Lebanon', 'LB', 'LBN', 1),
1253
-                array(124, 'Liberia', 'LR', 'LBR', 1),
1254
-                array(125, 'Libya', 'LY', 'LBY', 1),
1255
-                array(126, 'Liechtenstein', 'LI', 'LIE', 1),
1256
-                array(127, 'Lithuania', 'LT', 'LTU', 2),
1257
-                array(128, 'Luxemburg', 'LU', 'LUX', 2),
1258
-                array(129, 'Macao', 'MO', 'MAC', 1),
1259
-                array(130, 'Macedonia', 'MK', 'MKD', 1),
1260
-                array(131, 'Madagascar', 'MG', 'MDG', 1),
1261
-                array(132, 'Malaysia', 'MY', 'MYS', 1),
1262
-                array(133, 'Malawi', 'MW', 'MWI', 1),
1263
-                array(134, 'Maldivas', 'MV', 'MDV', 1),
1264
-                array(135, 'Mali', 'ML', 'MLI', 1),
1265
-                array(136, 'Malta', 'MT', 'MLT', 2),
1266
-                array(101, 'Northern Marianas', 'MP', 'MNP', 1),
1267
-                array(137, 'Morocco', 'MA', 'MAR', 1),
1268
-                array(104, 'Marshall islands', 'MH', 'MHL', 1),
1269
-                array(138, 'Martinique', 'MQ', 'MTQ', 1),
1270
-                array(139, 'Mauritius', 'MU', 'MUS', 1),
1271
-                array(140, 'Mauritania', 'MR', 'MRT', 1),
1272
-                array(141, 'Mayote', 'YT', 'MYT', 2),
1273
-                array(142, 'Mexico', 'MX', 'MEX', 1),
1274
-                array(143, 'Micronesia', 'FM', 'FSM', 1),
1275
-                array(144, 'Moldova', 'MD', 'MDA', 1),
1276
-                array(145, 'Monaco', 'MC', 'MCO', 2),
1277
-                array(146, 'Mongolia', 'MN', 'MNG', 1),
1278
-                array(147, 'Montserrat', 'MS', 'MSR', 1),
1279
-                array(227, 'Montenegro', 'ME', 'MNE', 2),
1280
-                array(148, 'Mozambique', 'MZ', 'MOZ', 1),
1281
-                array(149, 'Myanmar', 'MM', 'MMR', 1),
1282
-                array(150, 'Namibia', 'NA', 'NAM', 1),
1283
-                array(151, 'Nauru', 'NR', 'NRU', 1),
1284
-                array(152, 'Nepal', 'NP', 'NPL', 1),
1285
-                array(9, 'Netherlands Antilles', 'AN', 'ANT', 1),
1286
-                array(153, 'Nicaragua', 'NI', 'NIC', 1),
1287
-                array(154, 'Niger', 'NE', 'NER', 1),
1288
-                array(155, 'Nigeria', 'NG', 'NGA', 1),
1289
-                array(156, 'Niue', 'NU', 'NIU', 1),
1290
-                array(157, 'Norway', 'NO', 'NOR', 1),
1291
-                array(158, 'New Caledonia', 'NC', 'NCL', 1),
1292
-                array(159, 'New Zealand', 'NZ', 'NZL', 1),
1293
-                array(160, 'Oman', 'OM', 'OMN', 1),
1294
-                array(161, 'Pakistan', 'PK', 'PAK', 1),
1295
-                array(162, 'Palau', 'PW', 'PLW', 1),
1296
-                array(163, 'Panama', 'PA', 'PAN', 1),
1297
-                array(164, 'Papua New Guinea', 'PG', 'PNG', 1),
1298
-                array(165, 'Paraguay', 'PY', 'PRY', 1),
1299
-                array(166, 'Peru', 'PE', 'PER', 1),
1300
-                array(68, 'Philippines', 'PH', 'PHL', 1),
1301
-                array(167, 'Poland', 'PL', 'POL', 1),
1302
-                array(168, 'Portugal', 'PT', 'PRT', 2),
1303
-                array(169, 'Puerto Rico', 'PR', 'PRI', 1),
1304
-                array(170, 'Qatar', 'QA', 'QAT', 1),
1305
-                array(176, 'Rwanda', 'RW', 'RWA', 1),
1306
-                array(177, 'Romania', 'RO', 'ROM', 2),
1307
-                array(178, 'Russia', 'RU', 'RUS', 1),
1308
-                array(229, 'Saint Pierre and Miquelon', 'PM', 'SPM', 2),
1309
-                array(180, 'Samoa', 'WS', 'WSM', 1),
1310
-                array(181, 'American Samoa', 'AS', 'ASM', 1),
1311
-                array(183, 'San Marino', 'SM', 'SMR', 2),
1312
-                array(184, 'Saint Vincent and the Grenadines', 'VC', 'VCT', 1),
1313
-                array(185, 'Saint Helena', 'SH', 'SHN', 1),
1314
-                array(186, 'Saint Lucia', 'LC', 'LCA', 1),
1315
-                array(188, 'Senegal', 'SN', 'SEN', 1),
1316
-                array(189, 'Seychelles', 'SC', 'SYC', 1),
1317
-                array(190, 'Sierra Leona', 'SL', 'SLE', 1),
1318
-                array(191, 'Singapore', 'SG', 'SGP', 1),
1319
-                array(192, 'Syria', 'SY', 'SYR', 1),
1320
-                array(193, 'Somalia', 'SO', 'SOM', 1),
1321
-                array(194, 'Sri Lanka', 'LK', 'LKA', 1),
1322
-                array(195, 'South Africa', 'ZA', 'ZAF', 1),
1323
-                array(196, 'Sudan', 'SD', 'SDN', 1),
1324
-                array(199, 'Suriname', 'SR', 'SUR', 1),
1325
-                array(200, 'Swaziland', 'SZ', 'SWZ', 1),
1326
-                array(201, 'Thailand', 'TH', 'THA', 1),
1327
-                array(202, 'Taiwan', 'TW', 'TWN', 1),
1328
-                array(203, 'Tanzania', 'TZ', 'TZA', 1),
1329
-                array(204, 'Tajikistan', 'TJ', 'TJK', 1),
1330
-                array(206, 'Timor-Leste', 'TL', 'TLS', 1),
1331
-                array(207, 'Togo', 'TG', 'TGO', 1),
1332
-                array(208, 'Tokelau', 'TK', 'TKL', 1),
1333
-                array(209, 'Tonga', 'TO', 'TON', 1),
1334
-                array(210, 'Trinidad and Tobago', 'TT', 'TTO', 1),
1335
-                array(211, 'Tunisia', 'TN', 'TUN', 1),
1336
-                array(212, 'Turkmenistan', 'TM', 'TKM', 1),
1337
-                array(213, 'Turkey', 'TR', 'TUR', 1),
1338
-                array(214, 'Tuvalu', 'TV', 'TUV', 1),
1339
-                array(215, 'Ukraine', 'UA', 'UKR', 1),
1340
-                array(216, 'Uganda', 'UG', 'UGA', 1),
1341
-                array(59, 'United Arab Emirates', 'AE', 'ARE', 1),
1342
-                array(217, 'Uruguay', 'UY', 'URY', 1),
1343
-                array(218, 'Uzbekistan', 'UZ', 'UZB', 1),
1344
-                array(219, 'Vanuatu', 'VU', 'VUT', 1),
1345
-                array(220, 'Vatican City', 'VA', 'VAT', 2),
1346
-                array(221, 'Venezuela', 'VE', 'VEN', 1),
1347
-                array(222, 'Vietnam', 'VN', 'VNM', 1),
1348
-                array(108, 'Virgin Islands', 'VI', 'VIR', 1),
1349
-                array(223, 'Yemen', 'YE', 'YEM', 1),
1350
-                array(225, 'Zambia', 'ZM', 'ZMB', 1),
1351
-                array(226, 'Zimbabwe', 'ZW', 'ZWE', 1),
1352
-        );
1353
-        $country_iso = 'US';
1354
-        foreach ($old_countries as $country_array) {
1355
-            //note: index 0 is the 3.1 country ID
1356
-            if ($country_array[0] == $country_id) {
1357
-                //note: index 2 is the ISO
1358
-                $country_iso = $country_array[2];
1359
-                break;
1360
-            }
1361
-        }
1362
-        return $country_iso;
1363
-    }
1364
-
1365
-
1366
-
1367
-    /**
1368
-     * Gets the ISO3 for the
1369
-     *
1370
-     * @return string
1371
-     */
1372
-    public function get_default_country_iso()
1373
-    {
1374
-        $old_org_options = get_option('events_organization_settings');
1375
-        $iso = $this->get_iso_from_3_1_country_id($old_org_options['organization_country']);
1376
-        return $iso;
1377
-    }
1378
-
1379
-
1380
-
1381
-    /**
1382
-     * Converst a 3.1 payment status to its equivalent 4.1 regisration status
1383
-     *
1384
-     * @param string  $payment_status                   possible value for 3.1's evens_attendee.payment_status
1385
-     * @param boolean $this_thing_required_pre_approval whether the thing we're considering (the general setting's
1386
-     *                                                  DEFAULT payment status, the event's DEFAULT payment status, or
1387
-     *                                                  the attendee's payment status) required pre-approval.
1388
-     * @return string STS_ID for use in 4.1
1389
-     */
1390
-    public function convert_3_1_payment_status_to_4_1_STS_ID($payment_status, $this_thing_required_pre_approval = false)
1391
-    {
1392
-        //EE team can read the related discussion: https://app.asana.com/0/2400967562914/9418495544455
1393
-        if ($this_thing_required_pre_approval) {
1394
-            return 'RNA';
1395
-        } else {
1396
-            $mapping = $default_reg_stati_conversions = array(
1397
-                    'Completed'        => 'RAP',
1398
-                    ''                 => 'RPP',
1399
-                    'Incomplete'       => 'RPP',
1400
-                    'Pending'          => 'RAP',
1401
-                    //stati that only occurred on 3.1 attendees:
1402
-                    'Payment Declined' => 'RPP',
1403
-                    'Not Completed'    => 'RPP',
1404
-                    'Cancelled'        => 'RPP',
1405
-                    'Declined'         => 'RPP',
1406
-            );
1407
-        }
1408
-        return isset($mapping[$payment_status]) ? $mapping[$payment_status] : 'RNA';
1409
-    }
1410
-
1411
-
1412
-
1413
-    /**
1414
-     * Makes sure the 3.1's image url is converted to an image attachment post to the 4.1 CPT event
1415
-     * and sets it as the featured image on the CPT event
1416
-     *
1417
-     * @param type                            $old_event
1418
-     * @param type                            $new_cpt_id
1419
-     * @param  EE_Data_Migration_Script_Stage $migration_stage the stage which called this, where errors should be added
1420
-     * @return boolean whether or not we had to do the big job of creating an image attachment
1421
-     */
1422
-    public function convert_image_url_to_attachment_and_attach_to_post(
1423
-            $guid,
1424
-            $new_cpt_id,
1425
-            EE_Data_Migration_Script_Stage $migration_stage
1426
-    ) {
1427
-        $created_attachment_post = false;
1428
-        $guid = $this->_get_original_guid($guid);
1429
-        if ($guid) {
1430
-            //check for an existing attachment post with this guid
1431
-            $attachment_post_id = $this->_get_image_attachment_id_by_GUID($guid);
1432
-            if ( ! $attachment_post_id) {
1433
-                //post thumbnail with that GUID doesn't exist, we should create one
1434
-                $attachment_post_id = $this->_create_image_attachment_from_GUID($guid, $migration_stage);
1435
-                $created_attachment_post = true;
1436
-            }
1437
-            //double-check we actually have an attachment post
1438
-            if ($attachment_post_id) {
1439
-                update_post_meta($new_cpt_id, '_thumbnail_id', $attachment_post_id);
1440
-            } else {
1441
-                $migration_stage->add_error(sprintf(esc_html__("Could not update event image %s for CPT with ID %d, but attachments post ID is %d",
1442
-                        "event_espresso"), $guid, $new_cpt_id, $attachment_post_id));
1443
-            }
1444
-        }
1445
-        return $created_attachment_post;
1446
-    }
1447
-
1448
-
1449
-
1450
-    /**
1451
-     * In 3.1, the event thumbnail image DOESN'T point to the orignal image, but instead
1452
-     * to a large thumbnail (which has nearly the same GUID, except it adds "-{width}x{height}" before the filetype,
1453
-     * or whatever dimensions it is. Eg 'http://mysite.com/image1-300x400.jpg' instead of
1454
-     * 'http://mysite.com/image1.jpg' ). This function attempts to strip that off and get the original file, if it
1455
-     * exists
1456
-     *
1457
-     * @param string $guid_in_old_event
1458
-     * @return string either the original guid, or $guid_in_old_event if we couldn't figure out what the original was
1459
-     */
1460
-    private function _get_original_guid($guid_in_old_event)
1461
-    {
1462
-        $original_guid = preg_replace('~-\d*x\d*\.~', '.', $guid_in_old_event, 1);
1463
-        //do a head request to verify the file exists
1464
-        $head_response = wp_remote_head($original_guid);
1465
-        if ( ! $head_response instanceof WP_Error && $head_response['response']['message'] == 'OK') {
1466
-            return $original_guid;
1467
-        } else {
1468
-            return $guid_in_old_event;
1469
-        }
1470
-    }
1471
-
1472
-
1473
-
1474
-    /**
1475
-     * Creates an image attachment post for the GUID. If the GUID points to a remote image,
1476
-     * we download it to our uploads directory so that it can be properly processed (eg, creates different sizes of
1477
-     * thumbnails)
1478
-     *
1479
-     * @param type                           $guid
1480
-     * @param EE_Data_Migration_Script_Stage $migration_stage
1481
-     * @return int
1482
-     */
1483
-    private function _create_image_attachment_from_GUID($guid, EE_Data_Migration_Script_Stage $migration_stage)
1484
-    {
1485
-        if ( ! $guid) {
1486
-            $migration_stage->add_error(sprintf(esc_html__("Cannot create image attachment for a blank GUID!",
1487
-                    "event_espresso")));
1488
-            return 0;
1489
-        }
1490
-        $wp_filetype = wp_check_filetype(basename($guid), null);
1491
-        $wp_upload_dir = wp_upload_dir();
1492
-        //if the file is located remotely, download it to our uploads DIR, because wp_genereate_attachmnet_metadata needs the file to be local
1493
-        if (strpos($guid, $wp_upload_dir['url']) === false) {
1494
-            //image is located remotely. download it and place it in the uploads directory
1495
-            if ( ! is_readable($guid)) {
1496
-                $migration_stage->add_error(sprintf(esc_html__("Could not create image attachment from non-existent file: %s",
1497
-                        "event_espresso"), $guid));
1498
-                return 0;
1499
-            }
1500
-            $contents = file_get_contents($guid);
1501
-            if ($contents === false) {
1502
-                $migration_stage->add_error(sprintf(esc_html__("Could not read image at %s, and therefore couldnt create an attachment post for it.",
1503
-                        "event_espresso"), $guid));
1504
-                return false;
1505
-            }
1506
-            $local_filepath = $wp_upload_dir['path'] . DS . basename($guid);
1507
-            $savefile = fopen($local_filepath, 'w');
1508
-            fwrite($savefile, $contents);
1509
-            fclose($savefile);
1510
-            $guid = str_replace($wp_upload_dir['path'], $wp_upload_dir['url'], $local_filepath);
1511
-        } else {
1512
-            $local_filepath = str_replace($wp_upload_dir['url'], $wp_upload_dir['path'], $guid);
1513
-        }
1514
-        $attachment = array(
1515
-                'guid'           => $guid,
1516
-                'post_mime_type' => $wp_filetype['type'],
1517
-                'post_title'     => preg_replace('/\.[^.]+$/', '', basename($guid)),
1518
-                'post_content'   => '',
1519
-                'post_status'    => 'inherit',
1520
-        );
1521
-        $attach_id = wp_insert_attachment($attachment, $guid);
1522
-        if ( ! $attach_id) {
1523
-            $migration_stage->add_error(sprintf(esc_html__("Could not create image attachment post from image '%s'. Attachment data was %s.",
1524
-                    "event_espresso"), $guid, $this->_json_encode($attachment)));
1525
-            return $attach_id;
1526
-        }
1527
-        // you must first include the image.php file
1528
-        // for the function wp_generate_attachment_metadata() to work
1529
-        require_once(ABSPATH . 'wp-admin/includes/image.php');
1530
-        $attach_data = wp_generate_attachment_metadata($attach_id, $local_filepath);
1531
-        if ( ! $attach_data) {
1532
-            $migration_stage->add_error(sprintf(esc_html__("Coudl not genereate attachment metadata for attachment post %d with filepath %s and GUID %s. Please check the file was downloaded properly.",
1533
-                    "event_espresso"), $attach_id, $local_filepath, $guid));
1534
-            return $attach_id;
1535
-        }
1536
-        $metadata_save_result = wp_update_attachment_metadata($attach_id, $attach_data);
1537
-        if ( ! $metadata_save_result) {
1538
-            $migration_stage->add_error(sprintf(esc_html__("Could not update attachment metadata for attachment %d with data %s",
1539
-                    "event_espresso"), $attach_id, $this->_json_encode($attach_data)));
1540
-        }
1541
-        return $attach_id;
1542
-    }
1543
-
1544
-
1545
-
1546
-    /**
1547
-     * Finds the attachment post containing info about an image attachment given the GUID (link to the image itself),
1548
-     * and returns its ID.
1549
-     *
1550
-     * @global type  $wpdb
1551
-     * @param string $guid
1552
-     * @return int
1553
-     */
1554
-    private function _get_image_attachment_id_by_GUID($guid)
1555
-    {
1556
-        global $wpdb;
1557
-        $attachment_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE guid=%s LIMIT 1", $guid));
1558
-        return $attachment_id;
1559
-    }
1560
-
1561
-
1562
-
1563
-    /**
1564
-     * Returns a mysql-formatted DATETIME in UTC time, given a $DATETIME_string
1565
-     * (and optionally a timezone; if none is given, the wp DEFAULT is used)
1566
-     *
1567
-     * @param EE_Data_Migration_Script_base $stage
1568
-     * @param array                         $row_of_data , the row from the DB (as an array) we're trying to find the
1569
-     *                                                   UTC time for
1570
-     * @param string                        $DATETIME_string
1571
-     * @param string                        $timezone
1572
-     * @return string
1573
-     */
1574
-    public function convert_date_string_to_utc(
1575
-            EE_Data_Migration_Script_Stage $stage,
1576
-            $row_of_data,
1577
-            $DATETIME_string,
1578
-            $timezone = null
1579
-    ) {
1580
-        $original_tz = $timezone;
1581
-        if ( ! $timezone) {
1582
-            $timezone = $this->_get_wp_timezone();
1583
-        }
1584
-        if ( ! $timezone) {
1585
-            $stage->add_error(sprintf(esc_html__("Could not find timezone given %s for %s", "event_espresso"), $original_tz,
1586
-                    $row_of_data));
1587
-            $timezone = 'UTC';
1588
-        }
1589
-        try {
1590
-            $date_obj = new DateTime($DATETIME_string, new DateTimeZone($timezone));
1591
-            $date_obj->setTimezone(new DateTimeZone('UTC'));
1592
-        } catch (Exception $e) {
1593
-            $stage->add_error(sprintf(esc_html__("Could not convert time string '%s' using timezone '%s' into a proper DATETIME. Using current time instead.",
1594
-                    "event_espresso"), $DATETIME_string, $timezone));
1595
-            $date_obj = new DateTime();
1596
-        }
1597
-        return $date_obj->format('Y-m-d H:i:s');
1598
-    }
1599
-
1600
-
1601
-
1602
-    /**
1603
-     * Gets the DEFAULT timezone string from wordpress (even if they set a gmt offset)
1604
-     *
1605
-     * @return string
1606
-     */
1607
-    private function _get_wp_timezone()
1608
-    {
1609
-        $timezone = empty($timezone) ? get_option('timezone_string') : $timezone;
1610
-        //if timezone is STILL empty then let's get the GMT offset and then set the timezone_string using our converter
1611
-        if (empty($timezone)) {
1612
-            //let's get a the WordPress UTC offset
1613
-            $offset = get_option('gmt_offset');
1614
-            $timezone = $this->timezone_convert_to_string_from_offset($offset);
1615
-        }
1616
-        return $timezone;
1617
-    }
1618
-
1619
-
1620
-
1621
-    /**
1622
-     * Gets the wordpress timezone string from a UTC offset
1623
-     *
1624
-     * @param int $offset
1625
-     * @return boolean
1626
-     */
1627
-    private function timezone_convert_to_string_from_offset($offset)
1628
-    {
1629
-        //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
1630
-        $offset *= 3600; // convert hour offset to seconds
1631
-        $abbrarray = timezone_abbreviations_list();
1632
-        foreach ($abbrarray as $abbr) {
1633
-            foreach ($abbr as $city) {
1634
-                if ($city['offset'] == $offset) {
1635
-                    return $city['timezone_id'];
1636
-                }
1637
-            }
1638
-        }
1639
-        return false;
1640
-    }
1641
-
1642
-
1643
-
1644
-    public function migration_page_hooks()
1645
-    {
1646
-        add_filter(
1647
-                'FHEE__ee_migration_page__header',
1648
-                array($this, '_migrate_page_hook_simplify_version_strings'),
1649
-                10,
1650
-                3
1651
-        );
1652
-        add_filter(
1653
-                'FHEE__ee_migration_page__p_after_header',
1654
-                array($this, '_migration_page_hook_simplify_next_db_state'),
1655
-                10,
1656
-                2
1657
-        );
1658
-        add_filter(
1659
-                'FHEE__ee_migration_page__option_1_main',
1660
-                array($this, '_migrate_page_hook_simplify_version_strings'),
1661
-                10,
1662
-                3
1663
-        );
1664
-        add_filter(
1665
-                'FHEE__ee_migration_page__option_1_button_text',
1666
-                array($this, '_migrate_page_hook_simplify_version_strings'),
1667
-                10,
1668
-                3
1669
-        );
1670
-        add_action(
1671
-                'AHEE__ee_migration_page__option_1_extra_details',
1672
-                array($this, '_migration_page_hook_option_1_extra_details'),
1673
-                10,
1674
-                3
1675
-        );
1676
-        add_filter(
1677
-                'FHEE__ee_migration_page__option_2_main',
1678
-                array($this, '_migrate_page_hook_simplify_version_strings'),
1679
-                10,
1680
-                4
1681
-        );
1682
-        add_filter(
1683
-                'FHEE__ee_migration_page__option_2_button_text',
1684
-                array($this, '_migration_page_hook_simplify_next_db_state'),
1685
-                10,
1686
-                2
1687
-        );
1688
-        add_filter(
1689
-                'FHEE__ee_migration_page__option_2_details',
1690
-                array($this, '_migration_page_hook_simplify_next_db_state'),
1691
-                10,
1692
-                2
1693
-        );
1694
-        add_action(
1695
-                'AHEE__ee_migration_page__after_migration_options_table',
1696
-                array($this, '_migration_page_hook_after_migration_options_table')
1697
-        );
1698
-        add_filter(
1699
-                'FHEE__ee_migration_page__done_migration_header',
1700
-                array($this, '_migration_page_hook_simplify_next_db_state'),
1701
-                10,
1702
-                2
1703
-        );
1704
-        add_filter(
1705
-                'FHEE__ee_migration_page__p_after_done_migration_header',
1706
-                array($this, '_migration_page_hook_simplify_next_db_state'),
1707
-                10,
1708
-                2
1709
-        );
1710
-        add_filter(
1711
-                'FHEE__ee_migration_page__migration_options_template',
1712
-                array($this,'use_migration_options_from_ee3_template')
1713
-        );
1714
-    }
1715
-
1716
-
1717
-
1718
-    public function _migrate_page_hook_simplify_version_strings(
1719
-            $old_content,
1720
-            $current_db_state,
1721
-            $next_db_state,
1722
-            $ultimate_db_state = null
1723
-    ) {
1724
-        return str_replace(array($current_db_state, $next_db_state, $ultimate_db_state),
1725
-                array(esc_html__('EE3', 'event_espresso'), esc_html__('EE4', 'event_espresso'), esc_html__("EE4", 'event_espresso')),
1726
-                $old_content);
1727
-    }
1728
-
1729
-
1730
-
1731
-    public function _migration_page_hook_simplify_next_db_state($old_content, $next_db_state)
1732
-    {
1733
-        return str_replace($next_db_state, esc_html__("EE4", 'event_espresso'), $old_content);
1734
-    }
1735
-
1736
-
1737
-
1738
-    public function _migration_page_hook_option_1_extra_details()
1739
-    {
1740
-        ?>
1063
+		if ( ! $state) {
1064
+			//insert a new one then
1065
+			$cols_n_values = array(
1066
+					'CNT_ISO'    => $country_iso,
1067
+					'STA_abbrev' => substr($state_name, 0, 6),
1068
+					'STA_name'   => $state_name,
1069
+					'STA_active' => true,
1070
+			);
1071
+			$data_types = array(
1072
+					'%s',//CNT_ISO
1073
+					'%s',//STA_abbrev
1074
+					'%s',//STA_name
1075
+					'%d',//STA_active
1076
+			);
1077
+			$success = $wpdb->insert($state_table, $cols_n_values, $data_types);
1078
+			if ( ! $success) {
1079
+				throw new EE_Error($this->_create_error_message_for_db_insertion('N/A',
1080
+						array('state' => $state_name, 'country_id' => $country_name), $state_table, $cols_n_values,
1081
+						$data_types));
1082
+			}
1083
+			$state = $cols_n_values;
1084
+			$state['STA_ID'] = $wpdb->insert_id;
1085
+		}
1086
+		return $state;
1087
+	}
1088
+
1089
+
1090
+
1091
+	/**
1092
+	 * Fixes times like "5:00 PM" into the expected 24-hour format "17:00".
1093
+	 * THis is actually just copied from the 3.1 JSON API because it needed to do the exact same thing
1094
+	 *
1095
+	 * @param type $timeString
1096
+	 * @return string in the php DATETIME format: "G:i" (24-hour format hour with leading zeros, a colon, and minutes
1097
+	 *                with leading zeros)
1098
+	 */
1099
+	public function convertTimeFromAMPM($timeString)
1100
+	{
1101
+		$matches = array();
1102
+		preg_match("~(\\d*):(\\d*)~", $timeString, $matches);
1103
+		if ( ! $matches || count($matches) < 3) {
1104
+			$hour = '00';
1105
+			$minutes = '00';
1106
+		} else {
1107
+			$hour = intval($matches[1]);
1108
+			$minutes = $matches[2];
1109
+		}
1110
+		if (strpos($timeString, 'PM') || strpos($timeString, 'pm')) {
1111
+			$hour = intval($hour) + 12;
1112
+		}
1113
+		$hour = str_pad("$hour", 2, '0', STR_PAD_LEFT);
1114
+		$minutes = str_pad("$minutes", 2, '0', STR_PAD_LEFT);
1115
+		return "$hour:$minutes";
1116
+	}
1117
+
1118
+
1119
+
1120
+	/**
1121
+	 * Gets the ISO3 fora country given its 3.1 country ID.
1122
+	 *
1123
+	 * @param int $country_id
1124
+	 * @return string the country's ISO3 code
1125
+	 */
1126
+	public function get_iso_from_3_1_country_id($country_id)
1127
+	{
1128
+		$old_countries = array(
1129
+				array(64, 'United States', 'US', 'USA', 1),
1130
+				array(15, 'Australia', 'AU', 'AUS', 1),
1131
+				array(39, 'Canada', 'CA', 'CAN', 1),
1132
+				array(171, 'United Kingdom', 'GB', 'GBR', 1),
1133
+				array(70, 'France', 'FR', 'FRA', 2),
1134
+				array(111, 'Italy', 'IT', 'ITA', 2),
1135
+				array(63, 'Spain', 'ES', 'ESP', 2),
1136
+				array(1, 'Afghanistan', 'AF', 'AFG', 1),
1137
+				array(2, 'Albania', 'AL', 'ALB', 1),
1138
+				array(3, 'Germany', 'DE', 'DEU', 2),
1139
+				array(198, 'Switzerland', 'CH', 'CHE', 1),
1140
+				array(87, 'Netherlands', 'NL', 'NLD', 2),
1141
+				array(197, 'Sweden', 'SE', 'SWE', 1),
1142
+				array(230, 'Akrotiri and Dhekelia', 'CY', 'CYP', 2),
1143
+				array(4, 'Andorra', 'AD', 'AND', 2),
1144
+				array(5, 'Angola', 'AO', 'AGO', 1),
1145
+				array(6, 'Anguilla', 'AI', 'AIA', 1),
1146
+				array(7, 'Antarctica', 'AQ', 'ATA', 1),
1147
+				array(8, 'Antigua and Barbuda', 'AG', 'ATG', 1),
1148
+				array(10, 'Saudi Arabia', 'SA', 'SAU', 1),
1149
+				array(11, 'Algeria', 'DZ', 'DZA', 1),
1150
+				array(12, 'Argentina', 'AR', 'ARG', 1),
1151
+				array(13, 'Armenia', 'AM', 'ARM', 1),
1152
+				array(14, 'Aruba', 'AW', 'ABW', 1),
1153
+				array(16, 'Austria', 'AT', 'AUT', 2),
1154
+				array(17, 'Azerbaijan', 'AZ', 'AZE', 1),
1155
+				array(18, 'Bahamas', 'BS', 'BHS', 1),
1156
+				array(19, 'Bahrain', 'BH', 'BHR', 1),
1157
+				array(20, 'Bangladesh', 'BD', 'BGD', 1),
1158
+				array(21, 'Barbados', 'BB', 'BRB', 1),
1159
+				array(22, 'Belgium ', 'BE', 'BEL', 2),
1160
+				array(23, 'Belize', 'BZ', 'BLZ', 1),
1161
+				array(24, 'Benin', 'BJ', 'BEN', 1),
1162
+				array(25, 'Bermudas', 'BM', 'BMU', 1),
1163
+				array(26, 'Belarus', 'BY', 'BLR', 1),
1164
+				array(27, 'Bolivia', 'BO', 'BOL', 1),
1165
+				array(28, 'Bosnia and Herzegovina', 'BA', 'BIH', 1),
1166
+				array(29, 'Botswana', 'BW', 'BWA', 1),
1167
+				array(96, 'Bouvet Island', 'BV', 'BVT', 1),
1168
+				array(30, 'Brazil', 'BR', 'BRA', 1),
1169
+				array(31, 'Brunei', 'BN', 'BRN', 1),
1170
+				array(32, 'Bulgaria', 'BG', 'BGR', 1),
1171
+				array(33, 'Burkina Faso', 'BF', 'BFA', 1),
1172
+				array(34, 'Burundi', 'BI', 'BDI', 1),
1173
+				array(35, 'Bhutan', 'BT', 'BTN', 1),
1174
+				array(36, 'Cape Verde', 'CV', 'CPV', 1),
1175
+				array(37, 'Cambodia', 'KH', 'KHM', 1),
1176
+				array(38, 'Cameroon', 'CM', 'CMR', 1),
1177
+				array(98, 'Cayman Islands', 'KY', 'CYM', 1),
1178
+				array(172, 'Central African Republic', 'CF', 'CAF', 1),
1179
+				array(40, 'Chad', 'TD', 'TCD', 1),
1180
+				array(41, 'Chile', 'CL', 'CHL', 1),
1181
+				array(42, 'China', 'CN', 'CHN', 1),
1182
+				array(105, 'Christmas Island', 'CX', 'CXR', 1),
1183
+				array(43, 'Cyprus', 'CY', 'CYP', 2),
1184
+				array(99, 'Cocos Island', 'CC', 'CCK', 1),
1185
+				array(100, 'Cook Islands', 'CK', 'COK', 1),
1186
+				array(44, 'Colombia', 'CO', 'COL', 1),
1187
+				array(45, 'Comoros', 'KM', 'COM', 1),
1188
+				array(46, 'Congo', 'CG', 'COG', 1),
1189
+				array(47, 'North Korea', 'KP', 'PRK', 1),
1190
+				array(50, 'Costa Rica', 'CR', 'CRI', 1),
1191
+				array(51, 'Croatia', 'HR', 'HRV', 1),
1192
+				array(52, 'Cuba', 'CU', 'CUB', 1),
1193
+				array(173, 'Czech Republic', 'CZ', 'CZE', 1),
1194
+				array(53, 'Denmark', 'DK', 'DNK', 1),
1195
+				array(54, 'Djibouti', 'DJ', 'DJI', 1),
1196
+				array(55, 'Dominica', 'DM', 'DMA', 1),
1197
+				array(174, 'Dominican Republic', 'DO', 'DOM', 1),
1198
+				array(56, 'Ecuador', 'EC', 'ECU', 1),
1199
+				array(57, 'Egypt', 'EG', 'EGY', 1),
1200
+				array(58, 'El Salvador', 'SV', 'SLV', 1),
1201
+				array(60, 'Eritrea', 'ER', 'ERI', 1),
1202
+				array(61, 'Slovakia', 'SK', 'SVK', 2),
1203
+				array(62, 'Slovenia', 'SI', 'SVN', 2),
1204
+				array(65, 'Estonia', 'EE', 'EST', 2),
1205
+				array(66, 'Ethiopia', 'ET', 'ETH', 1),
1206
+				array(102, 'Faroe islands', 'FO', 'FRO', 1),
1207
+				array(103, 'Falkland Islands', 'FK', 'FLK', 1),
1208
+				array(67, 'Fiji', 'FJ', 'FJI', 1),
1209
+				array(69, 'Finland', 'FI', 'FIN', 2),
1210
+				array(71, 'Gabon', 'GA', 'GAB', 1),
1211
+				array(72, 'Gambia', 'GM', 'GMB', 1),
1212
+				array(73, 'Georgia', 'GE', 'GEO', 1),
1213
+				array(74, 'Ghana', 'GH', 'GHA', 1),
1214
+				array(75, 'Gibraltar', 'GI', 'GIB', 1),
1215
+				array(76, 'Greece', 'GR', 'GRC', 2),
1216
+				array(77, 'Grenada', 'GD', 'GRD', 1),
1217
+				array(78, 'Greenland', 'GL', 'GRL', 1),
1218
+				array(79, 'Guadeloupe', 'GP', 'GLP', 1),
1219
+				array(80, 'Guam', 'GU', 'GUM', 1),
1220
+				array(81, 'Guatemala', 'GT', 'GTM', 1),
1221
+				array(82, 'Guinea', 'GN', 'GIN', 1),
1222
+				array(83, 'Equatorial Guinea', 'GQ', 'GNQ', 1),
1223
+				array(84, 'Guinea-Bissau', 'GW', 'GNB', 1),
1224
+				array(85, 'Guyana', 'GY', 'GUY', 1),
1225
+				array(86, 'Haiti', 'HT', 'HTI', 1),
1226
+				array(88, 'Honduras', 'HN', 'HND', 1),
1227
+				array(89, 'Hong Kong', 'HK', 'HKG', 1),
1228
+				array(90, 'Hungary', 'HU', 'HUN', 1),
1229
+				array(91, 'India', 'IN', 'IND', 1),
1230
+				array(205, 'British Indian Ocean Territory', 'IO', 'IOT', 1),
1231
+				array(92, 'Indonesia', 'ID', 'IDN', 1),
1232
+				array(93, 'Iraq', 'IQ', 'IRQ', 1),
1233
+				array(94, 'Iran', 'IR', 'IRN', 1),
1234
+				array(95, 'Ireland', 'IE', 'IRL', 2),
1235
+				array(97, 'Iceland', 'IS', 'ISL', 1),
1236
+				array(110, 'Israel', 'IL', 'ISR', 1),
1237
+				array(49, 'Ivory Coast ', 'CI', 'CIV', 1),
1238
+				array(112, 'Jamaica', 'JM', 'JAM', 1),
1239
+				array(113, 'Japan', 'JP', 'JPN', 1),
1240
+				array(114, 'Jordan', 'JO', 'JOR', 1),
1241
+				array(115, 'Kazakhstan', 'KZ', 'KAZ', 1),
1242
+				array(116, 'Kenya', 'KE', 'KEN', 1),
1243
+				array(117, 'Kyrgyzstan', 'KG', 'KGZ', 1),
1244
+				array(118, 'Kiribati', 'KI', 'KIR', 1),
1245
+				array(48, 'South Korea', 'KR', 'KOR', 1),
1246
+				array(228, 'Kosovo', 'XK', 'XKV', 2),
1247
+				// there is no official ISO code for Kosovo yet (http://geonames.wordpress.com/2010/03/08/xk-country-code-for-kosovo/) so using a temporary country code and a modified 3 character code for ISO code -- this should be updated if/when Kosovo gets its own ISO code
1248
+				array(119, 'Kuwait', 'KW', 'KWT', 1),
1249
+				array(120, 'Laos', 'LA', 'LAO', 1),
1250
+				array(121, 'Latvia', 'LV', 'LVA', 2),
1251
+				array(122, 'Lesotho', 'LS', 'LSO', 1),
1252
+				array(123, 'Lebanon', 'LB', 'LBN', 1),
1253
+				array(124, 'Liberia', 'LR', 'LBR', 1),
1254
+				array(125, 'Libya', 'LY', 'LBY', 1),
1255
+				array(126, 'Liechtenstein', 'LI', 'LIE', 1),
1256
+				array(127, 'Lithuania', 'LT', 'LTU', 2),
1257
+				array(128, 'Luxemburg', 'LU', 'LUX', 2),
1258
+				array(129, 'Macao', 'MO', 'MAC', 1),
1259
+				array(130, 'Macedonia', 'MK', 'MKD', 1),
1260
+				array(131, 'Madagascar', 'MG', 'MDG', 1),
1261
+				array(132, 'Malaysia', 'MY', 'MYS', 1),
1262
+				array(133, 'Malawi', 'MW', 'MWI', 1),
1263
+				array(134, 'Maldivas', 'MV', 'MDV', 1),
1264
+				array(135, 'Mali', 'ML', 'MLI', 1),
1265
+				array(136, 'Malta', 'MT', 'MLT', 2),
1266
+				array(101, 'Northern Marianas', 'MP', 'MNP', 1),
1267
+				array(137, 'Morocco', 'MA', 'MAR', 1),
1268
+				array(104, 'Marshall islands', 'MH', 'MHL', 1),
1269
+				array(138, 'Martinique', 'MQ', 'MTQ', 1),
1270
+				array(139, 'Mauritius', 'MU', 'MUS', 1),
1271
+				array(140, 'Mauritania', 'MR', 'MRT', 1),
1272
+				array(141, 'Mayote', 'YT', 'MYT', 2),
1273
+				array(142, 'Mexico', 'MX', 'MEX', 1),
1274
+				array(143, 'Micronesia', 'FM', 'FSM', 1),
1275
+				array(144, 'Moldova', 'MD', 'MDA', 1),
1276
+				array(145, 'Monaco', 'MC', 'MCO', 2),
1277
+				array(146, 'Mongolia', 'MN', 'MNG', 1),
1278
+				array(147, 'Montserrat', 'MS', 'MSR', 1),
1279
+				array(227, 'Montenegro', 'ME', 'MNE', 2),
1280
+				array(148, 'Mozambique', 'MZ', 'MOZ', 1),
1281
+				array(149, 'Myanmar', 'MM', 'MMR', 1),
1282
+				array(150, 'Namibia', 'NA', 'NAM', 1),
1283
+				array(151, 'Nauru', 'NR', 'NRU', 1),
1284
+				array(152, 'Nepal', 'NP', 'NPL', 1),
1285
+				array(9, 'Netherlands Antilles', 'AN', 'ANT', 1),
1286
+				array(153, 'Nicaragua', 'NI', 'NIC', 1),
1287
+				array(154, 'Niger', 'NE', 'NER', 1),
1288
+				array(155, 'Nigeria', 'NG', 'NGA', 1),
1289
+				array(156, 'Niue', 'NU', 'NIU', 1),
1290
+				array(157, 'Norway', 'NO', 'NOR', 1),
1291
+				array(158, 'New Caledonia', 'NC', 'NCL', 1),
1292
+				array(159, 'New Zealand', 'NZ', 'NZL', 1),
1293
+				array(160, 'Oman', 'OM', 'OMN', 1),
1294
+				array(161, 'Pakistan', 'PK', 'PAK', 1),
1295
+				array(162, 'Palau', 'PW', 'PLW', 1),
1296
+				array(163, 'Panama', 'PA', 'PAN', 1),
1297
+				array(164, 'Papua New Guinea', 'PG', 'PNG', 1),
1298
+				array(165, 'Paraguay', 'PY', 'PRY', 1),
1299
+				array(166, 'Peru', 'PE', 'PER', 1),
1300
+				array(68, 'Philippines', 'PH', 'PHL', 1),
1301
+				array(167, 'Poland', 'PL', 'POL', 1),
1302
+				array(168, 'Portugal', 'PT', 'PRT', 2),
1303
+				array(169, 'Puerto Rico', 'PR', 'PRI', 1),
1304
+				array(170, 'Qatar', 'QA', 'QAT', 1),
1305
+				array(176, 'Rwanda', 'RW', 'RWA', 1),
1306
+				array(177, 'Romania', 'RO', 'ROM', 2),
1307
+				array(178, 'Russia', 'RU', 'RUS', 1),
1308
+				array(229, 'Saint Pierre and Miquelon', 'PM', 'SPM', 2),
1309
+				array(180, 'Samoa', 'WS', 'WSM', 1),
1310
+				array(181, 'American Samoa', 'AS', 'ASM', 1),
1311
+				array(183, 'San Marino', 'SM', 'SMR', 2),
1312
+				array(184, 'Saint Vincent and the Grenadines', 'VC', 'VCT', 1),
1313
+				array(185, 'Saint Helena', 'SH', 'SHN', 1),
1314
+				array(186, 'Saint Lucia', 'LC', 'LCA', 1),
1315
+				array(188, 'Senegal', 'SN', 'SEN', 1),
1316
+				array(189, 'Seychelles', 'SC', 'SYC', 1),
1317
+				array(190, 'Sierra Leona', 'SL', 'SLE', 1),
1318
+				array(191, 'Singapore', 'SG', 'SGP', 1),
1319
+				array(192, 'Syria', 'SY', 'SYR', 1),
1320
+				array(193, 'Somalia', 'SO', 'SOM', 1),
1321
+				array(194, 'Sri Lanka', 'LK', 'LKA', 1),
1322
+				array(195, 'South Africa', 'ZA', 'ZAF', 1),
1323
+				array(196, 'Sudan', 'SD', 'SDN', 1),
1324
+				array(199, 'Suriname', 'SR', 'SUR', 1),
1325
+				array(200, 'Swaziland', 'SZ', 'SWZ', 1),
1326
+				array(201, 'Thailand', 'TH', 'THA', 1),
1327
+				array(202, 'Taiwan', 'TW', 'TWN', 1),
1328
+				array(203, 'Tanzania', 'TZ', 'TZA', 1),
1329
+				array(204, 'Tajikistan', 'TJ', 'TJK', 1),
1330
+				array(206, 'Timor-Leste', 'TL', 'TLS', 1),
1331
+				array(207, 'Togo', 'TG', 'TGO', 1),
1332
+				array(208, 'Tokelau', 'TK', 'TKL', 1),
1333
+				array(209, 'Tonga', 'TO', 'TON', 1),
1334
+				array(210, 'Trinidad and Tobago', 'TT', 'TTO', 1),
1335
+				array(211, 'Tunisia', 'TN', 'TUN', 1),
1336
+				array(212, 'Turkmenistan', 'TM', 'TKM', 1),
1337
+				array(213, 'Turkey', 'TR', 'TUR', 1),
1338
+				array(214, 'Tuvalu', 'TV', 'TUV', 1),
1339
+				array(215, 'Ukraine', 'UA', 'UKR', 1),
1340
+				array(216, 'Uganda', 'UG', 'UGA', 1),
1341
+				array(59, 'United Arab Emirates', 'AE', 'ARE', 1),
1342
+				array(217, 'Uruguay', 'UY', 'URY', 1),
1343
+				array(218, 'Uzbekistan', 'UZ', 'UZB', 1),
1344
+				array(219, 'Vanuatu', 'VU', 'VUT', 1),
1345
+				array(220, 'Vatican City', 'VA', 'VAT', 2),
1346
+				array(221, 'Venezuela', 'VE', 'VEN', 1),
1347
+				array(222, 'Vietnam', 'VN', 'VNM', 1),
1348
+				array(108, 'Virgin Islands', 'VI', 'VIR', 1),
1349
+				array(223, 'Yemen', 'YE', 'YEM', 1),
1350
+				array(225, 'Zambia', 'ZM', 'ZMB', 1),
1351
+				array(226, 'Zimbabwe', 'ZW', 'ZWE', 1),
1352
+		);
1353
+		$country_iso = 'US';
1354
+		foreach ($old_countries as $country_array) {
1355
+			//note: index 0 is the 3.1 country ID
1356
+			if ($country_array[0] == $country_id) {
1357
+				//note: index 2 is the ISO
1358
+				$country_iso = $country_array[2];
1359
+				break;
1360
+			}
1361
+		}
1362
+		return $country_iso;
1363
+	}
1364
+
1365
+
1366
+
1367
+	/**
1368
+	 * Gets the ISO3 for the
1369
+	 *
1370
+	 * @return string
1371
+	 */
1372
+	public function get_default_country_iso()
1373
+	{
1374
+		$old_org_options = get_option('events_organization_settings');
1375
+		$iso = $this->get_iso_from_3_1_country_id($old_org_options['organization_country']);
1376
+		return $iso;
1377
+	}
1378
+
1379
+
1380
+
1381
+	/**
1382
+	 * Converst a 3.1 payment status to its equivalent 4.1 regisration status
1383
+	 *
1384
+	 * @param string  $payment_status                   possible value for 3.1's evens_attendee.payment_status
1385
+	 * @param boolean $this_thing_required_pre_approval whether the thing we're considering (the general setting's
1386
+	 *                                                  DEFAULT payment status, the event's DEFAULT payment status, or
1387
+	 *                                                  the attendee's payment status) required pre-approval.
1388
+	 * @return string STS_ID for use in 4.1
1389
+	 */
1390
+	public function convert_3_1_payment_status_to_4_1_STS_ID($payment_status, $this_thing_required_pre_approval = false)
1391
+	{
1392
+		//EE team can read the related discussion: https://app.asana.com/0/2400967562914/9418495544455
1393
+		if ($this_thing_required_pre_approval) {
1394
+			return 'RNA';
1395
+		} else {
1396
+			$mapping = $default_reg_stati_conversions = array(
1397
+					'Completed'        => 'RAP',
1398
+					''                 => 'RPP',
1399
+					'Incomplete'       => 'RPP',
1400
+					'Pending'          => 'RAP',
1401
+					//stati that only occurred on 3.1 attendees:
1402
+					'Payment Declined' => 'RPP',
1403
+					'Not Completed'    => 'RPP',
1404
+					'Cancelled'        => 'RPP',
1405
+					'Declined'         => 'RPP',
1406
+			);
1407
+		}
1408
+		return isset($mapping[$payment_status]) ? $mapping[$payment_status] : 'RNA';
1409
+	}
1410
+
1411
+
1412
+
1413
+	/**
1414
+	 * Makes sure the 3.1's image url is converted to an image attachment post to the 4.1 CPT event
1415
+	 * and sets it as the featured image on the CPT event
1416
+	 *
1417
+	 * @param type                            $old_event
1418
+	 * @param type                            $new_cpt_id
1419
+	 * @param  EE_Data_Migration_Script_Stage $migration_stage the stage which called this, where errors should be added
1420
+	 * @return boolean whether or not we had to do the big job of creating an image attachment
1421
+	 */
1422
+	public function convert_image_url_to_attachment_and_attach_to_post(
1423
+			$guid,
1424
+			$new_cpt_id,
1425
+			EE_Data_Migration_Script_Stage $migration_stage
1426
+	) {
1427
+		$created_attachment_post = false;
1428
+		$guid = $this->_get_original_guid($guid);
1429
+		if ($guid) {
1430
+			//check for an existing attachment post with this guid
1431
+			$attachment_post_id = $this->_get_image_attachment_id_by_GUID($guid);
1432
+			if ( ! $attachment_post_id) {
1433
+				//post thumbnail with that GUID doesn't exist, we should create one
1434
+				$attachment_post_id = $this->_create_image_attachment_from_GUID($guid, $migration_stage);
1435
+				$created_attachment_post = true;
1436
+			}
1437
+			//double-check we actually have an attachment post
1438
+			if ($attachment_post_id) {
1439
+				update_post_meta($new_cpt_id, '_thumbnail_id', $attachment_post_id);
1440
+			} else {
1441
+				$migration_stage->add_error(sprintf(esc_html__("Could not update event image %s for CPT with ID %d, but attachments post ID is %d",
1442
+						"event_espresso"), $guid, $new_cpt_id, $attachment_post_id));
1443
+			}
1444
+		}
1445
+		return $created_attachment_post;
1446
+	}
1447
+
1448
+
1449
+
1450
+	/**
1451
+	 * In 3.1, the event thumbnail image DOESN'T point to the orignal image, but instead
1452
+	 * to a large thumbnail (which has nearly the same GUID, except it adds "-{width}x{height}" before the filetype,
1453
+	 * or whatever dimensions it is. Eg 'http://mysite.com/image1-300x400.jpg' instead of
1454
+	 * 'http://mysite.com/image1.jpg' ). This function attempts to strip that off and get the original file, if it
1455
+	 * exists
1456
+	 *
1457
+	 * @param string $guid_in_old_event
1458
+	 * @return string either the original guid, or $guid_in_old_event if we couldn't figure out what the original was
1459
+	 */
1460
+	private function _get_original_guid($guid_in_old_event)
1461
+	{
1462
+		$original_guid = preg_replace('~-\d*x\d*\.~', '.', $guid_in_old_event, 1);
1463
+		//do a head request to verify the file exists
1464
+		$head_response = wp_remote_head($original_guid);
1465
+		if ( ! $head_response instanceof WP_Error && $head_response['response']['message'] == 'OK') {
1466
+			return $original_guid;
1467
+		} else {
1468
+			return $guid_in_old_event;
1469
+		}
1470
+	}
1471
+
1472
+
1473
+
1474
+	/**
1475
+	 * Creates an image attachment post for the GUID. If the GUID points to a remote image,
1476
+	 * we download it to our uploads directory so that it can be properly processed (eg, creates different sizes of
1477
+	 * thumbnails)
1478
+	 *
1479
+	 * @param type                           $guid
1480
+	 * @param EE_Data_Migration_Script_Stage $migration_stage
1481
+	 * @return int
1482
+	 */
1483
+	private function _create_image_attachment_from_GUID($guid, EE_Data_Migration_Script_Stage $migration_stage)
1484
+	{
1485
+		if ( ! $guid) {
1486
+			$migration_stage->add_error(sprintf(esc_html__("Cannot create image attachment for a blank GUID!",
1487
+					"event_espresso")));
1488
+			return 0;
1489
+		}
1490
+		$wp_filetype = wp_check_filetype(basename($guid), null);
1491
+		$wp_upload_dir = wp_upload_dir();
1492
+		//if the file is located remotely, download it to our uploads DIR, because wp_genereate_attachmnet_metadata needs the file to be local
1493
+		if (strpos($guid, $wp_upload_dir['url']) === false) {
1494
+			//image is located remotely. download it and place it in the uploads directory
1495
+			if ( ! is_readable($guid)) {
1496
+				$migration_stage->add_error(sprintf(esc_html__("Could not create image attachment from non-existent file: %s",
1497
+						"event_espresso"), $guid));
1498
+				return 0;
1499
+			}
1500
+			$contents = file_get_contents($guid);
1501
+			if ($contents === false) {
1502
+				$migration_stage->add_error(sprintf(esc_html__("Could not read image at %s, and therefore couldnt create an attachment post for it.",
1503
+						"event_espresso"), $guid));
1504
+				return false;
1505
+			}
1506
+			$local_filepath = $wp_upload_dir['path'] . DS . basename($guid);
1507
+			$savefile = fopen($local_filepath, 'w');
1508
+			fwrite($savefile, $contents);
1509
+			fclose($savefile);
1510
+			$guid = str_replace($wp_upload_dir['path'], $wp_upload_dir['url'], $local_filepath);
1511
+		} else {
1512
+			$local_filepath = str_replace($wp_upload_dir['url'], $wp_upload_dir['path'], $guid);
1513
+		}
1514
+		$attachment = array(
1515
+				'guid'           => $guid,
1516
+				'post_mime_type' => $wp_filetype['type'],
1517
+				'post_title'     => preg_replace('/\.[^.]+$/', '', basename($guid)),
1518
+				'post_content'   => '',
1519
+				'post_status'    => 'inherit',
1520
+		);
1521
+		$attach_id = wp_insert_attachment($attachment, $guid);
1522
+		if ( ! $attach_id) {
1523
+			$migration_stage->add_error(sprintf(esc_html__("Could not create image attachment post from image '%s'. Attachment data was %s.",
1524
+					"event_espresso"), $guid, $this->_json_encode($attachment)));
1525
+			return $attach_id;
1526
+		}
1527
+		// you must first include the image.php file
1528
+		// for the function wp_generate_attachment_metadata() to work
1529
+		require_once(ABSPATH . 'wp-admin/includes/image.php');
1530
+		$attach_data = wp_generate_attachment_metadata($attach_id, $local_filepath);
1531
+		if ( ! $attach_data) {
1532
+			$migration_stage->add_error(sprintf(esc_html__("Coudl not genereate attachment metadata for attachment post %d with filepath %s and GUID %s. Please check the file was downloaded properly.",
1533
+					"event_espresso"), $attach_id, $local_filepath, $guid));
1534
+			return $attach_id;
1535
+		}
1536
+		$metadata_save_result = wp_update_attachment_metadata($attach_id, $attach_data);
1537
+		if ( ! $metadata_save_result) {
1538
+			$migration_stage->add_error(sprintf(esc_html__("Could not update attachment metadata for attachment %d with data %s",
1539
+					"event_espresso"), $attach_id, $this->_json_encode($attach_data)));
1540
+		}
1541
+		return $attach_id;
1542
+	}
1543
+
1544
+
1545
+
1546
+	/**
1547
+	 * Finds the attachment post containing info about an image attachment given the GUID (link to the image itself),
1548
+	 * and returns its ID.
1549
+	 *
1550
+	 * @global type  $wpdb
1551
+	 * @param string $guid
1552
+	 * @return int
1553
+	 */
1554
+	private function _get_image_attachment_id_by_GUID($guid)
1555
+	{
1556
+		global $wpdb;
1557
+		$attachment_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE guid=%s LIMIT 1", $guid));
1558
+		return $attachment_id;
1559
+	}
1560
+
1561
+
1562
+
1563
+	/**
1564
+	 * Returns a mysql-formatted DATETIME in UTC time, given a $DATETIME_string
1565
+	 * (and optionally a timezone; if none is given, the wp DEFAULT is used)
1566
+	 *
1567
+	 * @param EE_Data_Migration_Script_base $stage
1568
+	 * @param array                         $row_of_data , the row from the DB (as an array) we're trying to find the
1569
+	 *                                                   UTC time for
1570
+	 * @param string                        $DATETIME_string
1571
+	 * @param string                        $timezone
1572
+	 * @return string
1573
+	 */
1574
+	public function convert_date_string_to_utc(
1575
+			EE_Data_Migration_Script_Stage $stage,
1576
+			$row_of_data,
1577
+			$DATETIME_string,
1578
+			$timezone = null
1579
+	) {
1580
+		$original_tz = $timezone;
1581
+		if ( ! $timezone) {
1582
+			$timezone = $this->_get_wp_timezone();
1583
+		}
1584
+		if ( ! $timezone) {
1585
+			$stage->add_error(sprintf(esc_html__("Could not find timezone given %s for %s", "event_espresso"), $original_tz,
1586
+					$row_of_data));
1587
+			$timezone = 'UTC';
1588
+		}
1589
+		try {
1590
+			$date_obj = new DateTime($DATETIME_string, new DateTimeZone($timezone));
1591
+			$date_obj->setTimezone(new DateTimeZone('UTC'));
1592
+		} catch (Exception $e) {
1593
+			$stage->add_error(sprintf(esc_html__("Could not convert time string '%s' using timezone '%s' into a proper DATETIME. Using current time instead.",
1594
+					"event_espresso"), $DATETIME_string, $timezone));
1595
+			$date_obj = new DateTime();
1596
+		}
1597
+		return $date_obj->format('Y-m-d H:i:s');
1598
+	}
1599
+
1600
+
1601
+
1602
+	/**
1603
+	 * Gets the DEFAULT timezone string from wordpress (even if they set a gmt offset)
1604
+	 *
1605
+	 * @return string
1606
+	 */
1607
+	private function _get_wp_timezone()
1608
+	{
1609
+		$timezone = empty($timezone) ? get_option('timezone_string') : $timezone;
1610
+		//if timezone is STILL empty then let's get the GMT offset and then set the timezone_string using our converter
1611
+		if (empty($timezone)) {
1612
+			//let's get a the WordPress UTC offset
1613
+			$offset = get_option('gmt_offset');
1614
+			$timezone = $this->timezone_convert_to_string_from_offset($offset);
1615
+		}
1616
+		return $timezone;
1617
+	}
1618
+
1619
+
1620
+
1621
+	/**
1622
+	 * Gets the wordpress timezone string from a UTC offset
1623
+	 *
1624
+	 * @param int $offset
1625
+	 * @return boolean
1626
+	 */
1627
+	private function timezone_convert_to_string_from_offset($offset)
1628
+	{
1629
+		//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
1630
+		$offset *= 3600; // convert hour offset to seconds
1631
+		$abbrarray = timezone_abbreviations_list();
1632
+		foreach ($abbrarray as $abbr) {
1633
+			foreach ($abbr as $city) {
1634
+				if ($city['offset'] == $offset) {
1635
+					return $city['timezone_id'];
1636
+				}
1637
+			}
1638
+		}
1639
+		return false;
1640
+	}
1641
+
1642
+
1643
+
1644
+	public function migration_page_hooks()
1645
+	{
1646
+		add_filter(
1647
+				'FHEE__ee_migration_page__header',
1648
+				array($this, '_migrate_page_hook_simplify_version_strings'),
1649
+				10,
1650
+				3
1651
+		);
1652
+		add_filter(
1653
+				'FHEE__ee_migration_page__p_after_header',
1654
+				array($this, '_migration_page_hook_simplify_next_db_state'),
1655
+				10,
1656
+				2
1657
+		);
1658
+		add_filter(
1659
+				'FHEE__ee_migration_page__option_1_main',
1660
+				array($this, '_migrate_page_hook_simplify_version_strings'),
1661
+				10,
1662
+				3
1663
+		);
1664
+		add_filter(
1665
+				'FHEE__ee_migration_page__option_1_button_text',
1666
+				array($this, '_migrate_page_hook_simplify_version_strings'),
1667
+				10,
1668
+				3
1669
+		);
1670
+		add_action(
1671
+				'AHEE__ee_migration_page__option_1_extra_details',
1672
+				array($this, '_migration_page_hook_option_1_extra_details'),
1673
+				10,
1674
+				3
1675
+		);
1676
+		add_filter(
1677
+				'FHEE__ee_migration_page__option_2_main',
1678
+				array($this, '_migrate_page_hook_simplify_version_strings'),
1679
+				10,
1680
+				4
1681
+		);
1682
+		add_filter(
1683
+				'FHEE__ee_migration_page__option_2_button_text',
1684
+				array($this, '_migration_page_hook_simplify_next_db_state'),
1685
+				10,
1686
+				2
1687
+		);
1688
+		add_filter(
1689
+				'FHEE__ee_migration_page__option_2_details',
1690
+				array($this, '_migration_page_hook_simplify_next_db_state'),
1691
+				10,
1692
+				2
1693
+		);
1694
+		add_action(
1695
+				'AHEE__ee_migration_page__after_migration_options_table',
1696
+				array($this, '_migration_page_hook_after_migration_options_table')
1697
+		);
1698
+		add_filter(
1699
+				'FHEE__ee_migration_page__done_migration_header',
1700
+				array($this, '_migration_page_hook_simplify_next_db_state'),
1701
+				10,
1702
+				2
1703
+		);
1704
+		add_filter(
1705
+				'FHEE__ee_migration_page__p_after_done_migration_header',
1706
+				array($this, '_migration_page_hook_simplify_next_db_state'),
1707
+				10,
1708
+				2
1709
+		);
1710
+		add_filter(
1711
+				'FHEE__ee_migration_page__migration_options_template',
1712
+				array($this,'use_migration_options_from_ee3_template')
1713
+		);
1714
+	}
1715
+
1716
+
1717
+
1718
+	public function _migrate_page_hook_simplify_version_strings(
1719
+			$old_content,
1720
+			$current_db_state,
1721
+			$next_db_state,
1722
+			$ultimate_db_state = null
1723
+	) {
1724
+		return str_replace(array($current_db_state, $next_db_state, $ultimate_db_state),
1725
+				array(esc_html__('EE3', 'event_espresso'), esc_html__('EE4', 'event_espresso'), esc_html__("EE4", 'event_espresso')),
1726
+				$old_content);
1727
+	}
1728
+
1729
+
1730
+
1731
+	public function _migration_page_hook_simplify_next_db_state($old_content, $next_db_state)
1732
+	{
1733
+		return str_replace($next_db_state, esc_html__("EE4", 'event_espresso'), $old_content);
1734
+	}
1735
+
1736
+
1737
+
1738
+	public function _migration_page_hook_option_1_extra_details()
1739
+	{
1740
+		?>
1741 1741
         <p><?php printf(esc_html__("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",
1742
-            "event_espresso")); ?></p><?php
1743
-    }
1742
+			"event_espresso")); ?></p><?php
1743
+	}
1744 1744
 
1745 1745
 
1746 1746
 
1747
-    public function _migration_page_hook_after_migration_options_table()
1748
-    {
1749
-        ?><p class="ee-attention">
1747
+	public function _migration_page_hook_after_migration_options_table()
1748
+	{
1749
+		?><p class="ee-attention">
1750 1750
         <strong><span class="reminder-spn"><?php _e("Important note to those using Event Espresso 3 addons: ",
1751
-                        "event_espresso"); ?></span></strong>
1751
+						"event_espresso"); ?></span></strong>
1752 1752
         <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.",
1753
-            "event_espresso"); ?>
1753
+			"event_espresso"); ?>
1754 1754
         </p><?php
1755
-    }
1755
+	}
1756 1756
 
1757 1757
 
1758 1758
 
1759
-    /**
1760
-     * When showing the migration options, show more options and info than normal (ie, give folks the option
1761
-     * to start using EE4 without migrating. From EE3 that's fine, because it doesn't actually remove any data, because
1762
-     * EE4 doesn't have any yet. But when migrating from EE4 it would remove old data, so its not a great idea).
1763
-     * @param $template_filepath
1764
-     * @return string
1765
-     */
1766
-    public function use_migration_options_from_ee3_template( $template_filepath ) {
1767
-        return EE_MAINTENANCE_TEMPLATE_PATH . 'migration_options_from_ee3.template.php';
1768
-    }
1759
+	/**
1760
+	 * When showing the migration options, show more options and info than normal (ie, give folks the option
1761
+	 * to start using EE4 without migrating. From EE3 that's fine, because it doesn't actually remove any data, because
1762
+	 * EE4 doesn't have any yet. But when migrating from EE4 it would remove old data, so its not a great idea).
1763
+	 * @param $template_filepath
1764
+	 * @return string
1765
+	 */
1766
+	public function use_migration_options_from_ee3_template( $template_filepath ) {
1767
+		return EE_MAINTENANCE_TEMPLATE_PATH . 'migration_options_from_ee3.template.php';
1768
+	}
1769 1769
 }
Please login to merge, or discard this patch.
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 //unfortunately, this needs to be done upon INCLUSION of this file,
10 10
 //instead of construction, because it only gets constructed on first page load
11 11
 //(all other times it gets resurrected from a wordpress option)
12
-$stages = glob(EE_CORE . 'data_migration_scripts/4_1_0_stages/*');
12
+$stages = glob(EE_CORE.'data_migration_scripts/4_1_0_stages/*');
13 13
 $class_to_filepath = array();
14 14
 if ( ! empty($stages)) {
15 15
     foreach ($stages as $filepath) {
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
     private function _checkin_table_exists()
88 88
     {
89 89
         global $wpdb;
90
-        $results = $wpdb->get_results("SHOW TABLES LIKE '" . $wpdb->prefix . "events_attendee_checkin" . "'");
90
+        $results = $wpdb->get_results("SHOW TABLES LIKE '".$wpdb->prefix."events_attendee_checkin"."'");
91 91
         if ($results) {
92 92
             return true;
93 93
         } else {
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 //			echo "no version string provided: $version_string";
108 108
             //no version string provided... this must be pre 4.1
109 109
             //because since 4.1 we're
110
-            return false;//changed mind. dont want people thinking they should migrate yet because they cant
110
+            return false; //changed mind. dont want people thinking they should migrate yet because they cant
111 111
         } else {
112 112
 //			echo "$version_string doesnt apply";
113 113
             return false;
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
     public function schema_changes_before_migration()
120 120
     {
121 121
         //relies on 4.1's EEH_Activation::create_table
122
-        require_once(EE_HELPERS . 'EEH_Activation.helper.php');
122
+        require_once(EE_HELPERS.'EEH_Activation.helper.php');
123 123
         $table_name = 'esp_answer';
124 124
         $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
125 125
 					REG_ID INT UNSIGNED NOT NULL,
@@ -503,12 +503,12 @@  discard block
 block discarded – undo
503 503
     public function insert_default_states()
504 504
     {
505 505
         global $wpdb;
506
-        $state_table = $wpdb->prefix . "esp_state";
506
+        $state_table = $wpdb->prefix."esp_state";
507 507
         if ($this->_get_table_analysis()->tableExists($state_table)) {
508
-            $SQL = "SELECT COUNT('STA_ID') FROM " . $state_table;
508
+            $SQL = "SELECT COUNT('STA_ID') FROM ".$state_table;
509 509
             $states = $wpdb->get_var($SQL);
510 510
             if ( ! $states) {
511
-                $SQL = "INSERT INTO " . $state_table . "
511
+                $SQL = "INSERT INTO ".$state_table."
512 512
 				(STA_ID, CNT_ISO, STA_abbrev, STA_name, STA_active) VALUES
513 513
 				(1, 'US', 'AK', 'Alaska', 1),
514 514
 				(2, 'US', 'AL', 'Alabama', 1),
@@ -596,12 +596,12 @@  discard block
 block discarded – undo
596 596
     public function insert_default_countries()
597 597
     {
598 598
         global $wpdb;
599
-        $country_table = $wpdb->prefix . "esp_country";
599
+        $country_table = $wpdb->prefix."esp_country";
600 600
         if ($this->_get_table_analysis()->tableExists($country_table)) {
601
-            $SQL = "SELECT COUNT('CNT_ISO') FROM " . $country_table;
601
+            $SQL = "SELECT COUNT('CNT_ISO') FROM ".$country_table;
602 602
             $countries = $wpdb->get_var($SQL);
603 603
             if ( ! $countries) {
604
-                $SQL = "INSERT INTO " . $country_table . "
604
+                $SQL = "INSERT INTO ".$country_table."
605 605
 				(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
606 606
 				('AD', 'AND', 0, 'Andorra', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+376', 0, 0),
607 607
 				('AE', 'ARE', 0, 'United Arab Emirates', 'AED', 'Dirham', 'Dirhams', 'د.إ', 1, 2, '+971', 0, 0),
@@ -846,17 +846,17 @@  discard block
 block discarded – undo
846 846
     public function insert_default_price_types()
847 847
     {
848 848
         global $wpdb;
849
-        $price_type_table = $wpdb->prefix . "esp_price_type";
849
+        $price_type_table = $wpdb->prefix."esp_price_type";
850 850
         if ($this->_get_table_analysis()->tableExists($price_type_table)) {
851
-            $SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table;
851
+            $SQL = 'SELECT COUNT(PRT_ID) FROM '.$price_type_table;
852 852
             $price_types_exist = $wpdb->get_var($SQL);
853 853
             if ( ! $price_types_exist) {
854 854
                 $SQL = "INSERT INTO $price_type_table ( PRT_ID, PRT_name, PBT_ID, PRT_is_percent, PRT_order, PRT_deleted ) VALUES
855
-							(1, '" . esc_html__('Base Price', 'event_espresso') . "', 1,  0, 0, 0),
856
-							(2, '" . esc_html__('Percent Discount', 'event_espresso') . "', 2,  1, 20, 0),
857
-							(3, '" . esc_html__('Fixed Discount', 'event_espresso') . "', 2,  0, 30, 0),
858
-							(4, '" . esc_html__('Percent Surcharge', 'event_espresso') . "', 3,  1, 40, 0),
859
-							(5, '" . esc_html__('Fixed Surcharge', 'event_espresso') . "', 3,  0, 50, 0);";
855
+							(1, '".esc_html__('Base Price', 'event_espresso')."', 1,  0, 0, 0),
856
+							(2, '" . esc_html__('Percent Discount', 'event_espresso')."', 2,  1, 20, 0),
857
+							(3, '" . esc_html__('Fixed Discount', 'event_espresso')."', 2,  0, 30, 0),
858
+							(4, '" . esc_html__('Percent Surcharge', 'event_espresso')."', 3,  1, 40, 0),
859
+							(5, '" . esc_html__('Fixed Surcharge', 'event_espresso')."', 3,  0, 50, 0);";
860 860
                 $SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_price_types__SQL', $SQL);
861 861
                 $wpdb->query($SQL);
862 862
             }
@@ -878,9 +878,9 @@  discard block
 block discarded – undo
878 878
     public function insert_default_prices()
879 879
     {
880 880
         global $wpdb;
881
-        $price_table = $wpdb->prefix . "esp_price";
881
+        $price_table = $wpdb->prefix."esp_price";
882 882
         if ($this->_get_table_analysis()->tableExists($price_table)) {
883
-            $SQL = 'SELECT COUNT(PRC_ID) FROM ' . $price_table;
883
+            $SQL = 'SELECT COUNT(PRC_ID) FROM '.$price_table;
884 884
             $prices_exist = $wpdb->get_var($SQL);
885 885
             if ( ! $prices_exist) {
886 886
                 $SQL = "INSERT INTO $price_table
@@ -904,9 +904,9 @@  discard block
 block discarded – undo
904 904
     public function insert_default_tickets()
905 905
     {
906 906
         global $wpdb;
907
-        $ticket_table = $wpdb->prefix . "esp_ticket";
907
+        $ticket_table = $wpdb->prefix."esp_ticket";
908 908
         if ($this->_get_table_analysis()->tableExists($ticket_table)) {
909
-            $SQL = 'SELECT COUNT(TKT_ID) FROM ' . $ticket_table;
909
+            $SQL = 'SELECT COUNT(TKT_ID) FROM '.$ticket_table;
910 910
             $tickets_exist = $wpdb->get_var($SQL);
911 911
             if ( ! $tickets_exist) {
912 912
                 $SQL = "INSERT INTO $ticket_table
@@ -918,9 +918,9 @@  discard block
 block discarded – undo
918 918
                 $wpdb->query($SQL);
919 919
             }
920 920
         }
921
-        $ticket_price_table = $wpdb->prefix . "esp_ticket_price";
921
+        $ticket_price_table = $wpdb->prefix."esp_ticket_price";
922 922
         if ($this->_get_table_analysis()->tableExists($ticket_price_table)) {
923
-            $SQL = 'SELECT COUNT(TKP_ID) FROM ' . $ticket_price_table;
923
+            $SQL = 'SELECT COUNT(TKP_ID) FROM '.$ticket_price_table;
924 924
             $ticket_prc_exist = $wpdb->get_var($SQL);
925 925
             if ( ! $ticket_prc_exist) {
926 926
                 $SQL = "INSERT INTO $ticket_price_table
@@ -950,7 +950,7 @@  discard block
 block discarded – undo
950 950
             throw new EE_Error(esc_html__("Could not get a country because country name is blank", "event_espresso"));
951 951
         }
952 952
         global $wpdb;
953
-        $country_table = $wpdb->prefix . "esp_country";
953
+        $country_table = $wpdb->prefix."esp_country";
954 954
         if (is_int($country_name)) {
955 955
             $country_name = $this->get_iso_from_3_1_country_id($country_name);
956 956
         }
@@ -978,21 +978,21 @@  discard block
 block discarded – undo
978 978
                     'CNT_active'      => true,
979 979
             );
980 980
             $data_types = array(
981
-                    '%s',//CNT_ISO
982
-                    '%s',//CNT_ISO3
983
-                    '%d',//RGN_ID
984
-                    '%s',//CNT_name
985
-                    '%s',//CNT_cur_code
986
-                    '%s',//CNT_cur_single
987
-                    '%s',//CNT_cur_plural
988
-                    '%s',//CNT_cur_sign
989
-                    '%d',//CNT_cur_sign_b4
990
-                    '%d',//CNT_cur_dec_plc
991
-                    '%s',//CNT_cur_dec_mrk
992
-                    '%s',//CNT_cur_thsnds
993
-                    '%s',//CNT_tel_code
994
-                    '%d',//CNT_is_EU
995
-                    '%d',//CNT_active
981
+                    '%s', //CNT_ISO
982
+                    '%s', //CNT_ISO3
983
+                    '%d', //RGN_ID
984
+                    '%s', //CNT_name
985
+                    '%s', //CNT_cur_code
986
+                    '%s', //CNT_cur_single
987
+                    '%s', //CNT_cur_plural
988
+                    '%s', //CNT_cur_sign
989
+                    '%d', //CNT_cur_sign_b4
990
+                    '%d', //CNT_cur_dec_plc
991
+                    '%s', //CNT_cur_dec_mrk
992
+                    '%s', //CNT_cur_thsnds
993
+                    '%s', //CNT_tel_code
994
+                    '%d', //CNT_is_EU
995
+                    '%d', //CNT_active
996 996
             );
997 997
             $success = $wpdb->insert($country_table,
998 998
                     $cols_n_values,
@@ -1017,7 +1017,7 @@  discard block
 block discarded – undo
1017 1017
     private function _find_available_country_iso($num_letters = 2)
1018 1018
     {
1019 1019
         global $wpdb;
1020
-        $country_table = $wpdb->prefix . "esp_country";
1020
+        $country_table = $wpdb->prefix."esp_country";
1021 1021
         $attempts = 0;
1022 1022
         do {
1023 1023
             $current_iso = strtoupper(wp_generate_password($num_letters, false));
@@ -1028,7 +1028,7 @@  discard block
 block discarded – undo
1028 1028
             //keep going until we find an available country code, or we arbitrarily
1029 1029
             //decide we've tried this enough. Somehow they have way too many countries
1030 1030
             //(probably because they're mis-using the EE3 country_id like a custom question)
1031
-        } while (intval($country_with_that_iso) && $attempts < 200);
1031
+        }while (intval($country_with_that_iso) && $attempts < 200);
1032 1032
         return $current_iso;
1033 1033
     }
1034 1034
 
@@ -1055,7 +1055,7 @@  discard block
 block discarded – undo
1055 1055
             $country_iso = $this->get_default_country_iso();
1056 1056
         }
1057 1057
         global $wpdb;
1058
-        $state_table = $wpdb->prefix . "esp_state";
1058
+        $state_table = $wpdb->prefix."esp_state";
1059 1059
         $state = $wpdb->get_row($wpdb->prepare("SELECT * FROM $state_table WHERE
1060 1060
 			(STA_abbrev LIKE %s OR
1061 1061
 			STA_name LIKE %s) AND
@@ -1069,10 +1069,10 @@  discard block
 block discarded – undo
1069 1069
                     'STA_active' => true,
1070 1070
             );
1071 1071
             $data_types = array(
1072
-                    '%s',//CNT_ISO
1073
-                    '%s',//STA_abbrev
1074
-                    '%s',//STA_name
1075
-                    '%d',//STA_active
1072
+                    '%s', //CNT_ISO
1073
+                    '%s', //STA_abbrev
1074
+                    '%s', //STA_name
1075
+                    '%d', //STA_active
1076 1076
             );
1077 1077
             $success = $wpdb->insert($state_table, $cols_n_values, $data_types);
1078 1078
             if ( ! $success) {
@@ -1503,7 +1503,7 @@  discard block
 block discarded – undo
1503 1503
                         "event_espresso"), $guid));
1504 1504
                 return false;
1505 1505
             }
1506
-            $local_filepath = $wp_upload_dir['path'] . DS . basename($guid);
1506
+            $local_filepath = $wp_upload_dir['path'].DS.basename($guid);
1507 1507
             $savefile = fopen($local_filepath, 'w');
1508 1508
             fwrite($savefile, $contents);
1509 1509
             fclose($savefile);
@@ -1526,7 +1526,7 @@  discard block
 block discarded – undo
1526 1526
         }
1527 1527
         // you must first include the image.php file
1528 1528
         // for the function wp_generate_attachment_metadata() to work
1529
-        require_once(ABSPATH . 'wp-admin/includes/image.php');
1529
+        require_once(ABSPATH.'wp-admin/includes/image.php');
1530 1530
         $attach_data = wp_generate_attachment_metadata($attach_id, $local_filepath);
1531 1531
         if ( ! $attach_data) {
1532 1532
             $migration_stage->add_error(sprintf(esc_html__("Coudl not genereate attachment metadata for attachment post %d with filepath %s and GUID %s. Please check the file was downloaded properly.",
@@ -1709,7 +1709,7 @@  discard block
 block discarded – undo
1709 1709
         );
1710 1710
         add_filter(
1711 1711
                 'FHEE__ee_migration_page__migration_options_template',
1712
-                array($this,'use_migration_options_from_ee3_template')
1712
+                array($this, 'use_migration_options_from_ee3_template')
1713 1713
         );
1714 1714
     }
1715 1715
 
@@ -1763,7 +1763,7 @@  discard block
 block discarded – undo
1763 1763
      * @param $template_filepath
1764 1764
      * @return string
1765 1765
      */
1766
-    public function use_migration_options_from_ee3_template( $template_filepath ) {
1767
-        return EE_MAINTENANCE_TEMPLATE_PATH . 'migration_options_from_ee3.template.php';
1766
+    public function use_migration_options_from_ee3_template($template_filepath) {
1767
+        return EE_MAINTENANCE_TEMPLATE_PATH.'migration_options_from_ee3.template.php';
1768 1768
     }
1769 1769
 }
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_DMS_Core_4_5_0.dms.php 1 patch
Indentation   +247 added lines, -247 removed lines patch added patch discarded remove patch
@@ -16,9 +16,9 @@  discard block
 block discarded – undo
16 16
 $stages = glob(EE_CORE . 'data_migration_scripts/4_5_0_stages/*');
17 17
 $class_to_filepath = array();
18 18
 foreach ($stages as $filepath) {
19
-    $matches = array();
20
-    preg_match('~4_5_0_stages/(.*).dmsstage.php~', $filepath, $matches);
21
-    $class_to_filepath[$matches[1]] = $filepath;
19
+	$matches = array();
20
+	preg_match('~4_5_0_stages/(.*).dmsstage.php~', $filepath, $matches);
21
+	$class_to_filepath[$matches[1]] = $filepath;
22 22
 }
23 23
 //give addons a chance to autoload their stages too
24 24
 $class_to_filepath = apply_filters('FHEE__EE_DMS_4_5_0__autoloaded_stages', $class_to_filepath);
@@ -31,59 +31,59 @@  discard block
 block discarded – undo
31 31
 
32 32
 
33 33
 
34
-    /**
35
-     * EE_DMS_Core_4_5_0 constructor.
36
-     *
37
-     * @param TableManager  $table_manager
38
-     * @param TableAnalysis $table_analysis
39
-     */
40
-    public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null)
41
-    {
42
-        $this->_pretty_name = __("Data Update to Event Espresso 4.5.0", "event_espresso");
43
-        $this->_priority = 10;
44
-        $this->_migration_stages = array(
45
-            new EE_DMS_4_5_0_update_wp_user_for_tickets(),
46
-            new EE_DMS_4_5_0_update_wp_user_for_prices(),
47
-            new EE_DMS_4_5_0_update_wp_user_for_price_types(),
48
-            new EE_DMS_4_5_0_update_wp_user_for_question_groups(),
49
-            new EE_DMS_4_5_0_invoice_settings(),
50
-        );
51
-        parent::__construct($table_manager, $table_analysis);
52
-    }
53
-
54
-
55
-
56
-    public function can_migrate_from_version($version_array)
57
-    {
58
-        $version_string = $version_array['Core'];
59
-        if (version_compare($version_string, '4.5.0', '<=') && version_compare($version_string, '4.3.0', '>=')) {
34
+	/**
35
+	 * EE_DMS_Core_4_5_0 constructor.
36
+	 *
37
+	 * @param TableManager  $table_manager
38
+	 * @param TableAnalysis $table_analysis
39
+	 */
40
+	public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null)
41
+	{
42
+		$this->_pretty_name = __("Data Update to Event Espresso 4.5.0", "event_espresso");
43
+		$this->_priority = 10;
44
+		$this->_migration_stages = array(
45
+			new EE_DMS_4_5_0_update_wp_user_for_tickets(),
46
+			new EE_DMS_4_5_0_update_wp_user_for_prices(),
47
+			new EE_DMS_4_5_0_update_wp_user_for_price_types(),
48
+			new EE_DMS_4_5_0_update_wp_user_for_question_groups(),
49
+			new EE_DMS_4_5_0_invoice_settings(),
50
+		);
51
+		parent::__construct($table_manager, $table_analysis);
52
+	}
53
+
54
+
55
+
56
+	public function can_migrate_from_version($version_array)
57
+	{
58
+		$version_string = $version_array['Core'];
59
+		if (version_compare($version_string, '4.5.0', '<=') && version_compare($version_string, '4.3.0', '>=')) {
60 60
 //			echo "$version_string can be migrated from";
61
-            return true;
62
-        } elseif ( ! $version_string) {
61
+			return true;
62
+		} elseif ( ! $version_string) {
63 63
 //			echo "no version string provided: $version_string";
64
-            //no version string provided... this must be pre 4.3
65
-            return false;//changed mind. dont want people thinking they should migrate yet because they cant
66
-        } else {
64
+			//no version string provided... this must be pre 4.3
65
+			return false;//changed mind. dont want people thinking they should migrate yet because they cant
66
+		} else {
67 67
 //			echo "$version_string doesnt apply";
68
-            return false;
69
-        }
70
-    }
68
+			return false;
69
+		}
70
+	}
71 71
 
72 72
 
73 73
 
74
-    public function schema_changes_before_migration()
75
-    {
76
-        //relies on 4.1's EEH_Activation::create_table
77
-        require_once(EE_HELPERS . 'EEH_Activation.helper.php');
78
-        $table_name = 'esp_answer';
79
-        $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
74
+	public function schema_changes_before_migration()
75
+	{
76
+		//relies on 4.1's EEH_Activation::create_table
77
+		require_once(EE_HELPERS . 'EEH_Activation.helper.php');
78
+		$table_name = 'esp_answer';
79
+		$sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
80 80
 					REG_ID INT UNSIGNED NOT NULL,
81 81
 					QST_ID INT UNSIGNED NOT NULL,
82 82
 					ANS_value TEXT NOT NULL,
83 83
 					PRIMARY KEY  (ANS_ID)";
84
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
85
-        $table_name = 'esp_attendee_meta';
86
-        $sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
84
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
85
+		$table_name = 'esp_attendee_meta';
86
+		$sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
87 87
 						ATT_ID BIGINT(20) UNSIGNED NOT NULL,
88 88
 						ATT_fname VARCHAR(45) NOT NULL,
89 89
 						ATT_lname VARCHAR(45) NOT	NULL,
@@ -99,9 +99,9 @@  discard block
 block discarded – undo
99 99
 								KEY ATT_fname (ATT_fname),
100 100
 								KEY ATT_lname (ATT_lname),
101 101
 								KEY ATT_email (ATT_email)";
102
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
103
-        $table_name = 'esp_country';
104
-        $sql = "CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL,
102
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
103
+		$table_name = 'esp_country';
104
+		$sql = "CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL,
105 105
 					  CNT_ISO3 VARCHAR(3) COLLATE utf8_bin NOT NULL,
106 106
 					  RGN_ID TINYINT(3) UNSIGNED DEFAULT NULL,
107 107
 					  CNT_name VARCHAR(45) COLLATE utf8_bin NOT NULL,
@@ -117,9 +117,9 @@  discard block
 block discarded – undo
117 117
 					  CNT_is_EU TINYINT(1) DEFAULT '0',
118 118
 					  CNT_active TINYINT(1) DEFAULT '0',
119 119
 					  PRIMARY KEY  (CNT_ISO)";
120
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
121
-        $table_name = 'esp_datetime';
122
-        $sql = "DTT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
120
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
121
+		$table_name = 'esp_datetime';
122
+		$sql = "DTT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
123 123
 				  EVT_ID BIGINT(20) UNSIGNED NOT NULL,
124 124
 				  DTT_name VARCHAR(255) NOT NULL DEFAULT '',
125 125
 				  DTT_description TEXT NOT NULL,
@@ -134,9 +134,9 @@  discard block
 block discarded – undo
134 134
 						PRIMARY KEY  (DTT_ID),
135 135
 						KEY EVT_ID (EVT_ID),
136 136
 						KEY DTT_is_primary (DTT_is_primary)";
137
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
138
-        $table_name = 'esp_event_meta';
139
-        $sql = "
137
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
138
+		$table_name = 'esp_event_meta';
139
+		$sql = "
140 140
 			EVTM_ID INT NOT NULL AUTO_INCREMENT,
141 141
 			EVT_ID BIGINT(20) UNSIGNED NOT NULL,
142 142
 			EVT_display_desc TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
@@ -151,31 +151,31 @@  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');
155
-        $table_name = 'esp_event_question_group';
156
-        $sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
154
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
155
+		$table_name = 'esp_event_question_group';
156
+		$sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
157 157
 					EVT_ID BIGINT(20) UNSIGNED NOT NULL,
158 158
 					QSG_ID INT UNSIGNED NOT NULL,
159 159
 					EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
160 160
 					PRIMARY KEY  (EQG_ID)";
161
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
162
-        $table_name = 'esp_event_venue';
163
-        $sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
161
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
162
+		$table_name = 'esp_event_venue';
163
+		$sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
164 164
 				EVT_ID BIGINT(20) UNSIGNED NOT NULL,
165 165
 				VNU_ID BIGINT(20) UNSIGNED NOT NULL,
166 166
 				EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
167 167
 				PRIMARY KEY  (EVV_ID)";
168
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
169
-        $table_name = 'esp_extra_meta';
170
-        $sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
168
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
169
+		$table_name = 'esp_extra_meta';
170
+		$sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
171 171
 				OBJ_ID INT(11) DEFAULT NULL,
172 172
 				EXM_type VARCHAR(45) DEFAULT NULL,
173 173
 				EXM_key VARCHAR(45) DEFAULT NULL,
174 174
 				EXM_value TEXT,
175 175
 				PRIMARY KEY  (EXM_ID)";
176
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
177
-        $table_name = 'esp_line_item';
178
-        $sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
176
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
177
+		$table_name = 'esp_line_item';
178
+		$sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
179 179
 				LIN_code VARCHAR(245) NOT NULL DEFAULT '',
180 180
 				TXN_ID INT(11) DEFAULT NULL,
181 181
 				LIN_name VARCHAR(245) NOT NULL DEFAULT '',
@@ -191,19 +191,19 @@  discard block
 block discarded – undo
191 191
 				OBJ_ID INT(11) DEFAULT NULL,
192 192
 				OBJ_type VARCHAR(45)DEFAULT NULL,
193 193
 				PRIMARY KEY  (LIN_ID)";
194
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
195
-        $table_name = 'esp_message_template';
196
-        $sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
194
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
195
+		$table_name = 'esp_message_template';
196
+		$sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
197 197
 					GRP_ID INT(10) UNSIGNED NOT NULL,
198 198
 					MTP_context VARCHAR(50) NOT NULL,
199 199
 					MTP_template_field VARCHAR(30) NOT NULL,
200 200
 					MTP_content TEXT NOT NULL,
201 201
 					PRIMARY KEY  (MTP_ID),
202 202
 					KEY GRP_ID (GRP_ID)";
203
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
204
-        $this->_get_table_manager()->dropIndex('esp_message_template_group', 'EVT_ID');
205
-        $table_name = 'esp_message_template_group';
206
-        $sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
203
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
204
+		$this->_get_table_manager()->dropIndex('esp_message_template_group', 'EVT_ID');
205
+		$table_name = 'esp_message_template_group';
206
+		$sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
207 207
 					MTP_user_id INT(10) NOT NULL DEFAULT '1',
208 208
 					MTP_name VARCHAR(245) NOT NULL DEFAULT '',
209 209
 					MTP_description VARCHAR(245) NOT NULL DEFAULT '',
@@ -215,17 +215,17 @@  discard block
 block discarded – undo
215 215
 					MTP_is_active TINYINT(1) NOT NULL DEFAULT '1',
216 216
 					PRIMARY KEY  (GRP_ID),
217 217
 					KEY MTP_user_id (MTP_user_id)";
218
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
219
-        $table_name = 'esp_event_message_template';
220
-        $sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
218
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
219
+		$table_name = 'esp_event_message_template';
220
+		$sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
221 221
 					EVT_ID BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
222 222
 					GRP_ID INT(10) UNSIGNED NOT NULL DEFAULT 0,
223 223
 					PRIMARY KEY  (EMT_ID),
224 224
 					KEY EVT_ID (EVT_ID),
225 225
 					KEY GRP_ID (GRP_ID)";
226
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
227
-        $table_name = 'esp_payment';
228
-        $sql = "PAY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
226
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
227
+		$table_name = 'esp_payment';
228
+		$sql = "PAY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
229 229
 					TXN_ID INT(10) UNSIGNED DEFAULT NULL,
230 230
 					STS_ID VARCHAR(3) COLLATE utf8_bin DEFAULT NULL,
231 231
 					PAY_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
@@ -241,28 +241,28 @@  discard block
 block discarded – undo
241 241
 					PRIMARY KEY  (PAY_ID),
242 242
 					KEY TXN_ID (TXN_ID),
243 243
 					KEY PAY_timestamp (PAY_timestamp)";
244
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
245
-        $table_name = "esp_ticket_price";
246
-        $sql = "TKP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
244
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
245
+		$table_name = "esp_ticket_price";
246
+		$sql = "TKP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
247 247
 					  TKT_ID INT(10) UNSIGNED NOT NULL,
248 248
 					  PRC_ID INT(10) UNSIGNED NOT NULL,
249 249
 					  PRIMARY KEY  (TKP_ID)";
250
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
251
-        $table_name = "esp_datetime_ticket";
252
-        $sql = "DTK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
250
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
251
+		$table_name = "esp_datetime_ticket";
252
+		$sql = "DTK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
253 253
 					  DTT_ID INT(10) UNSIGNED NOT NULL,
254 254
 					  TKT_ID INT(10) UNSIGNED NOT NULL,
255 255
 					  PRIMARY KEY  (DTK_ID)";
256
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
257
-        $table_name = "esp_ticket_template";
258
-        $sql = "TTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
256
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
257
+		$table_name = "esp_ticket_template";
258
+		$sql = "TTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
259 259
 					  TTM_name VARCHAR(45) NOT NULL,
260 260
 					  TTM_description TEXT,
261 261
 					  TTM_file VARCHAR(45),
262 262
 					  PRIMARY KEY  (TTM_ID)";
263
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
264
-        $table_name = 'esp_question';
265
-        $sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
263
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
264
+		$table_name = 'esp_question';
265
+		$sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
266 266
 					QST_display_text TEXT NOT NULL,
267 267
 					QST_admin_label VARCHAR(255) NOT NULL,
268 268
 					QST_system VARCHAR(25) DEFAULT NULL,
@@ -274,25 +274,25 @@  discard block
 block discarded – undo
274 274
 					QST_wp_user BIGINT UNSIGNED NULL,
275 275
 					QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0,
276 276
 					PRIMARY KEY  (QST_ID)';
277
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
278
-        $table_name = 'esp_question_group_question';
279
-        $sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
277
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
278
+		$table_name = 'esp_question_group_question';
279
+		$sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
280 280
 					QSG_ID INT UNSIGNED NOT NULL,
281 281
 					QST_ID INT UNSIGNED NOT NULL,
282 282
 					QGQ_order INT UNSIGNED NOT NULL DEFAULT 0,
283 283
 					PRIMARY KEY  (QGQ_ID) ";
284
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
285
-        $table_name = 'esp_question_option';
286
-        $sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
284
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
285
+		$table_name = 'esp_question_option';
286
+		$sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
287 287
 					QSO_value VARCHAR(255) NOT NULL,
288 288
 					QSO_desc TEXT NOT NULL,
289 289
 					QST_ID INT UNSIGNED NOT NULL,
290 290
 					QSO_order INT UNSIGNED NOT NULL DEFAULT 0,
291 291
 					QSO_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
292 292
 					PRIMARY KEY  (QSO_ID)";
293
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
294
-        $table_name = 'esp_registration';
295
-        $sql = "REG_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
293
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
294
+		$table_name = 'esp_registration';
295
+		$sql = "REG_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
296 296
 					  EVT_ID BIGINT(20) UNSIGNED NOT NULL,
297 297
 					  ATT_ID BIGINT(20) UNSIGNED NOT NULL,
298 298
 					  TXN_ID INT(10) UNSIGNED NOT NULL,
@@ -315,25 +315,25 @@  discard block
 block discarded – undo
315 315
 					  KEY STS_ID (STS_ID),
316 316
 					  KEY REG_url_link (REG_url_link),
317 317
 					  KEY REG_code (REG_code)";
318
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
319
-        $table_name = 'esp_checkin';
320
-        $sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
318
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
319
+		$table_name = 'esp_checkin';
320
+		$sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
321 321
 					REG_ID INT(10) UNSIGNED NOT NULL,
322 322
 					DTT_ID INT(10) UNSIGNED NOT NULL,
323 323
 					CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
324 324
 					CHK_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
325 325
 					PRIMARY KEY  (CHK_ID)";
326
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
327
-        $table_name = 'esp_state';
328
-        $sql = "STA_ID smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT,
326
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
327
+		$table_name = 'esp_state';
328
+		$sql = "STA_ID smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT,
329 329
 					  CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL,
330 330
 					  STA_abbrev VARCHAR(6) COLLATE utf8_bin NOT NULL,
331 331
 					  STA_name VARCHAR(100) COLLATE utf8_bin NOT NULL,
332 332
 					  STA_active TINYINT(1) DEFAULT '1',
333 333
 					  PRIMARY KEY  (STA_ID)";
334
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
335
-        $table_name = 'esp_status';
336
-        $sql = "STS_ID VARCHAR(3) COLLATE utf8_bin NOT NULL,
334
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
335
+		$table_name = 'esp_status';
336
+		$sql = "STS_ID VARCHAR(3) COLLATE utf8_bin NOT NULL,
337 337
 					  STS_code VARCHAR(45) COLLATE utf8_bin NOT NULL,
338 338
 					  STS_type set('event','registration','transaction','payment','email') COLLATE utf8_bin NOT NULL,
339 339
 					  STS_can_edit TINYINT(1) NOT NULL DEFAULT 0,
@@ -341,9 +341,9 @@  discard block
 block discarded – undo
341 341
 					  STS_open TINYINT(1) NOT NULL DEFAULT 1,
342 342
 					  UNIQUE KEY STS_ID_UNIQUE (STS_ID),
343 343
 					  KEY STS_type (STS_type)";
344
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
345
-        $table_name = 'esp_transaction';
346
-        $sql = "TXN_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
344
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
345
+		$table_name = 'esp_transaction';
346
+		$sql = "TXN_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
347 347
 					  TXN_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
348 348
 					  TXN_total DECIMAL(10,3) DEFAULT '0.00',
349 349
 					  TXN_paid DECIMAL(10,3) NOT NULL DEFAULT '0.00',
@@ -354,9 +354,9 @@  discard block
 block discarded – undo
354 354
 					  PRIMARY KEY  (TXN_ID),
355 355
 					  KEY TXN_timestamp (TXN_timestamp),
356 356
 					  KEY STS_ID (STS_ID)";
357
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
358
-        $table_name = 'esp_venue_meta';
359
-        $sql = "VNUM_ID INT(11) NOT NULL AUTO_INCREMENT,
357
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
358
+		$table_name = 'esp_venue_meta';
359
+		$sql = "VNUM_ID INT(11) NOT NULL AUTO_INCREMENT,
360 360
 			VNU_ID BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
361 361
 			VNU_address VARCHAR(255) DEFAULT NULL,
362 362
 			VNU_address2 VARCHAR(255) DEFAULT NULL,
@@ -374,10 +374,10 @@  discard block
 block discarded – undo
374 374
 			PRIMARY KEY  (VNUM_ID),
375 375
 			KEY STA_ID (STA_ID),
376 376
 			KEY CNT_ISO (CNT_ISO)";
377
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
378
-        //modified tables
379
-        $table_name = "esp_price";
380
-        $sql = "PRC_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
377
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
378
+		//modified tables
379
+		$table_name = "esp_price";
380
+		$sql = "PRC_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
381 381
 					  PRT_ID TINYINT(3) UNSIGNED NOT NULL,
382 382
 					  PRC_amount DECIMAL(10,3) NOT NULL DEFAULT '0.00',
383 383
 					  PRC_name VARCHAR(245) NOT NULL,
@@ -389,9 +389,9 @@  discard block
 block discarded – undo
389 389
 					  PRC_wp_user BIGINT UNSIGNED NULL,
390 390
 					  PRC_parent INT(10) UNSIGNED DEFAULT 0,
391 391
 					  PRIMARY KEY  (PRC_ID)";
392
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
393
-        $table_name = "esp_price_type";
394
-        $sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
392
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
393
+		$table_name = "esp_price_type";
394
+		$sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
395 395
 				  PRT_name VARCHAR(45) NOT NULL,
396 396
 				  PBT_ID TINYINT(3) UNSIGNED NOT NULL DEFAULT '1',
397 397
 				  PRT_is_percent TINYINT(1) NOT NULL DEFAULT '0',
@@ -400,9 +400,9 @@  discard block
 block discarded – undo
400 400
 				  PRT_deleted TINYINT(1) NOT NULL DEFAULT '0',
401 401
 				  UNIQUE KEY PRT_name_UNIQUE (PRT_name),
402 402
 				  PRIMARY KEY  (PRT_ID)";
403
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
404
-        $table_name = "esp_ticket";
405
-        $sql = "TKT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
403
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
404
+		$table_name = "esp_ticket";
405
+		$sql = "TKT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
406 406
 					  TTM_ID INT(10) UNSIGNED NOT NULL,
407 407
 					  TKT_name VARCHAR(245) NOT NULL DEFAULT '',
408 408
 					  TKT_description TEXT NOT NULL,
@@ -423,10 +423,10 @@  discard block
 block discarded – undo
423 423
 					  TKT_parent INT(10) UNSIGNED DEFAULT '0',
424 424
 					  TKT_deleted TINYINT(1) NOT NULL DEFAULT '0',
425 425
 					  PRIMARY KEY  (TKT_ID)";
426
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
427
-        $this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE');
428
-        $table_name = 'esp_question_group';
429
-        $sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
426
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
427
+		$this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE');
428
+		$table_name = 'esp_question_group';
429
+		$sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
430 430
 					QSG_name VARCHAR(255) NOT NULL,
431 431
 					QSG_identifier VARCHAR(100) NOT NULL,
432 432
 					QSG_desc TEXT NULL,
@@ -438,135 +438,135 @@  discard block
 block discarded – undo
438 438
 					QSG_wp_user BIGINT UNSIGNED NULL,
439 439
 					PRIMARY KEY  (QSG_ID),
440 440
 					UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier ASC)';
441
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
442
-        $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
443
-        //(because many need to convert old string states to foreign keys into the states table)
444
-        $script_4_1_defaults->insert_default_states();
445
-        $script_4_1_defaults->insert_default_countries();
446
-        //schema on price, price_types and tickets has changed so use the DEFAULT method in here instead of 4.1's and later.
447
-        $this->insert_default_price_types();
448
-        $this->insert_default_prices();
449
-        $this->insert_default_tickets();
450
-        //setting up the config wp option pretty well counts as a 'schema change', or at least should happen ehre
451
-        EE_Config::instance()->update_espresso_config(false, true);
452
-        return true;
453
-    }
454
-
455
-
456
-
457
-    /**
458
-     * @return boolean
459
-     */
460
-    public function schema_changes_after_migration()
461
-    {
462
-        return true;
463
-    }
464
-
465
-
466
-
467
-    public function migration_page_hooks()
468
-    {
469
-    }
470
-
471
-
472
-
473
-    /**
474
-     * insert_default_price_types
475
-     *
476
-     * @since 4.5.0
477
-     * @return void
478
-     */
479
-    public function insert_default_price_types()
480
-    {
481
-        global $wpdb;
482
-        $price_type_table = $wpdb->prefix . "esp_price_type";
483
-        if ($this->_get_table_analysis()->tableExists($price_type_table)) {
484
-            $SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table;
485
-            $price_types_exist = $wpdb->get_var($SQL);
486
-            if ( ! $price_types_exist) {
487
-                $user_id = EEH_Activation::get_default_creator_id();
488
-                $SQL = "INSERT INTO $price_type_table ( PRT_ID, PRT_name, PBT_ID, PRT_is_percent, PRT_order, PRT_wp_user, PRT_deleted ) VALUES
441
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
442
+		$script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
443
+		//(because many need to convert old string states to foreign keys into the states table)
444
+		$script_4_1_defaults->insert_default_states();
445
+		$script_4_1_defaults->insert_default_countries();
446
+		//schema on price, price_types and tickets has changed so use the DEFAULT method in here instead of 4.1's and later.
447
+		$this->insert_default_price_types();
448
+		$this->insert_default_prices();
449
+		$this->insert_default_tickets();
450
+		//setting up the config wp option pretty well counts as a 'schema change', or at least should happen ehre
451
+		EE_Config::instance()->update_espresso_config(false, true);
452
+		return true;
453
+	}
454
+
455
+
456
+
457
+	/**
458
+	 * @return boolean
459
+	 */
460
+	public function schema_changes_after_migration()
461
+	{
462
+		return true;
463
+	}
464
+
465
+
466
+
467
+	public function migration_page_hooks()
468
+	{
469
+	}
470
+
471
+
472
+
473
+	/**
474
+	 * insert_default_price_types
475
+	 *
476
+	 * @since 4.5.0
477
+	 * @return void
478
+	 */
479
+	public function insert_default_price_types()
480
+	{
481
+		global $wpdb;
482
+		$price_type_table = $wpdb->prefix . "esp_price_type";
483
+		if ($this->_get_table_analysis()->tableExists($price_type_table)) {
484
+			$SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table;
485
+			$price_types_exist = $wpdb->get_var($SQL);
486
+			if ( ! $price_types_exist) {
487
+				$user_id = EEH_Activation::get_default_creator_id();
488
+				$SQL = "INSERT INTO $price_type_table ( PRT_ID, PRT_name, PBT_ID, PRT_is_percent, PRT_order, PRT_wp_user, PRT_deleted ) VALUES
489 489
 							(1, '" . __('Base Price', 'event_espresso') . "', 1,  0, 0, $user_id, 0),
490 490
 							(2, '" . __('Percent Discount', 'event_espresso') . "', 2,  1, 20, $user_id, 0),
491 491
 							(3, '" . __('Dollar Discount', 'event_espresso') . "', 2,  0, 30, $user_id, 0),
492 492
 							(4, '" . __('Percent Surcharge', 'event_espresso') . "', 3,  1, 40, $user_id,  0),
493 493
 							(5, '" . __('Dollar Surcharge', 'event_espresso') . "', 3,  0, 50, $user_id, 0);";
494
-                $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_price_types__SQL', $SQL);
495
-                $wpdb->query($SQL);
496
-            }
497
-        }
498
-    }
499
-
500
-
501
-
502
-    /**
503
-     * insert DEFAULT prices.
504
-     *  If we're INSTALLING 4.x CAF, then we add a few extra DEFAULT prices
505
-     * when EEH_Activaion's initialize_db_content is called via  ahook in
506
-     * EE_Brewing_regular
507
-     *
508
-     * @since 4.5.0
509
-     * @return void
510
-     */
511
-    public function insert_default_prices()
512
-    {
513
-        global $wpdb;
514
-        $price_table = $wpdb->prefix . "esp_price";
515
-        if ($this->_get_table_analysis()->tableExists($price_table)) {
516
-            $SQL = 'SELECT COUNT(PRC_ID) FROM ' . $price_table;
517
-            $prices_exist = $wpdb->get_var($SQL);
518
-            if ( ! $prices_exist) {
519
-                $user_id = EEH_Activation::get_default_creator_id();
520
-                $SQL = "INSERT INTO $price_table
494
+				$SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_price_types__SQL', $SQL);
495
+				$wpdb->query($SQL);
496
+			}
497
+		}
498
+	}
499
+
500
+
501
+
502
+	/**
503
+	 * insert DEFAULT prices.
504
+	 *  If we're INSTALLING 4.x CAF, then we add a few extra DEFAULT prices
505
+	 * when EEH_Activaion's initialize_db_content is called via  ahook in
506
+	 * EE_Brewing_regular
507
+	 *
508
+	 * @since 4.5.0
509
+	 * @return void
510
+	 */
511
+	public function insert_default_prices()
512
+	{
513
+		global $wpdb;
514
+		$price_table = $wpdb->prefix . "esp_price";
515
+		if ($this->_get_table_analysis()->tableExists($price_table)) {
516
+			$SQL = 'SELECT COUNT(PRC_ID) FROM ' . $price_table;
517
+			$prices_exist = $wpdb->get_var($SQL);
518
+			if ( ! $prices_exist) {
519
+				$user_id = EEH_Activation::get_default_creator_id();
520
+				$SQL = "INSERT INTO $price_table
521 521
 							(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
522 522
 							(1, 1, '0.00', 'Free Admission', '', 1, NULL, $user_id, 0, 0, 0);";
523
-                $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_prices__SQL', $SQL);
524
-                $wpdb->query($SQL);
525
-            }
526
-        }
527
-    }
528
-
529
-
530
-
531
-    /**
532
-     * insert DEFAULT ticket
533
-     * Almost identical to EE_DMS_Core_4_3_0::insert_default_tickets, except is aware of the TKT_wp_user field
534
-     *
535
-     * @since 4.5.0
536
-     * @return void
537
-     */
538
-    public function insert_default_tickets()
539
-    {
540
-        global $wpdb;
541
-        $ticket_table = $wpdb->prefix . "esp_ticket";
542
-        if ($this->_get_table_analysis()->tableExists($ticket_table)) {
543
-            $SQL = 'SELECT COUNT(TKT_ID) FROM ' . $ticket_table;
544
-            $tickets_exist = $wpdb->get_var($SQL);
545
-            if ( ! $tickets_exist) {
546
-                $user_id = EEH_Activation::get_default_creator_id();
547
-                $SQL = "INSERT INTO $ticket_table
523
+				$SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_prices__SQL', $SQL);
524
+				$wpdb->query($SQL);
525
+			}
526
+		}
527
+	}
528
+
529
+
530
+
531
+	/**
532
+	 * insert DEFAULT ticket
533
+	 * Almost identical to EE_DMS_Core_4_3_0::insert_default_tickets, except is aware of the TKT_wp_user field
534
+	 *
535
+	 * @since 4.5.0
536
+	 * @return void
537
+	 */
538
+	public function insert_default_tickets()
539
+	{
540
+		global $wpdb;
541
+		$ticket_table = $wpdb->prefix . "esp_ticket";
542
+		if ($this->_get_table_analysis()->tableExists($ticket_table)) {
543
+			$SQL = 'SELECT COUNT(TKT_ID) FROM ' . $ticket_table;
544
+			$tickets_exist = $wpdb->get_var($SQL);
545
+			if ( ! $tickets_exist) {
546
+				$user_id = EEH_Activation::get_default_creator_id();
547
+				$SQL = "INSERT INTO $ticket_table
548 548
 					( 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
549 549
 					( 1, 0, '"
550
-                       . __("Free Ticket", "event_espresso")
551
-                       . "', '', 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);";
552
-                $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_tickets__SQL', $SQL);
553
-                $wpdb->query($SQL);
554
-            }
555
-        }
556
-        $ticket_price_table = $wpdb->prefix . "esp_ticket_price";
557
-        if ($this->_get_table_analysis()->tableExists($ticket_price_table)) {
558
-            $SQL = 'SELECT COUNT(TKP_ID) FROM ' . $ticket_price_table;
559
-            $ticket_prc_exist = $wpdb->get_var($SQL);
560
-            if ( ! $ticket_prc_exist) {
561
-                $SQL = "INSERT INTO $ticket_price_table
550
+					   . __("Free Ticket", "event_espresso")
551
+					   . "', '', 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);";
552
+				$SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_tickets__SQL', $SQL);
553
+				$wpdb->query($SQL);
554
+			}
555
+		}
556
+		$ticket_price_table = $wpdb->prefix . "esp_ticket_price";
557
+		if ($this->_get_table_analysis()->tableExists($ticket_price_table)) {
558
+			$SQL = 'SELECT COUNT(TKP_ID) FROM ' . $ticket_price_table;
559
+			$ticket_prc_exist = $wpdb->get_var($SQL);
560
+			if ( ! $ticket_prc_exist) {
561
+				$SQL = "INSERT INTO $ticket_price_table
562 562
 				( TKP_ID, TKT_ID, PRC_ID ) VALUES
563 563
 				( 1, 1, 1 )
564 564
 				";
565
-                $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_tickets__SQL__ticket_price', $SQL);
566
-                $wpdb->query($SQL);
567
-            }
568
-        }
569
-    }
565
+				$SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_tickets__SQL__ticket_price', $SQL);
566
+				$wpdb->query($SQL);
567
+			}
568
+		}
569
+	}
570 570
 
571 571
 }
572 572
 
Please login to merge, or discard this patch.