Completed
Branch FET/add-loco-translate-support (7d9689)
by
unknown
26:14 queued 18:13
created
core/data_migration_scripts/4_6_0_stages/EE_DMS_4_6_0_gateways.dmsstage.php 2 patches
Indentation   +256 added lines, -256 removed lines patch added patch discarded remove patch
@@ -14,277 +14,277 @@
 block discarded – undo
14 14
 class EE_DMS_4_6_0_gateways extends EE_Data_Migration_Script_Stage
15 15
 {
16 16
 
17
-    protected $_new_table_name;
18
-    protected $_extra_meta_table_name;
19
-    protected $_currency_table_name;
20
-    protected $_currency_payment_method_table_name;
17
+	protected $_new_table_name;
18
+	protected $_extra_meta_table_name;
19
+	protected $_currency_table_name;
20
+	protected $_currency_payment_method_table_name;
21 21
 
22
-    /**
23
-     * each key is the name of a 4.1-style gateway we know how to migrate to 4.6
24
-     * @var array
25
-     */
26
-    protected $_gateway_we_know_to_migrate = array(
27
-        'Aim',
28
-        'Bank',
29
-        'Check',
30
-        'Invoice',
31
-        'Mijireh',
32
-        'Paypal_Pro',
33
-        'Paypal_Standard',
34
-    );
22
+	/**
23
+	 * each key is the name of a 4.1-style gateway we know how to migrate to 4.6
24
+	 * @var array
25
+	 */
26
+	protected $_gateway_we_know_to_migrate = array(
27
+		'Aim',
28
+		'Bank',
29
+		'Check',
30
+		'Invoice',
31
+		'Mijireh',
32
+		'Paypal_Pro',
33
+		'Paypal_Standard',
34
+	);
35 35
 
36 36
 
37 37
 
38
-    /**
39
-     * Just initializes the status of the migration
40
-     */
41
-    public function __construct()
42
-    {
43
-        global $wpdb;
44
-        $this->_new_table_name = $wpdb->prefix."esp_payment_method";
45
-        $this->_extra_meta_table_name = $wpdb->prefix."esp_extra_meta";
46
-        $this->_currency_table_name = $wpdb->prefix."esp_currency";
47
-        $this->_currency_payment_method_table_name = $wpdb->prefix."esp_currency_payment_method";
48
-        $this->_pretty_name = __('Gateways', 'event_espresso');
49
-        parent::__construct();
50
-    }
38
+	/**
39
+	 * Just initializes the status of the migration
40
+	 */
41
+	public function __construct()
42
+	{
43
+		global $wpdb;
44
+		$this->_new_table_name = $wpdb->prefix."esp_payment_method";
45
+		$this->_extra_meta_table_name = $wpdb->prefix."esp_extra_meta";
46
+		$this->_currency_table_name = $wpdb->prefix."esp_currency";
47
+		$this->_currency_payment_method_table_name = $wpdb->prefix."esp_currency_payment_method";
48
+		$this->_pretty_name = __('Gateways', 'event_espresso');
49
+		parent::__construct();
50
+	}
51 51
 
52 52
 
53 53
 
54
-    /**
55
-     * Counts the records to migrate; the public version may cache it
56
-     * @return int
57
-     */
58
-    protected function _count_records_to_migrate()
59
-    {
60
-        return count(EE_Config::instance()->gateway->payment_settings);
61
-    }
54
+	/**
55
+	 * Counts the records to migrate; the public version may cache it
56
+	 * @return int
57
+	 */
58
+	protected function _count_records_to_migrate()
59
+	{
60
+		return count(EE_Config::instance()->gateway->payment_settings);
61
+	}
62 62
 
63 63
 
64 64
 
65
-    /**
66
-     * IMPORTANT: if an error is encountered, or everything is finished, this stage should update its status property accordingly.
67
-     * Note: it should not alter the count of items migrated. That is done in the public function that calls this.
68
-     * IMPORTANT: The count of items migrated should ONLY be less than $num_items_to_migrate when it's the last migration step, otherwise it
69
-     * should always return $num_items_to_migrate. (Eg, if we're migrating attendees rows from the database, and $num_items_to_migrate is set to 50,
70
-     * then we SHOULD actually migrate 50 rows,but at very least we MUST report/return 50 items migrated)
71
-     * @param int $num_items_to_migrate
72
-     * @return int number of items ACTUALLY migrated
73
-     */
74
-    protected function _migration_step($num_items_to_migrate = 50)
75
-    {
76
-        $items_actually_migrated = 0;
77
-        $gateways_to_deal_with = array_slice(EE_Config::instance()->gateway->payment_settings, $this->count_records_migrated(), $num_items_to_migrate);
78
-        foreach ($gateways_to_deal_with as $old_gateway_slug => $old_gateway_settings) {
79
-            if (in_array($old_gateway_slug, $this->_gateway_we_know_to_migrate)) {
80
-                if (! $old_gateway_settings) {
81
-                    // no settings existed for this gateway anyways... weird...
82
-                    $items_actually_migrated++;
83
-                    continue;
84
-                }
85
-                // now prepare the settings to make sure they're in the 4.1 format
86
-                $success = $this->_convert_gateway_settings(
87
-                    $old_gateway_slug,
88
-                    $old_gateway_settings,
89
-                    isset(EE_Config::instance()->gateway->active_gateways[ $old_gateway_slug ])
90
-                );
91
-                if ($success) {
92
-                    EE_Config::instance()->gateway->payment_settings[ $old_gateway_slug ] = 'Deprecated';
93
-                }
94
-            }
95
-            $items_actually_migrated++;
96
-        }
65
+	/**
66
+	 * IMPORTANT: if an error is encountered, or everything is finished, this stage should update its status property accordingly.
67
+	 * Note: it should not alter the count of items migrated. That is done in the public function that calls this.
68
+	 * IMPORTANT: The count of items migrated should ONLY be less than $num_items_to_migrate when it's the last migration step, otherwise it
69
+	 * should always return $num_items_to_migrate. (Eg, if we're migrating attendees rows from the database, and $num_items_to_migrate is set to 50,
70
+	 * then we SHOULD actually migrate 50 rows,but at very least we MUST report/return 50 items migrated)
71
+	 * @param int $num_items_to_migrate
72
+	 * @return int number of items ACTUALLY migrated
73
+	 */
74
+	protected function _migration_step($num_items_to_migrate = 50)
75
+	{
76
+		$items_actually_migrated = 0;
77
+		$gateways_to_deal_with = array_slice(EE_Config::instance()->gateway->payment_settings, $this->count_records_migrated(), $num_items_to_migrate);
78
+		foreach ($gateways_to_deal_with as $old_gateway_slug => $old_gateway_settings) {
79
+			if (in_array($old_gateway_slug, $this->_gateway_we_know_to_migrate)) {
80
+				if (! $old_gateway_settings) {
81
+					// no settings existed for this gateway anyways... weird...
82
+					$items_actually_migrated++;
83
+					continue;
84
+				}
85
+				// now prepare the settings to make sure they're in the 4.1 format
86
+				$success = $this->_convert_gateway_settings(
87
+					$old_gateway_slug,
88
+					$old_gateway_settings,
89
+					isset(EE_Config::instance()->gateway->active_gateways[ $old_gateway_slug ])
90
+				);
91
+				if ($success) {
92
+					EE_Config::instance()->gateway->payment_settings[ $old_gateway_slug ] = 'Deprecated';
93
+				}
94
+			}
95
+			$items_actually_migrated++;
96
+		}
97 97
 
98
-        EE_Config::instance()->update_espresso_config(false, false);
99
-        if ($this->count_records_migrated() + $items_actually_migrated >= $this->count_records_to_migrate()) {
100
-            $this->set_completed();
101
-        }
102
-        return $items_actually_migrated;
103
-    }
98
+		EE_Config::instance()->update_espresso_config(false, false);
99
+		if ($this->count_records_migrated() + $items_actually_migrated >= $this->count_records_to_migrate()) {
100
+			$this->set_completed();
101
+		}
102
+		return $items_actually_migrated;
103
+	}
104 104
 
105
-    /**
106
-     * Converts the 4.1-style gateway to a 4.6-style payment method and saves it to the DB
107
-     * @param string $old_gateway_slug
108
-     * @param array $old_gateway_settings
109
-     * @param boolean $active indicates the gateway is currently active
110
-     * @return boolean success
111
-     */
112
-    protected function _convert_gateway_settings($old_gateway_slug, $old_gateway_settings, $active)
113
-    {
114
-        switch ($old_gateway_slug) {
115
-            case 'Aim':
116
-                $extra_meta_key_values = array(
117
-                    'login_id'=>$old_gateway_settings['authnet_aim_login_id'],
118
-                    'transaction_key'=>$old_gateway_settings['authnet_aim_transaction_key'],
119
-                    'test_transactions'=>$old_gateway_settings['test_transactions']
120
-                );
121
-                $desc = __('Please provide the following billing information.', 'event_espresso');
122
-                break;
123
-            case 'Bank':
124
-                $extra_meta_key_values = array(
125
-                    'page_title'=>$old_gateway_settings['page_title'],
126
-                    'payment_instructions'=>
127
-                    sprintf(__('%1$s<br/>Name on Bank Account: %2$s<br/>Bank Account Number: %3$s<br/>Bank Name: %4$s<br/>Bank Address:%5$s', 'event_espresso'), $old_gateway_settings['bank_instructions'], $old_gateway_settings['account_name'], $old_gateway_settings['account_number'], $old_gateway_settings['bank_name'], $old_gateway_settings['bank_address']) );
128
-                $desc = __('Make payment using an electronic funds transfer from your bank.', 'event_espresso');
129
-                break;
130
-            case 'Check':
131
-                $extra_meta_key_values = array(
132
-                    'check_title'=> $old_gateway_settings['check_title'],
133
-                    'payment_instructions'=>$old_gateway_settings['check_instructions'],
134
-                    'address_to_send_payment'=>$old_gateway_settings['payment_address']
135
-                );
136
-                $desc = __('On the next page you will be given instructions on how to make a payment by check.', 'event_espresso');
137
-                break;
138
-            case 'Invoice':
139
-                $extra_meta_key_values = array(
140
-                    'pdf_payee_name' => $old_gateway_settings['template_invoice_payee_name'],
141
-                    'pdf_payee_email' => $old_gateway_settings['template_invoice_email'],
142
-                    'pdf_payee_tax_number' => $old_gateway_settings['template_invoice_tax_number'],
143
-                    'pdf_payee_address' => $old_gateway_settings['template_invoice_address'],
144
-                    'pdf_instructions' => $old_gateway_settings['template_payment_instructions'],
145
-                    'pdf_logo_image' => $old_gateway_settings['invoice_logo_url'],
146
-                    'page_confirmation_text' => isset($old_gateway_settings['page_instructions']) ? $old_gateway_settings['page_instructions'] : '',
147
-                    'page_extra_info' => isset($old_gateway_settings['payment_address']) ? $old_gateway_settings['payment_address'] : '',
148
-                    'legacy_invoice_css' => $old_gateway_settings['invoice_css']
149
-                );
150
-                // if they didnt want the invoiec gateway to show, pretend it was inactive
151
-                if (! $old_gateway_settings['show']) {
152
-                    $active = false;
153
-                }
154
-                $desc = __('On the next page you will be able to access your invoice and instructions on how to pay it.', 'event_espresso');
155
-                break;
156
-            case 'Mijireh':
157
-                $extra_meta_key_values = array(
158
-                    'access_key' => $old_gateway_settings['access_key']
159
-                );
160
-                $desc =  __('On the next page you will be able to enter your billing information to make the payment.', 'event_espresso');
161
-                break;
162
-            case 'Paypal_Pro':
163
-                $extra_meta_key_values = array(
164
-                    'username'=>$old_gateway_settings['username'],
165
-                    'password'=>$old_gateway_settings['password'],
166
-                    'signature'=>$old_gateway_settings['signature'],
167
-                    'credit_card_types'=>$old_gateway_settings['credit_cards'],
168
-                );
169
-                $desc = __('Please provide the following billing information.', 'event_espresso');
170
-                break;
171
-            case 'Paypal_Standard':
172
-                $extra_meta_key_values = array(
173
-                    'paypal_id' => $old_gateway_settings['paypal_id'],
174
-                    'image_url' => $old_gateway_settings['image_url'],
175
-                    'shipping_details' => isset($old_gateway_settings['no_shipping']) ? $old_gateway_settings['no_shipping'] : false,
105
+	/**
106
+	 * Converts the 4.1-style gateway to a 4.6-style payment method and saves it to the DB
107
+	 * @param string $old_gateway_slug
108
+	 * @param array $old_gateway_settings
109
+	 * @param boolean $active indicates the gateway is currently active
110
+	 * @return boolean success
111
+	 */
112
+	protected function _convert_gateway_settings($old_gateway_slug, $old_gateway_settings, $active)
113
+	{
114
+		switch ($old_gateway_slug) {
115
+			case 'Aim':
116
+				$extra_meta_key_values = array(
117
+					'login_id'=>$old_gateway_settings['authnet_aim_login_id'],
118
+					'transaction_key'=>$old_gateway_settings['authnet_aim_transaction_key'],
119
+					'test_transactions'=>$old_gateway_settings['test_transactions']
120
+				);
121
+				$desc = __('Please provide the following billing information.', 'event_espresso');
122
+				break;
123
+			case 'Bank':
124
+				$extra_meta_key_values = array(
125
+					'page_title'=>$old_gateway_settings['page_title'],
126
+					'payment_instructions'=>
127
+					sprintf(__('%1$s<br/>Name on Bank Account: %2$s<br/>Bank Account Number: %3$s<br/>Bank Name: %4$s<br/>Bank Address:%5$s', 'event_espresso'), $old_gateway_settings['bank_instructions'], $old_gateway_settings['account_name'], $old_gateway_settings['account_number'], $old_gateway_settings['bank_name'], $old_gateway_settings['bank_address']) );
128
+				$desc = __('Make payment using an electronic funds transfer from your bank.', 'event_espresso');
129
+				break;
130
+			case 'Check':
131
+				$extra_meta_key_values = array(
132
+					'check_title'=> $old_gateway_settings['check_title'],
133
+					'payment_instructions'=>$old_gateway_settings['check_instructions'],
134
+					'address_to_send_payment'=>$old_gateway_settings['payment_address']
135
+				);
136
+				$desc = __('On the next page you will be given instructions on how to make a payment by check.', 'event_espresso');
137
+				break;
138
+			case 'Invoice':
139
+				$extra_meta_key_values = array(
140
+					'pdf_payee_name' => $old_gateway_settings['template_invoice_payee_name'],
141
+					'pdf_payee_email' => $old_gateway_settings['template_invoice_email'],
142
+					'pdf_payee_tax_number' => $old_gateway_settings['template_invoice_tax_number'],
143
+					'pdf_payee_address' => $old_gateway_settings['template_invoice_address'],
144
+					'pdf_instructions' => $old_gateway_settings['template_payment_instructions'],
145
+					'pdf_logo_image' => $old_gateway_settings['invoice_logo_url'],
146
+					'page_confirmation_text' => isset($old_gateway_settings['page_instructions']) ? $old_gateway_settings['page_instructions'] : '',
147
+					'page_extra_info' => isset($old_gateway_settings['payment_address']) ? $old_gateway_settings['payment_address'] : '',
148
+					'legacy_invoice_css' => $old_gateway_settings['invoice_css']
149
+				);
150
+				// if they didnt want the invoiec gateway to show, pretend it was inactive
151
+				if (! $old_gateway_settings['show']) {
152
+					$active = false;
153
+				}
154
+				$desc = __('On the next page you will be able to access your invoice and instructions on how to pay it.', 'event_espresso');
155
+				break;
156
+			case 'Mijireh':
157
+				$extra_meta_key_values = array(
158
+					'access_key' => $old_gateway_settings['access_key']
159
+				);
160
+				$desc =  __('On the next page you will be able to enter your billing information to make the payment.', 'event_espresso');
161
+				break;
162
+			case 'Paypal_Pro':
163
+				$extra_meta_key_values = array(
164
+					'username'=>$old_gateway_settings['username'],
165
+					'password'=>$old_gateway_settings['password'],
166
+					'signature'=>$old_gateway_settings['signature'],
167
+					'credit_card_types'=>$old_gateway_settings['credit_cards'],
168
+				);
169
+				$desc = __('Please provide the following billing information.', 'event_espresso');
170
+				break;
171
+			case 'Paypal_Standard':
172
+				$extra_meta_key_values = array(
173
+					'paypal_id' => $old_gateway_settings['paypal_id'],
174
+					'image_url' => $old_gateway_settings['image_url'],
175
+					'shipping_details' => isset($old_gateway_settings['no_shipping']) ? $old_gateway_settings['no_shipping'] : false,
176 176
 
177
-                );
178
-                $desc = sprintf(__('After clicking \'Finalize Registration\', you will be forwarded to PayPal to make your payment. Make sure you return to this site in order to properly finalize your registration.', 'event_espresso'), '<strong>', '</strong>');
179
-                break;
180
-            default:
181
-                // if we don't recognize the payment method, just put everything in it into extra meta. At least this way its preserved somewhere
182
-                $extra_meta_key_values = $old_gateway_settings;
183
-                $desc = '';
184
-        }
185
-        $pretty_name = isset($old_gateway_settings['display_name']) ? $old_gateway_settings['display_name'] : $old_gateway_slug;
186
-        $offline_gateways = array( 'Bank', 'Check', 'Invoice' );
187
-        if ($active && in_array($old_gateway_slug, $offline_gateways)) {
188
-            $scope = array( 'CART', 'ADMIN');
189
-        } elseif ($active && ! in_array($old_gateway_slug, $offline_gateways)) {
190
-            $scope = array( 'CART' );
191
-        } elseif (! $active && in_array($old_gateway_slug, $offline_gateways)) {
192
-            $scope = array( 'ADMIN' );
193
-        } else {
194
-            $scope = array();
195
-        }
196
-        $payment_method_col_values = array(
197
-            'PMD_type' => $old_gateway_slug,
198
-            'PMD_name' => $pretty_name,
199
-            'PMD_desc' => $desc,
200
-            'PMD_admin_name' => $pretty_name,
201
-            'PMD_slug' => sanitize_key($old_gateway_slug),
202
-            'PMD_debug_mode' => isset($old_gateway_settings['use_sandbox']) ? $old_gateway_settings['use_sandbox'] : false,
203
-            'PMD_button_url' => isset($old_gateway_settings['button_url']) ? $old_gateway_settings['button_url'] : null,
204
-            'PMD_scope' =>  serialize($scope)
205
-        );
206
-        $db_types = array(
207
-            '%s',// PMD_type
208
-            '%s',// PMD_name
209
-            '%s',// PMD_desc
210
-            '%s',// PMD_admin_name
211
-            '%s',// PMD_slug
212
-            '%d',// PMD_debug_mode
213
-            '%s',// PMD_button_url
214
-            '%s',// PMD_scope
215
-        );
216
-        global $wpdb;
217
-        // first: check if it already exists
218
-        $id = $wpdb->get_var($wpdb->prepare("SELECT PMD_ID FROM {$this->_new_table_name} WHERE PMD_slug=%s", $payment_method_col_values['PMD_slug']));
219
-        if ($id) {
220
-            // just update that payment method instead of creating a new one
221
-            $success = $wpdb->update(
222
-                $this->_new_table_name,
223
-                $payment_method_col_values,
224
-                array(
225
-                        'PMD_ID'=>$id
226
-                    ),
227
-                $db_types,
228
-                array(
229
-                        '%d',// PMD_ID
230
-                    )
231
-            );
232
-            if (! $success) {
233
-                $this->add_error(sprintf(__('Could not update payment method %d with properties %s because %s', "event_espresso"), $id, wp_json_encode($payment_method_col_values), $wpdb->last_error));
234
-            }
235
-        } else {
236
-            $success = $wpdb->insert(
237
-                $this->_new_table_name,
238
-                $payment_method_col_values,
239
-                $db_types
240
-            );
241
-            if (! $success) {
242
-                $this->add_error($wpdb->last_error);
243
-                return false;
244
-            } else {
245
-                $id = $wpdb->insert_id;
246
-            }
247
-        }
177
+				);
178
+				$desc = sprintf(__('After clicking \'Finalize Registration\', you will be forwarded to PayPal to make your payment. Make sure you return to this site in order to properly finalize your registration.', 'event_espresso'), '<strong>', '</strong>');
179
+				break;
180
+			default:
181
+				// if we don't recognize the payment method, just put everything in it into extra meta. At least this way its preserved somewhere
182
+				$extra_meta_key_values = $old_gateway_settings;
183
+				$desc = '';
184
+		}
185
+		$pretty_name = isset($old_gateway_settings['display_name']) ? $old_gateway_settings['display_name'] : $old_gateway_slug;
186
+		$offline_gateways = array( 'Bank', 'Check', 'Invoice' );
187
+		if ($active && in_array($old_gateway_slug, $offline_gateways)) {
188
+			$scope = array( 'CART', 'ADMIN');
189
+		} elseif ($active && ! in_array($old_gateway_slug, $offline_gateways)) {
190
+			$scope = array( 'CART' );
191
+		} elseif (! $active && in_array($old_gateway_slug, $offline_gateways)) {
192
+			$scope = array( 'ADMIN' );
193
+		} else {
194
+			$scope = array();
195
+		}
196
+		$payment_method_col_values = array(
197
+			'PMD_type' => $old_gateway_slug,
198
+			'PMD_name' => $pretty_name,
199
+			'PMD_desc' => $desc,
200
+			'PMD_admin_name' => $pretty_name,
201
+			'PMD_slug' => sanitize_key($old_gateway_slug),
202
+			'PMD_debug_mode' => isset($old_gateway_settings['use_sandbox']) ? $old_gateway_settings['use_sandbox'] : false,
203
+			'PMD_button_url' => isset($old_gateway_settings['button_url']) ? $old_gateway_settings['button_url'] : null,
204
+			'PMD_scope' =>  serialize($scope)
205
+		);
206
+		$db_types = array(
207
+			'%s',// PMD_type
208
+			'%s',// PMD_name
209
+			'%s',// PMD_desc
210
+			'%s',// PMD_admin_name
211
+			'%s',// PMD_slug
212
+			'%d',// PMD_debug_mode
213
+			'%s',// PMD_button_url
214
+			'%s',// PMD_scope
215
+		);
216
+		global $wpdb;
217
+		// first: check if it already exists
218
+		$id = $wpdb->get_var($wpdb->prepare("SELECT PMD_ID FROM {$this->_new_table_name} WHERE PMD_slug=%s", $payment_method_col_values['PMD_slug']));
219
+		if ($id) {
220
+			// just update that payment method instead of creating a new one
221
+			$success = $wpdb->update(
222
+				$this->_new_table_name,
223
+				$payment_method_col_values,
224
+				array(
225
+						'PMD_ID'=>$id
226
+					),
227
+				$db_types,
228
+				array(
229
+						'%d',// PMD_ID
230
+					)
231
+			);
232
+			if (! $success) {
233
+				$this->add_error(sprintf(__('Could not update payment method %d with properties %s because %s', "event_espresso"), $id, wp_json_encode($payment_method_col_values), $wpdb->last_error));
234
+			}
235
+		} else {
236
+			$success = $wpdb->insert(
237
+				$this->_new_table_name,
238
+				$payment_method_col_values,
239
+				$db_types
240
+			);
241
+			if (! $success) {
242
+				$this->add_error($wpdb->last_error);
243
+				return false;
244
+			} else {
245
+				$id = $wpdb->insert_id;
246
+			}
247
+		}
248 248
 
249
-        if ($id) {
250
-            $this->_convert_extra_meta_values($id, $extra_meta_key_values);
251
-            $this->get_migration_script()->set_mapping('EE_Gateway_Config', $old_gateway_slug, $this->_new_table_name, $id);
252
-            return true;
253
-        }
254
-        return false;
255
-    }
249
+		if ($id) {
250
+			$this->_convert_extra_meta_values($id, $extra_meta_key_values);
251
+			$this->get_migration_script()->set_mapping('EE_Gateway_Config', $old_gateway_slug, $this->_new_table_name, $id);
252
+			return true;
253
+		}
254
+		return false;
255
+	}
256 256
 
257 257
 
258 258
 
259
-    /**
260
-     * Converts old gateway settings which don't map onto the Payment_Method model
261
-     * to extra meta fields
262
-     * @param int $id
263
-     * @param array $extra_meta_key_values
264
-     */
265
-    private function _convert_extra_meta_values($id, $extra_meta_key_values)
266
-    {
267
-        global $wpdb;
268
-        foreach ($extra_meta_key_values as $key => $value) {
269
-            $exm_args = array(
270
-                'OBJ_ID'=>$id,
271
-                'EXM_type'=>'Payment_Method',
272
-                'EXM_key'=>$key,
273
-                'EXM_value'=> maybe_serialize($value)
274
-            );
275
-            $success = $wpdb->insert(
276
-                $this->_extra_meta_table_name,
277
-                $exm_args,
278
-                array(
279
-                        '%d',// OBJ_ID
280
-                        '%s',// EXM_type
281
-                        '%s',// EXM_key
282
-                        '%s',// EXM_value
283
-                    )
284
-            );
285
-            if (! $success) {
286
-                $this->add_error(sprintf(__('Could not insert extra meta key with values %s. %s', "event_espresso"), wp_json_encode($exm_args), $wpdb->last_error));
287
-            }
288
-        }
289
-    }
259
+	/**
260
+	 * Converts old gateway settings which don't map onto the Payment_Method model
261
+	 * to extra meta fields
262
+	 * @param int $id
263
+	 * @param array $extra_meta_key_values
264
+	 */
265
+	private function _convert_extra_meta_values($id, $extra_meta_key_values)
266
+	{
267
+		global $wpdb;
268
+		foreach ($extra_meta_key_values as $key => $value) {
269
+			$exm_args = array(
270
+				'OBJ_ID'=>$id,
271
+				'EXM_type'=>'Payment_Method',
272
+				'EXM_key'=>$key,
273
+				'EXM_value'=> maybe_serialize($value)
274
+			);
275
+			$success = $wpdb->insert(
276
+				$this->_extra_meta_table_name,
277
+				$exm_args,
278
+				array(
279
+						'%d',// OBJ_ID
280
+						'%s',// EXM_type
281
+						'%s',// EXM_key
282
+						'%s',// EXM_value
283
+					)
284
+			);
285
+			if (! $success) {
286
+				$this->add_error(sprintf(__('Could not insert extra meta key with values %s. %s', "event_espresso"), wp_json_encode($exm_args), $wpdb->last_error));
287
+			}
288
+		}
289
+	}
290 290
 }
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
         $gateways_to_deal_with = array_slice(EE_Config::instance()->gateway->payment_settings, $this->count_records_migrated(), $num_items_to_migrate);
78 78
         foreach ($gateways_to_deal_with as $old_gateway_slug => $old_gateway_settings) {
79 79
             if (in_array($old_gateway_slug, $this->_gateway_we_know_to_migrate)) {
80
-                if (! $old_gateway_settings) {
80
+                if ( ! $old_gateway_settings) {
81 81
                     // no settings existed for this gateway anyways... weird...
82 82
                     $items_actually_migrated++;
83 83
                     continue;
@@ -86,10 +86,10 @@  discard block
 block discarded – undo
86 86
                 $success = $this->_convert_gateway_settings(
87 87
                     $old_gateway_slug,
88 88
                     $old_gateway_settings,
89
-                    isset(EE_Config::instance()->gateway->active_gateways[ $old_gateway_slug ])
89
+                    isset(EE_Config::instance()->gateway->active_gateways[$old_gateway_slug])
90 90
                 );
91 91
                 if ($success) {
92
-                    EE_Config::instance()->gateway->payment_settings[ $old_gateway_slug ] = 'Deprecated';
92
+                    EE_Config::instance()->gateway->payment_settings[$old_gateway_slug] = 'Deprecated';
93 93
                 }
94 94
             }
95 95
             $items_actually_migrated++;
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
                     'legacy_invoice_css' => $old_gateway_settings['invoice_css']
149 149
                 );
150 150
                 // if they didnt want the invoiec gateway to show, pretend it was inactive
151
-                if (! $old_gateway_settings['show']) {
151
+                if ( ! $old_gateway_settings['show']) {
152 152
                     $active = false;
153 153
                 }
154 154
                 $desc = __('On the next page you will be able to access your invoice and instructions on how to pay it.', 'event_espresso');
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
                 $extra_meta_key_values = array(
158 158
                     'access_key' => $old_gateway_settings['access_key']
159 159
                 );
160
-                $desc =  __('On the next page you will be able to enter your billing information to make the payment.', 'event_espresso');
160
+                $desc = __('On the next page you will be able to enter your billing information to make the payment.', 'event_espresso');
161 161
                 break;
162 162
             case 'Paypal_Pro':
163 163
                 $extra_meta_key_values = array(
@@ -183,13 +183,13 @@  discard block
 block discarded – undo
183 183
                 $desc = '';
184 184
         }
185 185
         $pretty_name = isset($old_gateway_settings['display_name']) ? $old_gateway_settings['display_name'] : $old_gateway_slug;
186
-        $offline_gateways = array( 'Bank', 'Check', 'Invoice' );
186
+        $offline_gateways = array('Bank', 'Check', 'Invoice');
187 187
         if ($active && in_array($old_gateway_slug, $offline_gateways)) {
188
-            $scope = array( 'CART', 'ADMIN');
188
+            $scope = array('CART', 'ADMIN');
189 189
         } elseif ($active && ! in_array($old_gateway_slug, $offline_gateways)) {
190
-            $scope = array( 'CART' );
191
-        } elseif (! $active && in_array($old_gateway_slug, $offline_gateways)) {
192
-            $scope = array( 'ADMIN' );
190
+            $scope = array('CART');
191
+        } elseif ( ! $active && in_array($old_gateway_slug, $offline_gateways)) {
192
+            $scope = array('ADMIN');
193 193
         } else {
194 194
             $scope = array();
195 195
         }
@@ -204,14 +204,14 @@  discard block
 block discarded – undo
204 204
             'PMD_scope' =>  serialize($scope)
205 205
         );
206 206
         $db_types = array(
207
-            '%s',// PMD_type
208
-            '%s',// PMD_name
209
-            '%s',// PMD_desc
210
-            '%s',// PMD_admin_name
211
-            '%s',// PMD_slug
212
-            '%d',// PMD_debug_mode
213
-            '%s',// PMD_button_url
214
-            '%s',// PMD_scope
207
+            '%s', // PMD_type
208
+            '%s', // PMD_name
209
+            '%s', // PMD_desc
210
+            '%s', // PMD_admin_name
211
+            '%s', // PMD_slug
212
+            '%d', // PMD_debug_mode
213
+            '%s', // PMD_button_url
214
+            '%s', // PMD_scope
215 215
         );
216 216
         global $wpdb;
217 217
         // first: check if it already exists
@@ -226,10 +226,10 @@  discard block
 block discarded – undo
226 226
                     ),
227 227
                 $db_types,
228 228
                 array(
229
-                        '%d',// PMD_ID
229
+                        '%d', // PMD_ID
230 230
                     )
231 231
             );
232
-            if (! $success) {
232
+            if ( ! $success) {
233 233
                 $this->add_error(sprintf(__('Could not update payment method %d with properties %s because %s', "event_espresso"), $id, wp_json_encode($payment_method_col_values), $wpdb->last_error));
234 234
             }
235 235
         } else {
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
                 $payment_method_col_values,
239 239
                 $db_types
240 240
             );
241
-            if (! $success) {
241
+            if ( ! $success) {
242 242
                 $this->add_error($wpdb->last_error);
243 243
                 return false;
244 244
             } else {
@@ -276,13 +276,13 @@  discard block
 block discarded – undo
276 276
                 $this->_extra_meta_table_name,
277 277
                 $exm_args,
278 278
                 array(
279
-                        '%d',// OBJ_ID
280
-                        '%s',// EXM_type
281
-                        '%s',// EXM_key
282
-                        '%s',// EXM_value
279
+                        '%d', // OBJ_ID
280
+                        '%s', // EXM_type
281
+                        '%s', // EXM_key
282
+                        '%s', // EXM_value
283 283
                     )
284 284
             );
285
-            if (! $success) {
285
+            if ( ! $success) {
286 286
                 $this->add_error(sprintf(__('Could not insert extra meta key with values %s. %s', "event_espresso"), wp_json_encode($exm_args), $wpdb->last_error));
287 287
             }
288 288
         }
Please login to merge, or discard this patch.
4_7_0_stages/EE_DMS_4_7_0_Registration_Payments.dmsstage.php 2 patches
Indentation   +221 added lines, -221 removed lines patch added patch discarded remove patch
@@ -12,225 +12,225 @@
 block discarded – undo
12 12
 class EE_DMS_4_7_0_Registration_Payments extends EE_Data_Migration_Script_Stage_Table
13 13
 {
14 14
 
15
-    protected $_payment_table;
16
-
17
-    protected $_registration_table;
18
-
19
-    protected $_registration_payment_table;
20
-
21
-    public function __construct()
22
-    {
23
-        /** @type WPDB $wpdb */
24
-        global $wpdb;
25
-        $this->_pretty_name = __('Registration Payment Record Generation', 'event_espresso');
26
-        // define tables
27
-        $this->_old_table                                   = $wpdb->prefix . 'esp_transaction';
28
-        $this->_payment_table                       = $wpdb->prefix . 'esp_payment';
29
-        $this->_registration_table                  = $wpdb->prefix . 'esp_registration';
30
-        $this->_registration_payment_table  = $wpdb->prefix . 'esp_registration_payment';
31
-        // build SQL WHERE clauses
32
-        $this->_extra_where_sql = "WHERE STS_ID IN ( 'TIN', 'TCM' ) AND TXN_Total != '0.000'";
33
-        parent::__construct();
34
-    }
35
-
36
-
37
-
38
-    /**
39
-     * @param array $transaction
40
-     * @return void
41
-     */
42
-    protected function _migrate_old_row($transaction)
43
-    {
44
-        /** @type WPDB $wpdb */
45
-        global $wpdb;
46
-        $TXN_ID = absint($transaction['TXN_ID']);
47
-        if (! $TXN_ID) {
48
-            $this->add_error(
49
-                sprintf(
50
-                    __('Invalid transaction with ID=%1$d. Error: "%2$s"', 'event_espresso'),
51
-                    $TXN_ID,
52
-                    $wpdb->last_error
53
-                )
54
-            );
55
-            return;
56
-        }
57
-        // get all payments for the TXN
58
-        $payments = $this->_get_payments($TXN_ID);
59
-        if (empty($payments)) {
60
-            return;
61
-        }
62
-        // then the registrants
63
-        $registrations = $this->_get_registrations($TXN_ID);
64
-        if (empty($registrations)) {
65
-            return;
66
-        }
67
-        // now loop thru each payment and apply it to each of the registrations
68
-        foreach ($payments as $PAY_ID => $payment) {
69
-            if ($payment->STS_ID === 'PAP' && $payment->PAY_amount > 0) {
70
-                $this->_process_registration_payments($payment, $registrations);
71
-            }
72
-        }
73
-    }
74
-
75
-
76
-
77
-    /**
78
-     * _get_registrations
79
-     *
80
-     * @param int $TXN_ID
81
-     * @return array
82
-     */
83
-    protected function _get_registrations($TXN_ID)
84
-    {
85
-        /** @type WPDB $wpdb */
86
-        global $wpdb;
87
-        $SQL = "SELECT * FROM {$this->_registration_table} WHERE TXN_ID = %d AND STS_ID IN ( 'RPP', 'RAP' )";
88
-        return $wpdb->get_results($wpdb->prepare($SQL, $TXN_ID), OBJECT_K);
89
-    }
90
-
91
-
92
-
93
-    /**
94
-     * _get_payments
95
-     *
96
-     * @param int $TXN_ID
97
-     * @return array
98
-     */
99
-    protected function _get_payments($TXN_ID)
100
-    {
101
-        /** @type WPDB $wpdb */
102
-        global $wpdb;
103
-        return $wpdb->get_results($wpdb->prepare("SELECT * FROM {$this->_payment_table} WHERE TXN_ID = %d", $TXN_ID), OBJECT_K);
104
-    }
105
-
106
-
107
-
108
-    /**
109
-     * _get_possibly_updated_REG_paid
110
-     *
111
-     * @param int $REG_ID
112
-     * @return array
113
-     */
114
-    protected function _get_possibly_updated_REG_paid($REG_ID)
115
-    {
116
-        /** @type WPDB $wpdb */
117
-        global $wpdb;
118
-        return $wpdb->get_var($wpdb->prepare("SELECT REG_paid FROM {$this->_registration_table} WHERE REG_ID = %d", $REG_ID));
119
-    }
120
-
121
-
122
-
123
-    /**
124
-     * _process_registration_payments
125
-     *
126
-     * basically a copy of the "Sequential Registration Payment Application Strategy"  logic
127
-     * currently in EE_Payment_Processor::process_registration_payments()
128
-     *
129
-     * @param stdClass $payment
130
-     * @param array $registrations
131
-     * @return bool
132
-     */
133
-    protected function _process_registration_payments($payment, $registrations = array())
134
-    {
135
-        // how much is available to apply to registrations?
136
-        $available_payment_amount = $payment->PAY_amount;
137
-        foreach ($registrations as $REG_ID => $registration) {
138
-            // nothing left, then we are done here?
139
-            if (! $available_payment_amount > 0) {
140
-                break;
141
-            }
142
-            // ensure REG_final_price has a valid value, and skip if it turns out to be zero
143
-            $registration->REG_final_price = ! empty($registration->REG_final_price) ? (float) $registration->REG_final_price : 0.00;
144
-            if (! $registration->REG_final_price > 0) {
145
-                continue;
146
-            }
147
-            // because REG_paid may have been updated by a previous payment, we need to retrieve the value from the db
148
-            $possibly_updated_REG_paid = $this->_get_possibly_updated_REG_paid($REG_ID);
149
-            if (is_float($possibly_updated_REG_paid)) {
150
-                $registration->REG_paid = $possibly_updated_REG_paid;
151
-            }
152
-            // and ensure REG_paid has a valid value
153
-            $registration->REG_paid = ! empty($registration->REG_paid) ? (float) $registration->REG_paid : 0.00;
154
-            // calculate amount owing, and skip if it turns out to be zero
155
-            $owing = $registration->REG_final_price - $registration->REG_paid;
156
-            if (! $owing > 0) {
157
-                continue;
158
-            }
159
-            // don't allow payment amount to exceed the available payment amount, OR the amount owing
160
-            $payment_amount = min($available_payment_amount, $owing);
161
-            // update $available_payment_amount
162
-            $available_payment_amount = $available_payment_amount - $payment_amount;
163
-            // add relation between registration and payment and set amount
164
-            if ($this->_insert_registration_payment($registration->REG_ID, $payment->PAY_ID, $payment_amount)) {
165
-                // calculate and set new REG_paid
166
-                $registration->REG_paid = $registration->REG_paid + $payment_amount;
167
-                $this->_update_registration_paid($registration->REG_ID, $registration->REG_paid);
168
-            }
169
-        }
170
-    }
171
-
172
-
173
-
174
-    /**
175
-     * _insert_registration_payment
176
-     *
177
-     * @param int $REG_ID
178
-     * @param int $PAY_ID
179
-     * @param float $PAY_amount
180
-     * @return bool
181
-     */
182
-    protected function _insert_registration_payment($REG_ID = 0, $PAY_ID = 0, $PAY_amount = 0.00)
183
-    {
184
-        /** @type WPDB $wpdb */
185
-        global $wpdb;
186
-        $success = $wpdb->insert(
187
-            $this->_registration_payment_table,
188
-            array( 'REG_ID' => $REG_ID, 'PAY_ID' => $PAY_ID, 'RPY_amount' => $PAY_amount, ),  // data
189
-            array( '%f' )   // data format
190
-        );
191
-        if ($success === false) {
192
-            $this->add_error(
193
-                sprintf(
194
-                    __('Could not update registration paid value for registration ID=%1$d because "%2$s"', 'event_espresso'),
195
-                    $REG_ID,
196
-                    $wpdb->last_error
197
-                )
198
-            );
199
-            return false;
200
-        }
201
-        return true;
202
-    }
203
-
204
-
205
-
206
-    /**
207
-     * _update_registration_paid
208
-     *
209
-     * @param int $REG_ID
210
-     * @param float $REG_paid
211
-     * @return bool
212
-     */
213
-    protected function _update_registration_paid($REG_ID = 0, $REG_paid = 0.00)
214
-    {
215
-        /** @type WPDB $wpdb */
216
-        global $wpdb;
217
-        $success = $wpdb->update(
218
-            $this->_registration_table,
219
-            array( 'REG_paid' => $REG_paid ),  // data
220
-            array( 'REG_ID' => $REG_ID ),  // where
221
-            array( '%f' ),   // data format
222
-            array( '%d' )  // where format
223
-        );
224
-        if ($success === false) {
225
-            $this->add_error(
226
-                sprintf(
227
-                    __('Could not update registration paid value for registration ID=%1$d because "%2$s"', 'event_espresso'),
228
-                    $REG_ID,
229
-                    $wpdb->last_error
230
-                )
231
-            );
232
-            return false;
233
-        }
234
-        return true;
235
-    }
15
+	protected $_payment_table;
16
+
17
+	protected $_registration_table;
18
+
19
+	protected $_registration_payment_table;
20
+
21
+	public function __construct()
22
+	{
23
+		/** @type WPDB $wpdb */
24
+		global $wpdb;
25
+		$this->_pretty_name = __('Registration Payment Record Generation', 'event_espresso');
26
+		// define tables
27
+		$this->_old_table                                   = $wpdb->prefix . 'esp_transaction';
28
+		$this->_payment_table                       = $wpdb->prefix . 'esp_payment';
29
+		$this->_registration_table                  = $wpdb->prefix . 'esp_registration';
30
+		$this->_registration_payment_table  = $wpdb->prefix . 'esp_registration_payment';
31
+		// build SQL WHERE clauses
32
+		$this->_extra_where_sql = "WHERE STS_ID IN ( 'TIN', 'TCM' ) AND TXN_Total != '0.000'";
33
+		parent::__construct();
34
+	}
35
+
36
+
37
+
38
+	/**
39
+	 * @param array $transaction
40
+	 * @return void
41
+	 */
42
+	protected function _migrate_old_row($transaction)
43
+	{
44
+		/** @type WPDB $wpdb */
45
+		global $wpdb;
46
+		$TXN_ID = absint($transaction['TXN_ID']);
47
+		if (! $TXN_ID) {
48
+			$this->add_error(
49
+				sprintf(
50
+					__('Invalid transaction with ID=%1$d. Error: "%2$s"', 'event_espresso'),
51
+					$TXN_ID,
52
+					$wpdb->last_error
53
+				)
54
+			);
55
+			return;
56
+		}
57
+		// get all payments for the TXN
58
+		$payments = $this->_get_payments($TXN_ID);
59
+		if (empty($payments)) {
60
+			return;
61
+		}
62
+		// then the registrants
63
+		$registrations = $this->_get_registrations($TXN_ID);
64
+		if (empty($registrations)) {
65
+			return;
66
+		}
67
+		// now loop thru each payment and apply it to each of the registrations
68
+		foreach ($payments as $PAY_ID => $payment) {
69
+			if ($payment->STS_ID === 'PAP' && $payment->PAY_amount > 0) {
70
+				$this->_process_registration_payments($payment, $registrations);
71
+			}
72
+		}
73
+	}
74
+
75
+
76
+
77
+	/**
78
+	 * _get_registrations
79
+	 *
80
+	 * @param int $TXN_ID
81
+	 * @return array
82
+	 */
83
+	protected function _get_registrations($TXN_ID)
84
+	{
85
+		/** @type WPDB $wpdb */
86
+		global $wpdb;
87
+		$SQL = "SELECT * FROM {$this->_registration_table} WHERE TXN_ID = %d AND STS_ID IN ( 'RPP', 'RAP' )";
88
+		return $wpdb->get_results($wpdb->prepare($SQL, $TXN_ID), OBJECT_K);
89
+	}
90
+
91
+
92
+
93
+	/**
94
+	 * _get_payments
95
+	 *
96
+	 * @param int $TXN_ID
97
+	 * @return array
98
+	 */
99
+	protected function _get_payments($TXN_ID)
100
+	{
101
+		/** @type WPDB $wpdb */
102
+		global $wpdb;
103
+		return $wpdb->get_results($wpdb->prepare("SELECT * FROM {$this->_payment_table} WHERE TXN_ID = %d", $TXN_ID), OBJECT_K);
104
+	}
105
+
106
+
107
+
108
+	/**
109
+	 * _get_possibly_updated_REG_paid
110
+	 *
111
+	 * @param int $REG_ID
112
+	 * @return array
113
+	 */
114
+	protected function _get_possibly_updated_REG_paid($REG_ID)
115
+	{
116
+		/** @type WPDB $wpdb */
117
+		global $wpdb;
118
+		return $wpdb->get_var($wpdb->prepare("SELECT REG_paid FROM {$this->_registration_table} WHERE REG_ID = %d", $REG_ID));
119
+	}
120
+
121
+
122
+
123
+	/**
124
+	 * _process_registration_payments
125
+	 *
126
+	 * basically a copy of the "Sequential Registration Payment Application Strategy"  logic
127
+	 * currently in EE_Payment_Processor::process_registration_payments()
128
+	 *
129
+	 * @param stdClass $payment
130
+	 * @param array $registrations
131
+	 * @return bool
132
+	 */
133
+	protected function _process_registration_payments($payment, $registrations = array())
134
+	{
135
+		// how much is available to apply to registrations?
136
+		$available_payment_amount = $payment->PAY_amount;
137
+		foreach ($registrations as $REG_ID => $registration) {
138
+			// nothing left, then we are done here?
139
+			if (! $available_payment_amount > 0) {
140
+				break;
141
+			}
142
+			// ensure REG_final_price has a valid value, and skip if it turns out to be zero
143
+			$registration->REG_final_price = ! empty($registration->REG_final_price) ? (float) $registration->REG_final_price : 0.00;
144
+			if (! $registration->REG_final_price > 0) {
145
+				continue;
146
+			}
147
+			// because REG_paid may have been updated by a previous payment, we need to retrieve the value from the db
148
+			$possibly_updated_REG_paid = $this->_get_possibly_updated_REG_paid($REG_ID);
149
+			if (is_float($possibly_updated_REG_paid)) {
150
+				$registration->REG_paid = $possibly_updated_REG_paid;
151
+			}
152
+			// and ensure REG_paid has a valid value
153
+			$registration->REG_paid = ! empty($registration->REG_paid) ? (float) $registration->REG_paid : 0.00;
154
+			// calculate amount owing, and skip if it turns out to be zero
155
+			$owing = $registration->REG_final_price - $registration->REG_paid;
156
+			if (! $owing > 0) {
157
+				continue;
158
+			}
159
+			// don't allow payment amount to exceed the available payment amount, OR the amount owing
160
+			$payment_amount = min($available_payment_amount, $owing);
161
+			// update $available_payment_amount
162
+			$available_payment_amount = $available_payment_amount - $payment_amount;
163
+			// add relation between registration and payment and set amount
164
+			if ($this->_insert_registration_payment($registration->REG_ID, $payment->PAY_ID, $payment_amount)) {
165
+				// calculate and set new REG_paid
166
+				$registration->REG_paid = $registration->REG_paid + $payment_amount;
167
+				$this->_update_registration_paid($registration->REG_ID, $registration->REG_paid);
168
+			}
169
+		}
170
+	}
171
+
172
+
173
+
174
+	/**
175
+	 * _insert_registration_payment
176
+	 *
177
+	 * @param int $REG_ID
178
+	 * @param int $PAY_ID
179
+	 * @param float $PAY_amount
180
+	 * @return bool
181
+	 */
182
+	protected function _insert_registration_payment($REG_ID = 0, $PAY_ID = 0, $PAY_amount = 0.00)
183
+	{
184
+		/** @type WPDB $wpdb */
185
+		global $wpdb;
186
+		$success = $wpdb->insert(
187
+			$this->_registration_payment_table,
188
+			array( 'REG_ID' => $REG_ID, 'PAY_ID' => $PAY_ID, 'RPY_amount' => $PAY_amount, ),  // data
189
+			array( '%f' )   // data format
190
+		);
191
+		if ($success === false) {
192
+			$this->add_error(
193
+				sprintf(
194
+					__('Could not update registration paid value for registration ID=%1$d because "%2$s"', 'event_espresso'),
195
+					$REG_ID,
196
+					$wpdb->last_error
197
+				)
198
+			);
199
+			return false;
200
+		}
201
+		return true;
202
+	}
203
+
204
+
205
+
206
+	/**
207
+	 * _update_registration_paid
208
+	 *
209
+	 * @param int $REG_ID
210
+	 * @param float $REG_paid
211
+	 * @return bool
212
+	 */
213
+	protected function _update_registration_paid($REG_ID = 0, $REG_paid = 0.00)
214
+	{
215
+		/** @type WPDB $wpdb */
216
+		global $wpdb;
217
+		$success = $wpdb->update(
218
+			$this->_registration_table,
219
+			array( 'REG_paid' => $REG_paid ),  // data
220
+			array( 'REG_ID' => $REG_ID ),  // where
221
+			array( '%f' ),   // data format
222
+			array( '%d' )  // where format
223
+		);
224
+		if ($success === false) {
225
+			$this->add_error(
226
+				sprintf(
227
+					__('Could not update registration paid value for registration ID=%1$d because "%2$s"', 'event_espresso'),
228
+					$REG_ID,
229
+					$wpdb->last_error
230
+				)
231
+			);
232
+			return false;
233
+		}
234
+		return true;
235
+	}
236 236
 }
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -24,10 +24,10 @@  discard block
 block discarded – undo
24 24
         global $wpdb;
25 25
         $this->_pretty_name = __('Registration Payment Record Generation', 'event_espresso');
26 26
         // define tables
27
-        $this->_old_table                                   = $wpdb->prefix . 'esp_transaction';
28
-        $this->_payment_table                       = $wpdb->prefix . 'esp_payment';
29
-        $this->_registration_table                  = $wpdb->prefix . 'esp_registration';
30
-        $this->_registration_payment_table  = $wpdb->prefix . 'esp_registration_payment';
27
+        $this->_old_table = $wpdb->prefix.'esp_transaction';
28
+        $this->_payment_table                       = $wpdb->prefix.'esp_payment';
29
+        $this->_registration_table                  = $wpdb->prefix.'esp_registration';
30
+        $this->_registration_payment_table = $wpdb->prefix.'esp_registration_payment';
31 31
         // build SQL WHERE clauses
32 32
         $this->_extra_where_sql = "WHERE STS_ID IN ( 'TIN', 'TCM' ) AND TXN_Total != '0.000'";
33 33
         parent::__construct();
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
         /** @type WPDB $wpdb */
45 45
         global $wpdb;
46 46
         $TXN_ID = absint($transaction['TXN_ID']);
47
-        if (! $TXN_ID) {
47
+        if ( ! $TXN_ID) {
48 48
             $this->add_error(
49 49
                 sprintf(
50 50
                     __('Invalid transaction with ID=%1$d. Error: "%2$s"', 'event_espresso'),
@@ -136,12 +136,12 @@  discard block
 block discarded – undo
136 136
         $available_payment_amount = $payment->PAY_amount;
137 137
         foreach ($registrations as $REG_ID => $registration) {
138 138
             // nothing left, then we are done here?
139
-            if (! $available_payment_amount > 0) {
139
+            if ( ! $available_payment_amount > 0) {
140 140
                 break;
141 141
             }
142 142
             // ensure REG_final_price has a valid value, and skip if it turns out to be zero
143 143
             $registration->REG_final_price = ! empty($registration->REG_final_price) ? (float) $registration->REG_final_price : 0.00;
144
-            if (! $registration->REG_final_price > 0) {
144
+            if ( ! $registration->REG_final_price > 0) {
145 145
                 continue;
146 146
             }
147 147
             // because REG_paid may have been updated by a previous payment, we need to retrieve the value from the db
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
             $registration->REG_paid = ! empty($registration->REG_paid) ? (float) $registration->REG_paid : 0.00;
154 154
             // calculate amount owing, and skip if it turns out to be zero
155 155
             $owing = $registration->REG_final_price - $registration->REG_paid;
156
-            if (! $owing > 0) {
156
+            if ( ! $owing > 0) {
157 157
                 continue;
158 158
             }
159 159
             // don't allow payment amount to exceed the available payment amount, OR the amount owing
@@ -185,8 +185,8 @@  discard block
 block discarded – undo
185 185
         global $wpdb;
186 186
         $success = $wpdb->insert(
187 187
             $this->_registration_payment_table,
188
-            array( 'REG_ID' => $REG_ID, 'PAY_ID' => $PAY_ID, 'RPY_amount' => $PAY_amount, ),  // data
189
-            array( '%f' )   // data format
188
+            array('REG_ID' => $REG_ID, 'PAY_ID' => $PAY_ID, 'RPY_amount' => $PAY_amount,), // data
189
+            array('%f')   // data format
190 190
         );
191 191
         if ($success === false) {
192 192
             $this->add_error(
@@ -216,10 +216,10 @@  discard block
 block discarded – undo
216 216
         global $wpdb;
217 217
         $success = $wpdb->update(
218 218
             $this->_registration_table,
219
-            array( 'REG_paid' => $REG_paid ),  // data
220
-            array( 'REG_ID' => $REG_ID ),  // where
221
-            array( '%f' ),   // data format
222
-            array( '%d' )  // where format
219
+            array('REG_paid' => $REG_paid), // data
220
+            array('REG_ID' => $REG_ID), // where
221
+            array('%f'), // data format
222
+            array('%d')  // where format
223 223
         );
224 224
         if ($success === false) {
225 225
             $this->add_error(
Please login to merge, or discard this patch.
4_7_0_stages/EE_DMS_4_7_0_Add_Taxes_To_REG_Final_Price.dmsstage.php 2 patches
Indentation   +200 added lines, -200 removed lines patch added patch discarded remove patch
@@ -12,73 +12,73 @@  discard block
 block discarded – undo
12 12
 class EE_DMS_4_7_0_Add_Taxes_To_REG_Final_Price extends EE_Data_Migration_Script_Stage_Table
13 13
 {
14 14
 
15
-    protected $_ticket_table;
16
-
17
-    protected $_line_item_table;
18
-
19
-    public function __construct()
20
-    {
21
-        /** @type WPDB $wpdb */
22
-        global $wpdb;
23
-        $this->_pretty_name = __('Registration Final Price Tax Calculations', 'event_espresso');
24
-        // define tables
25
-        $this->_old_table               = $wpdb->prefix . 'esp_registration';
26
-        $this->_ticket_table            = $wpdb->prefix . 'esp_ticket';
27
-        $this->_line_item_table     = $wpdb->prefix . 'esp_line_item';
28
-        parent::__construct();
29
-    }
30
-
31
-
32
-
33
-    /**
34
-     * @return string
35
-     */
36
-    protected function _get_rest_of_sql_for_query()
37
-    {
38
-        $SQL = "FROM {$this->_old_table} AS reg ";
39
-        $SQL .= "JOIN {$this->_ticket_table} as tkt ON reg.TKT_ID = tkt.TKT_ID ";
40
-        $SQL .= "JOIN {$this->_line_item_table} as line ON reg.TXN_ID = line.TXN_ID ";
41
-        $SQL .= "WHERE tkt.TKT_taxable = 1 ";
42
-        $SQL .= "AND line.LIN_code = 'total' ";
43
-        $SQL .= "AND reg.REG_final_price > 0 ";
44
-        return $SQL;
45
-    }
46
-
47
-
48
-
49
-    /**
50
-     * Counts the records to migrate; the public version may cache it
51
-     * @return int
52
-     */
53
-    public function _count_records_to_migrate()
54
-    {
55
-        /** @type WPDB $wpdb */
56
-        global $wpdb;
57
-        $SQL = "SELECT count( reg.REG_ID ) ";
58
-        $SQL .= $this->_get_rest_of_sql_for_query();
59
-        $count = $wpdb->get_var($SQL);
60
-        return $count;
61
-    }
62
-
63
-
64
-
65
-    /**
66
-     * Gets data for all registrations with taxable tickets in the esp_line_item table
67
-     * @global wpdb $wpdb
68
-     * @param int $limit
69
-     * @return array of arrays like $wpdb->get_results($sql, ARRAY_A)
70
-     */
71
-    protected function _get_rows($limit)
72
-    {
73
-        /** @type WPDB $wpdb */
74
-        global $wpdb;
75
-        $start_at_record = $this->count_records_migrated();
76
-        $SQL = "SELECT reg.REG_ID,  reg.REG_final_price, line.LIN_ID ";
77
-        $SQL .= $this->_get_rest_of_sql_for_query();
78
-        $SQL .= $wpdb->prepare("LIMIT %d, %d", $start_at_record, $limit);
79
-
80
-        // produces something like:
81
-        /*
15
+	protected $_ticket_table;
16
+
17
+	protected $_line_item_table;
18
+
19
+	public function __construct()
20
+	{
21
+		/** @type WPDB $wpdb */
22
+		global $wpdb;
23
+		$this->_pretty_name = __('Registration Final Price Tax Calculations', 'event_espresso');
24
+		// define tables
25
+		$this->_old_table               = $wpdb->prefix . 'esp_registration';
26
+		$this->_ticket_table            = $wpdb->prefix . 'esp_ticket';
27
+		$this->_line_item_table     = $wpdb->prefix . 'esp_line_item';
28
+		parent::__construct();
29
+	}
30
+
31
+
32
+
33
+	/**
34
+	 * @return string
35
+	 */
36
+	protected function _get_rest_of_sql_for_query()
37
+	{
38
+		$SQL = "FROM {$this->_old_table} AS reg ";
39
+		$SQL .= "JOIN {$this->_ticket_table} as tkt ON reg.TKT_ID = tkt.TKT_ID ";
40
+		$SQL .= "JOIN {$this->_line_item_table} as line ON reg.TXN_ID = line.TXN_ID ";
41
+		$SQL .= "WHERE tkt.TKT_taxable = 1 ";
42
+		$SQL .= "AND line.LIN_code = 'total' ";
43
+		$SQL .= "AND reg.REG_final_price > 0 ";
44
+		return $SQL;
45
+	}
46
+
47
+
48
+
49
+	/**
50
+	 * Counts the records to migrate; the public version may cache it
51
+	 * @return int
52
+	 */
53
+	public function _count_records_to_migrate()
54
+	{
55
+		/** @type WPDB $wpdb */
56
+		global $wpdb;
57
+		$SQL = "SELECT count( reg.REG_ID ) ";
58
+		$SQL .= $this->_get_rest_of_sql_for_query();
59
+		$count = $wpdb->get_var($SQL);
60
+		return $count;
61
+	}
62
+
63
+
64
+
65
+	/**
66
+	 * Gets data for all registrations with taxable tickets in the esp_line_item table
67
+	 * @global wpdb $wpdb
68
+	 * @param int $limit
69
+	 * @return array of arrays like $wpdb->get_results($sql, ARRAY_A)
70
+	 */
71
+	protected function _get_rows($limit)
72
+	{
73
+		/** @type WPDB $wpdb */
74
+		global $wpdb;
75
+		$start_at_record = $this->count_records_migrated();
76
+		$SQL = "SELECT reg.REG_ID,  reg.REG_final_price, line.LIN_ID ";
77
+		$SQL .= $this->_get_rest_of_sql_for_query();
78
+		$SQL .= $wpdb->prepare("LIMIT %d, %d", $start_at_record, $limit);
79
+
80
+		// produces something like:
81
+		/*
82 82
             SELECT
83 83
               reg.REG_ID,
84 84
               reg.REG_final_price,
@@ -95,137 +95,137 @@  discard block
 block discarded – undo
95 95
             LIMIT 1, 50
96 96
          */
97 97
 
98
-        return $wpdb->get_results($SQL, ARRAY_A);
99
-    }
100
-
101
-
102
-
103
-    /**
104
-     * @param array $row
105
-     * @return void
106
-     */
107
-    protected function _migrate_old_row($row)
108
-    {
109
-        /** @type WPDB $wpdb */
110
-        global $wpdb;
111
-        // ensure all required values are present
112
-        if (! isset($row['REG_ID'], $row['REG_final_price'], $row['LIN_ID'])) {
113
-            $this->add_error(
114
-                sprintf(
115
-                    __('Invalid query results returned with the following data:%1$s REG_ID=%2$d, REG_final_price=%3$d, LIN_ID=%4$f. Error: "%5$s"', 'event_espresso'),
116
-                    '<br />',
117
-                    isset($row['REG_ID']) ? $row['REG_ID'] : '',
118
-                    isset($row['REG_final_price']) ? $row['REG_final_price'] : '',
119
-                    isset($row['LIN_ID']) ? $row['LIN_ID'] : '',
120
-                    $wpdb->last_error
121
-                )
122
-            );
123
-            return;
124
-        }
125
-        // get tax subtotal
126
-        $tax_subtotal_line_item_ID = $this->_get_line_item_ID_for_tax_subtotal($row['LIN_ID']);
127
-        if (! $tax_subtotal_line_item_ID) {
128
-            $this->add_error(
129
-                sprintf(
130
-                    __('Invalid line item ID returned. Error: "%1$s"', 'event_espresso'),
131
-                    $wpdb->last_error
132
-                )
133
-            );
134
-            return;
135
-        }
136
-        // now get taxes
137
-        $taxes = $this->_get_tax_amounts($tax_subtotal_line_item_ID);
138
-        // apply taxes to registration final price
139
-        $this->_apply_taxes($row['REG_ID'], $row['REG_final_price'], $taxes);
140
-    }
141
-
142
-
143
-
144
-    /**
145
-     * _get_tax_subtotal
146
-     *
147
-     * @param int $LIN_ID
148
-     * @return int
149
-     */
150
-    protected function _get_line_item_ID_for_tax_subtotal($LIN_ID)
151
-    {
152
-        /** @type WPDB $wpdb */
153
-        global $wpdb;
154
-        $SQL = "SELECT LIN_ID ";
155
-        $SQL .= "FROM {$this->_line_item_table} ";
156
-        $SQL .= "WHERE LIN_parent = %d ";
157
-        $SQL .= "AND LIN_code = 'taxes'";
158
-        return $wpdb->get_var($wpdb->prepare($SQL, $LIN_ID));
159
-    }
160
-
161
-
162
-
163
-    /**
164
-     * _get_tax_subtotal
165
-     *
166
-     * @param int $LIN_ID
167
-     * @return array
168
-     */
169
-    protected function _get_tax_amounts($LIN_ID)
170
-    {
171
-        /** @type WPDB $wpdb */
172
-        global $wpdb;
173
-        $SQL = "SELECT LIN_percent ";
174
-        $SQL .= "FROM {$this->_line_item_table} ";
175
-        $SQL .= "WHERE LIN_parent = %d";
176
-        return $wpdb->get_results($wpdb->prepare($SQL, $LIN_ID), OBJECT_K);
177
-    }
178
-
179
-
180
-
181
-    /**
182
-     * _apply_taxes
183
-     *
184
-     * @param int $REG_ID
185
-     * @param float $final_price
186
-     * @param array $taxes
187
-     * @return void
188
-     */
189
-    protected function _apply_taxes($REG_ID = 0, $final_price = 0.00, $taxes = array())
190
-    {
191
-        if (is_array($taxes) && ! empty($taxes)) {
192
-            $total_taxes = 0;
193
-            foreach ($taxes as $tax) {
194
-                $total_taxes += $final_price * ( $tax->LIN_percent / 100 );
195
-            }
196
-            $final_price += $total_taxes;
197
-            $this->_update_registration_final_price($REG_ID, $final_price);
198
-        }
199
-    }
200
-
201
-
202
-
203
-    /**
204
-     * _update_registration_final_price
205
-     *
206
-     * @param int $REG_ID
207
-     * @param float $REG_final_price
208
-     * @return void
209
-     */
210
-    protected function _update_registration_final_price($REG_ID = 0, $REG_final_price = 0.00)
211
-    {
212
-        /** @type WPDB $wpdb */
213
-        global $wpdb;
214
-        $success = $wpdb->update(
215
-            $this->_old_table,
216
-            array( 'REG_final_price' => $REG_final_price ),  // data
217
-            array( 'REG_ID' => $REG_ID ),  // where
218
-            array( '%f' ),   // data format
219
-            array( '%d' )  // where format
220
-        );
221
-        if ($success === false) {
222
-            $this->add_error(
223
-                sprintf(
224
-                    __('Could not update registration final price value for registration ID=%1$d because "%2$s"', 'event_espresso'),
225
-                    $REG_ID,
226
-                    $wpdb->last_error
227
-                )
228
-            );
229
-        }
230
-    }
98
+		return $wpdb->get_results($SQL, ARRAY_A);
99
+	}
100
+
101
+
102
+
103
+	/**
104
+	 * @param array $row
105
+	 * @return void
106
+	 */
107
+	protected function _migrate_old_row($row)
108
+	{
109
+		/** @type WPDB $wpdb */
110
+		global $wpdb;
111
+		// ensure all required values are present
112
+		if (! isset($row['REG_ID'], $row['REG_final_price'], $row['LIN_ID'])) {
113
+			$this->add_error(
114
+				sprintf(
115
+					__('Invalid query results returned with the following data:%1$s REG_ID=%2$d, REG_final_price=%3$d, LIN_ID=%4$f. Error: "%5$s"', 'event_espresso'),
116
+					'<br />',
117
+					isset($row['REG_ID']) ? $row['REG_ID'] : '',
118
+					isset($row['REG_final_price']) ? $row['REG_final_price'] : '',
119
+					isset($row['LIN_ID']) ? $row['LIN_ID'] : '',
120
+					$wpdb->last_error
121
+				)
122
+			);
123
+			return;
124
+		}
125
+		// get tax subtotal
126
+		$tax_subtotal_line_item_ID = $this->_get_line_item_ID_for_tax_subtotal($row['LIN_ID']);
127
+		if (! $tax_subtotal_line_item_ID) {
128
+			$this->add_error(
129
+				sprintf(
130
+					__('Invalid line item ID returned. Error: "%1$s"', 'event_espresso'),
131
+					$wpdb->last_error
132
+				)
133
+			);
134
+			return;
135
+		}
136
+		// now get taxes
137
+		$taxes = $this->_get_tax_amounts($tax_subtotal_line_item_ID);
138
+		// apply taxes to registration final price
139
+		$this->_apply_taxes($row['REG_ID'], $row['REG_final_price'], $taxes);
140
+	}
141
+
142
+
143
+
144
+	/**
145
+	 * _get_tax_subtotal
146
+	 *
147
+	 * @param int $LIN_ID
148
+	 * @return int
149
+	 */
150
+	protected function _get_line_item_ID_for_tax_subtotal($LIN_ID)
151
+	{
152
+		/** @type WPDB $wpdb */
153
+		global $wpdb;
154
+		$SQL = "SELECT LIN_ID ";
155
+		$SQL .= "FROM {$this->_line_item_table} ";
156
+		$SQL .= "WHERE LIN_parent = %d ";
157
+		$SQL .= "AND LIN_code = 'taxes'";
158
+		return $wpdb->get_var($wpdb->prepare($SQL, $LIN_ID));
159
+	}
160
+
161
+
162
+
163
+	/**
164
+	 * _get_tax_subtotal
165
+	 *
166
+	 * @param int $LIN_ID
167
+	 * @return array
168
+	 */
169
+	protected function _get_tax_amounts($LIN_ID)
170
+	{
171
+		/** @type WPDB $wpdb */
172
+		global $wpdb;
173
+		$SQL = "SELECT LIN_percent ";
174
+		$SQL .= "FROM {$this->_line_item_table} ";
175
+		$SQL .= "WHERE LIN_parent = %d";
176
+		return $wpdb->get_results($wpdb->prepare($SQL, $LIN_ID), OBJECT_K);
177
+	}
178
+
179
+
180
+
181
+	/**
182
+	 * _apply_taxes
183
+	 *
184
+	 * @param int $REG_ID
185
+	 * @param float $final_price
186
+	 * @param array $taxes
187
+	 * @return void
188
+	 */
189
+	protected function _apply_taxes($REG_ID = 0, $final_price = 0.00, $taxes = array())
190
+	{
191
+		if (is_array($taxes) && ! empty($taxes)) {
192
+			$total_taxes = 0;
193
+			foreach ($taxes as $tax) {
194
+				$total_taxes += $final_price * ( $tax->LIN_percent / 100 );
195
+			}
196
+			$final_price += $total_taxes;
197
+			$this->_update_registration_final_price($REG_ID, $final_price);
198
+		}
199
+	}
200
+
201
+
202
+
203
+	/**
204
+	 * _update_registration_final_price
205
+	 *
206
+	 * @param int $REG_ID
207
+	 * @param float $REG_final_price
208
+	 * @return void
209
+	 */
210
+	protected function _update_registration_final_price($REG_ID = 0, $REG_final_price = 0.00)
211
+	{
212
+		/** @type WPDB $wpdb */
213
+		global $wpdb;
214
+		$success = $wpdb->update(
215
+			$this->_old_table,
216
+			array( 'REG_final_price' => $REG_final_price ),  // data
217
+			array( 'REG_ID' => $REG_ID ),  // where
218
+			array( '%f' ),   // data format
219
+			array( '%d' )  // where format
220
+		);
221
+		if ($success === false) {
222
+			$this->add_error(
223
+				sprintf(
224
+					__('Could not update registration final price value for registration ID=%1$d because "%2$s"', 'event_espresso'),
225
+					$REG_ID,
226
+					$wpdb->last_error
227
+				)
228
+			);
229
+		}
230
+	}
231 231
 }
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -22,9 +22,9 @@  discard block
 block discarded – undo
22 22
         global $wpdb;
23 23
         $this->_pretty_name = __('Registration Final Price Tax Calculations', 'event_espresso');
24 24
         // define tables
25
-        $this->_old_table               = $wpdb->prefix . 'esp_registration';
26
-        $this->_ticket_table            = $wpdb->prefix . 'esp_ticket';
27
-        $this->_line_item_table     = $wpdb->prefix . 'esp_line_item';
25
+        $this->_old_table               = $wpdb->prefix.'esp_registration';
26
+        $this->_ticket_table            = $wpdb->prefix.'esp_ticket';
27
+        $this->_line_item_table = $wpdb->prefix.'esp_line_item';
28 28
         parent::__construct();
29 29
     }
30 30
 
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
         /** @type WPDB $wpdb */
110 110
         global $wpdb;
111 111
         // ensure all required values are present
112
-        if (! isset($row['REG_ID'], $row['REG_final_price'], $row['LIN_ID'])) {
112
+        if ( ! isset($row['REG_ID'], $row['REG_final_price'], $row['LIN_ID'])) {
113 113
             $this->add_error(
114 114
                 sprintf(
115 115
                     __('Invalid query results returned with the following data:%1$s REG_ID=%2$d, REG_final_price=%3$d, LIN_ID=%4$f. Error: "%5$s"', 'event_espresso'),
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
         }
125 125
         // get tax subtotal
126 126
         $tax_subtotal_line_item_ID = $this->_get_line_item_ID_for_tax_subtotal($row['LIN_ID']);
127
-        if (! $tax_subtotal_line_item_ID) {
127
+        if ( ! $tax_subtotal_line_item_ID) {
128 128
             $this->add_error(
129 129
                 sprintf(
130 130
                     __('Invalid line item ID returned. Error: "%1$s"', 'event_espresso'),
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
         if (is_array($taxes) && ! empty($taxes)) {
192 192
             $total_taxes = 0;
193 193
             foreach ($taxes as $tax) {
194
-                $total_taxes += $final_price * ( $tax->LIN_percent / 100 );
194
+                $total_taxes += $final_price * ($tax->LIN_percent / 100);
195 195
             }
196 196
             $final_price += $total_taxes;
197 197
             $this->_update_registration_final_price($REG_ID, $final_price);
@@ -213,10 +213,10 @@  discard block
 block discarded – undo
213 213
         global $wpdb;
214 214
         $success = $wpdb->update(
215 215
             $this->_old_table,
216
-            array( 'REG_final_price' => $REG_final_price ),  // data
217
-            array( 'REG_ID' => $REG_ID ),  // where
218
-            array( '%f' ),   // data format
219
-            array( '%d' )  // where format
216
+            array('REG_final_price' => $REG_final_price), // data
217
+            array('REG_ID' => $REG_ID), // where
218
+            array('%f'), // data format
219
+            array('%d')  // where format
220 220
         );
221 221
         if ($success === false) {
222 222
             $this->add_error(
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_DMS_Unknown_1_0_0.core.php 1 patch
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -18,44 +18,44 @@
 block discarded – undo
18 18
 class EE_DMS_Unknown_1_0_0 extends EE_Data_Migration_Script_Base
19 19
 {
20 20
 
21
-    /**
22
-     * Returns whether or not this data migration script can operate on the given version of the database.
23
-     * Eg, if this migration script can migrate from 3.1.26 or higher (but not anything after 4.0.0), and
24
-     * it's passed a string like '3.1.38B', it should return true
25
-     *
26
-     * @param string $version_string
27
-     * @return boolean
28
-     */
29
-    public function can_migrate_from_version($version_string)
30
-    {
31
-        return false;
32
-    }
33
-
34
-    public function schema_changes_after_migration()
35
-    {
36
-        return;
37
-    }
38
-
39
-    public function schema_changes_before_migration()
40
-    {
41
-        return;
42
-    }
43
-
44
-
45
-    /**
46
-     * All children of this must call parent::__construct() at the end of their constructor or suffer the consequences!
47
-     *
48
-     * @param TableManager  $table_manager
49
-     * @param TableAnalysis $table_analysis
50
-     */
51
-    public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null)
52
-    {
53
-        $this->_migration_stages = array();
54
-        $this->_pretty_name = __("Fatal Uncatchable Error Occurred", "event_espresso");
55
-        parent::__construct($table_manager, $table_analysis);
56
-    }
57
-
58
-    public function migration_page_hooks()
59
-    {
60
-    }
21
+	/**
22
+	 * Returns whether or not this data migration script can operate on the given version of the database.
23
+	 * Eg, if this migration script can migrate from 3.1.26 or higher (but not anything after 4.0.0), and
24
+	 * it's passed a string like '3.1.38B', it should return true
25
+	 *
26
+	 * @param string $version_string
27
+	 * @return boolean
28
+	 */
29
+	public function can_migrate_from_version($version_string)
30
+	{
31
+		return false;
32
+	}
33
+
34
+	public function schema_changes_after_migration()
35
+	{
36
+		return;
37
+	}
38
+
39
+	public function schema_changes_before_migration()
40
+	{
41
+		return;
42
+	}
43
+
44
+
45
+	/**
46
+	 * All children of this must call parent::__construct() at the end of their constructor or suffer the consequences!
47
+	 *
48
+	 * @param TableManager  $table_manager
49
+	 * @param TableAnalysis $table_analysis
50
+	 */
51
+	public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null)
52
+	{
53
+		$this->_migration_stages = array();
54
+		$this->_pretty_name = __("Fatal Uncatchable Error Occurred", "event_espresso");
55
+		parent::__construct($table_manager, $table_analysis);
56
+	}
57
+
58
+	public function migration_page_hooks()
59
+	{
60
+	}
61 61
 }
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_DMS_Core_4_7_0.dms.php 2 patches
Indentation   +180 added lines, -181 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,71 +38,71 @@  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
-                version_compare($version_string, '4.7.0', '<=')
70
-                && version_compare($version_string, '4.6.0', '>=')
71
-            )
72
-            || (
73
-                version_compare($version_string, '4.7.0', '>=')
74
-                && ! $this->_get_table_analysis()->tableExists('esp_registration_payment')
75
-                && $this->_get_table_analysis()->tableExists('esp_registration')
76
-            )
77
-        ) {
78
-            return true;
79
-        } elseif (! $version_string) {
80
-            // no version string provided... this must be pre 4.3
81
-            return false;// changed mind. dont want people thinking they should migrate yet because they cant
82
-        } else {
83
-            return false;
84
-        }
85
-    }
60
+	/**
61
+	 * @param array $version_array
62
+	 * @return bool
63
+	 */
64
+	public function can_migrate_from_version($version_array)
65
+	{
66
+		$version_string = $version_array['Core'];
67
+		if ((
68
+				version_compare($version_string, '4.7.0', '<=')
69
+				&& version_compare($version_string, '4.6.0', '>=')
70
+			)
71
+			|| (
72
+				version_compare($version_string, '4.7.0', '>=')
73
+				&& ! $this->_get_table_analysis()->tableExists('esp_registration_payment')
74
+				&& $this->_get_table_analysis()->tableExists('esp_registration')
75
+			)
76
+		) {
77
+			return true;
78
+		} elseif (! $version_string) {
79
+			// no version string provided... this must be pre 4.3
80
+			return false;// changed mind. dont want people thinking they should migrate yet because they cant
81
+		} else {
82
+			return false;
83
+		}
84
+	}
86 85
 
87 86
 
88 87
 
89
-    /**
90
-     * @return bool
91
-     */
92
-    public function schema_changes_before_migration()
93
-    {
94
-        // relies on 4.1's EEH_Activation::create_table
95
-        require_once(EE_HELPERS . 'EEH_Activation.helper.php');
96
-        $table_name = 'esp_answer';
97
-        $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
88
+	/**
89
+	 * @return bool
90
+	 */
91
+	public function schema_changes_before_migration()
92
+	{
93
+		// relies on 4.1's EEH_Activation::create_table
94
+		require_once(EE_HELPERS . 'EEH_Activation.helper.php');
95
+		$table_name = 'esp_answer';
96
+		$sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
98 97
 					REG_ID INT UNSIGNED NOT NULL,
99 98
 					QST_ID INT UNSIGNED NOT NULL,
100 99
 					ANS_value TEXT NOT NULL,
101 100
 					PRIMARY KEY  (ANS_ID),
102 101
 					KEY REG_ID (REG_ID),
103 102
 					KEY QST_ID (QST_ID)";
104
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
105
-        $table_name = 'esp_attendee_meta';
106
-        $sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
103
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
104
+		$table_name = 'esp_attendee_meta';
105
+		$sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
107 106
 						ATT_ID BIGINT(20) UNSIGNED NOT NULL,
108 107
 						ATT_fname VARCHAR(45) NOT NULL,
109 108
 						ATT_lname VARCHAR(45) NOT	NULL,
@@ -120,9 +119,9 @@  discard block
 block discarded – undo
120 119
 								KEY ATT_email (ATT_email),
121 120
 								KEY ATT_lname (ATT_lname),
122 121
 								KEY ATT_fname (ATT_fname)";
123
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
124
-        $table_name = 'esp_country';
125
-        $sql = "CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL,
122
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
123
+		$table_name = 'esp_country';
124
+		$sql = "CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL,
126 125
 					  CNT_ISO3 VARCHAR(3) COLLATE utf8_bin NOT NULL,
127 126
 					  RGN_ID TINYINT(3) UNSIGNED DEFAULT NULL,
128 127
 					  CNT_name VARCHAR(45) COLLATE utf8_bin NOT NULL,
@@ -138,25 +137,25 @@  discard block
 block discarded – undo
138 137
 					  CNT_is_EU TINYINT(1) DEFAULT '0',
139 138
 					  CNT_active TINYINT(1) DEFAULT '0',
140 139
 					  PRIMARY KEY  (CNT_ISO)";
141
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
142
-        $table_name = 'esp_currency';
143
-        $sql = "CUR_code VARCHAR(6) COLLATE utf8_bin NOT NULL,
140
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
141
+		$table_name = 'esp_currency';
142
+		$sql = "CUR_code VARCHAR(6) COLLATE utf8_bin NOT NULL,
144 143
 				CUR_single VARCHAR(45) COLLATE utf8_bin DEFAULT 'dollar',
145 144
 				CUR_plural VARCHAR(45) COLLATE utf8_bin DEFAULT 'dollars',
146 145
 				CUR_sign VARCHAR(45) COLLATE utf8_bin DEFAULT '$',
147 146
 				CUR_dec_plc VARCHAR(1) COLLATE utf8_bin NOT NULL DEFAULT '2',
148 147
 				CUR_active TINYINT(1) DEFAULT '0',
149 148
 				PRIMARY KEY  (CUR_code)";
150
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
151
-        $table_name = 'esp_currency_payment_method';
152
-        $sql = "CPM_ID INT(11) NOT NULL AUTO_INCREMENT,
149
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
150
+		$table_name = 'esp_currency_payment_method';
151
+		$sql = "CPM_ID INT(11) NOT NULL AUTO_INCREMENT,
153 152
 				CUR_code  VARCHAR(6) COLLATE utf8_bin NOT NULL,
154 153
 				PMD_ID INT(11) NOT NULL,
155 154
 				PRIMARY KEY  (CPM_ID),
156 155
 				KEY PMD_ID (PMD_ID)";
157
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
158
-        $table_name = 'esp_datetime';
159
-        $sql = "DTT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
156
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
157
+		$table_name = 'esp_datetime';
158
+		$sql = "DTT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
160 159
 				  EVT_ID BIGINT(20) UNSIGNED NOT NULL,
161 160
 				  DTT_name VARCHAR(255) NOT NULL DEFAULT '',
162 161
 				  DTT_description TEXT NOT NULL,
@@ -172,9 +171,9 @@  discard block
 block discarded – undo
172 171
 						KEY DTT_EVT_start (DTT_EVT_start),
173 172
 						KEY EVT_ID (EVT_ID),
174 173
 						KEY DTT_is_primary (DTT_is_primary)";
175
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
176
-        $table_name = 'esp_event_meta';
177
-        $sql = "
174
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
175
+		$table_name = 'esp_event_meta';
176
+		$sql = "
178 177
 			EVTM_ID INT NOT NULL AUTO_INCREMENT,
179 178
 			EVT_ID BIGINT(20) UNSIGNED NOT NULL,
180 179
 			EVT_display_desc TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
@@ -190,34 +189,34 @@  discard block
 block discarded – undo
190 189
 			EVT_donations TINYINT(1) NULL,
191 190
 			PRIMARY KEY  (EVTM_ID),
192 191
 			KEY EVT_ID (EVT_ID)";
193
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
194
-        $table_name = 'esp_event_question_group';
195
-        $sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
192
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
193
+		$table_name = 'esp_event_question_group';
194
+		$sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
196 195
 					EVT_ID BIGINT(20) UNSIGNED NOT NULL,
197 196
 					QSG_ID INT UNSIGNED NOT NULL,
198 197
 					EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
199 198
 					PRIMARY KEY  (EQG_ID),
200 199
 					KEY EVT_ID (EVT_ID),
201 200
 					KEY QSG_ID (QSG_ID)";
202
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
203
-        $table_name = 'esp_event_venue';
204
-        $sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
201
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
202
+		$table_name = 'esp_event_venue';
203
+		$sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
205 204
 				EVT_ID BIGINT(20) UNSIGNED NOT NULL,
206 205
 				VNU_ID BIGINT(20) UNSIGNED NOT NULL,
207 206
 				EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
208 207
 				PRIMARY KEY  (EVV_ID)";
209
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
210
-        $table_name = 'esp_extra_meta';
211
-        $sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
208
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
209
+		$table_name = 'esp_extra_meta';
210
+		$sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
212 211
 				OBJ_ID INT(11) DEFAULT NULL,
213 212
 				EXM_type VARCHAR(45) DEFAULT NULL,
214 213
 				EXM_key VARCHAR(45) DEFAULT NULL,
215 214
 				EXM_value TEXT,
216 215
 				PRIMARY KEY  (EXM_ID),
217 216
 				KEY EXM_type (EXM_type, OBJ_ID, EXM_key(45))";
218
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
219
-        $table_name = 'esp_line_item';
220
-        $sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
217
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
218
+		$table_name = 'esp_line_item';
219
+		$sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
221 220
 				LIN_code VARCHAR(245) NOT NULL DEFAULT '',
222 221
 				TXN_ID INT(11) DEFAULT NULL,
223 222
 				LIN_name VARCHAR(245) NOT NULL DEFAULT '',
@@ -235,9 +234,9 @@  discard block
 block discarded – undo
235 234
 				PRIMARY KEY  (LIN_ID),
236 235
 				KEY LIN_code (LIN_code(191)),
237 236
 				KEY TXN_ID (TXN_ID)";
238
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
239
-        $table_name = 'esp_log';
240
-        $sql = "LOG_ID INT(11) NOT NULL AUTO_INCREMENT,
237
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
238
+		$table_name = 'esp_log';
239
+		$sql = "LOG_ID INT(11) NOT NULL AUTO_INCREMENT,
241 240
 				LOG_time DATETIME DEFAULT NULL,
242 241
 				OBJ_ID VARCHAR(45) DEFAULT NULL,
243 242
 				OBJ_type VARCHAR(45) DEFAULT NULL,
@@ -248,18 +247,18 @@  discard block
 block discarded – undo
248 247
 				KEY LOG_time (LOG_time),
249 248
 				KEY OBJ (OBJ_type,OBJ_ID),
250 249
 				KEY LOG_type (LOG_type)";
251
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
252
-        $table_name = 'esp_message_template';
253
-        $sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
250
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
251
+		$table_name = 'esp_message_template';
252
+		$sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
254 253
 					GRP_ID INT(10) UNSIGNED NOT NULL,
255 254
 					MTP_context VARCHAR(50) NOT NULL,
256 255
 					MTP_template_field VARCHAR(30) NOT NULL,
257 256
 					MTP_content TEXT NOT NULL,
258 257
 					PRIMARY KEY  (MTP_ID),
259 258
 					KEY GRP_ID (GRP_ID)";
260
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
261
-        $table_name = 'esp_message_template_group';
262
-        $sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
259
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
260
+		$table_name = 'esp_message_template_group';
261
+		$sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
263 262
 					MTP_user_id INT(10) NOT NULL DEFAULT '1',
264 263
 					MTP_name VARCHAR(245) NOT NULL DEFAULT '',
265 264
 					MTP_description VARCHAR(245) NOT NULL DEFAULT '',
@@ -271,17 +270,17 @@  discard block
 block discarded – undo
271 270
 					MTP_is_active TINYINT(1) NOT NULL DEFAULT '1',
272 271
 					PRIMARY KEY  (GRP_ID),
273 272
 					KEY MTP_user_id (MTP_user_id)";
274
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
275
-        $table_name = 'esp_event_message_template';
276
-        $sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
273
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
274
+		$table_name = 'esp_event_message_template';
275
+		$sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
277 276
 					EVT_ID BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
278 277
 					GRP_ID INT(10) UNSIGNED NOT NULL DEFAULT 0,
279 278
 					PRIMARY KEY  (EMT_ID),
280 279
 					KEY EVT_ID (EVT_ID),
281 280
 					KEY GRP_ID (GRP_ID)";
282
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
283
-        $table_name = 'esp_payment';
284
-        $sql = "PAY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
281
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
282
+		$table_name = 'esp_payment';
283
+		$sql = "PAY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
285 284
 					TXN_ID INT(10) UNSIGNED DEFAULT NULL,
286 285
 					STS_ID VARCHAR(3) COLLATE utf8_bin DEFAULT NULL,
287 286
 					PAY_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
@@ -298,9 +297,9 @@  discard block
 block discarded – undo
298 297
 					PRIMARY KEY  (PAY_ID),
299 298
 					KEY PAY_timestamp (PAY_timestamp),
300 299
 					KEY TXN_ID (TXN_ID)";
301
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
302
-        $table_name = 'esp_payment_method';
303
-        $sql = "PMD_ID INT(11) NOT NULL AUTO_INCREMENT,
300
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
301
+		$table_name = 'esp_payment_method';
302
+		$sql = "PMD_ID INT(11) NOT NULL AUTO_INCREMENT,
304 303
 				PMD_type VARCHAR(124) DEFAULT NULL,
305 304
 				PMD_name VARCHAR(255) DEFAULT NULL,
306 305
 				PMD_desc TEXT,
@@ -316,32 +315,32 @@  discard block
 block discarded – undo
316 315
 				PRIMARY KEY  (PMD_ID),
317 316
 				UNIQUE KEY PMD_slug_UNIQUE (PMD_slug),
318 317
 				KEY PMD_type (PMD_type)";
319
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
320
-        $table_name = "esp_ticket_price";
321
-        $sql = "TKP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
318
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
319
+		$table_name = "esp_ticket_price";
320
+		$sql = "TKP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
322 321
 					  TKT_ID INT(10) UNSIGNED NOT NULL,
323 322
 					  PRC_ID INT(10) UNSIGNED NOT NULL,
324 323
 					  PRIMARY KEY  (TKP_ID),
325 324
 					  KEY TKT_ID (TKT_ID),
326 325
 					  KEY PRC_ID (PRC_ID)";
327
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
328
-        $table_name = "esp_datetime_ticket";
329
-        $sql = "DTK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
326
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
327
+		$table_name = "esp_datetime_ticket";
328
+		$sql = "DTK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
330 329
 					  DTT_ID INT(10) UNSIGNED NOT NULL,
331 330
 					  TKT_ID INT(10) UNSIGNED NOT NULL,
332 331
 					  PRIMARY KEY  (DTK_ID),
333 332
 					  KEY DTT_ID (DTT_ID),
334 333
 					  KEY TKT_ID (TKT_ID)";
335
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
336
-        $table_name = "esp_ticket_template";
337
-        $sql = "TTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
334
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
335
+		$table_name = "esp_ticket_template";
336
+		$sql = "TTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
338 337
 					  TTM_name VARCHAR(45) NOT NULL,
339 338
 					  TTM_description TEXT,
340 339
 					  TTM_file VARCHAR(45),
341 340
 					  PRIMARY KEY  (TTM_ID)";
342
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
343
-        $table_name = 'esp_question';
344
-        $sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
341
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
342
+		$table_name = 'esp_question';
343
+		$sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
345 344
 					QST_display_text TEXT NOT NULL,
346 345
 					QST_admin_label VARCHAR(255) NOT NULL,
347 346
 					QST_system VARCHAR(25) DEFAULT NULL,
@@ -354,18 +353,18 @@  discard block
 block discarded – undo
354 353
 					QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0,
355 354
 					PRIMARY KEY  (QST_ID),
356 355
 					KEY QST_order (QST_order)';
357
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
358
-        $table_name = 'esp_question_group_question';
359
-        $sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
356
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
357
+		$table_name = 'esp_question_group_question';
358
+		$sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
360 359
 					QSG_ID INT UNSIGNED NOT NULL,
361 360
 					QST_ID INT UNSIGNED NOT NULL,
362 361
 					QGQ_order INT UNSIGNED NOT NULL DEFAULT 0,
363 362
 					PRIMARY KEY  (QGQ_ID),
364 363
 					KEY QST_ID (QST_ID),
365 364
 					KEY QSG_ID_order (QSG_ID, QGQ_order)";
366
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
367
-        $table_name = 'esp_question_option';
368
-        $sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
365
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
366
+		$table_name = 'esp_question_option';
367
+		$sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
369 368
 					QSO_value VARCHAR(255) NOT NULL,
370 369
 					QSO_desc TEXT NOT NULL,
371 370
 					QST_ID INT UNSIGNED NOT NULL,
@@ -374,9 +373,9 @@  discard block
 block discarded – undo
374 373
 					PRIMARY KEY  (QSO_ID),
375 374
 					KEY QST_ID (QST_ID),
376 375
 					KEY QSO_order (QSO_order)";
377
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
378
-        $table_name = 'esp_registration';
379
-        $sql = "REG_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
376
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
377
+		$table_name = 'esp_registration';
378
+		$sql = "REG_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
380 379
 					  EVT_ID BIGINT(20) UNSIGNED NOT NULL,
381 380
 					  ATT_ID BIGINT(20) UNSIGNED NOT NULL,
382 381
 					  TXN_ID INT(10) UNSIGNED NOT NULL,
@@ -400,18 +399,18 @@  discard block
 block discarded – undo
400 399
 					  KEY TKT_ID (TKT_ID),
401 400
 					  KEY EVT_ID (EVT_ID),
402 401
 					  KEY STS_ID (STS_ID)";
403
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
404
-        $table_name = 'esp_registration_payment';
405
-        $sql = "RPY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
402
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
403
+		$table_name = 'esp_registration_payment';
404
+		$sql = "RPY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
406 405
 					  REG_ID INT(10) UNSIGNED NOT NULL,
407 406
 					  PAY_ID INT(10) UNSIGNED NULL,
408 407
 					  RPY_amount DECIMAL(10,3) NOT NULL DEFAULT '0.00',
409 408
 					  PRIMARY KEY  (RPY_ID),
410 409
 					  KEY REG_ID (REG_ID),
411 410
 					  KEY PAY_ID (PAY_ID)";
412
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
413
-        $table_name = 'esp_checkin';
414
-        $sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
411
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
412
+		$table_name = 'esp_checkin';
413
+		$sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
415 414
 					REG_ID INT(10) UNSIGNED NOT NULL,
416 415
 					DTT_ID INT(10) UNSIGNED NOT NULL,
417 416
 					CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
@@ -419,9 +418,9 @@  discard block
 block discarded – undo
419 418
 					PRIMARY KEY  (CHK_ID),
420 419
 					KEY REG_ID (REG_ID),
421 420
 					KEY DTT_ID (DTT_ID)";
422
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
423
-        $table_name = 'esp_state';
424
-        $sql = "STA_ID smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT,
421
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
422
+		$table_name = 'esp_state';
423
+		$sql = "STA_ID smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT,
425 424
 					  CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL,
426 425
 					  STA_abbrev VARCHAR(24) COLLATE utf8_bin NOT NULL,
427 426
 					  STA_name VARCHAR(100) COLLATE utf8_bin NOT NULL,
@@ -429,9 +428,9 @@  discard block
 block discarded – undo
429 428
 					  PRIMARY KEY  (STA_ID),
430 429
 					  KEY STA_abbrev (STA_abbrev),
431 430
 					  KEY CNT_ISO (CNT_ISO)";
432
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
433
-        $table_name = 'esp_status';
434
-        $sql = "STS_ID VARCHAR(3) COLLATE utf8_bin NOT NULL,
431
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
432
+		$table_name = 'esp_status';
433
+		$sql = "STS_ID VARCHAR(3) COLLATE utf8_bin NOT NULL,
435 434
 					  STS_code VARCHAR(45) COLLATE utf8_bin NOT NULL,
436 435
 					  STS_type set('event','registration','transaction','payment','email') COLLATE utf8_bin NOT NULL,
437 436
 					  STS_can_edit TINYINT(1) NOT NULL DEFAULT 0,
@@ -439,9 +438,9 @@  discard block
 block discarded – undo
439 438
 					  STS_open TINYINT(1) NOT NULL DEFAULT 1,
440 439
 					  UNIQUE KEY STS_ID_UNIQUE (STS_ID),
441 440
 					  KEY STS_type (STS_type)";
442
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
443
-        $table_name = 'esp_transaction';
444
-        $sql = "TXN_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
441
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
442
+		$table_name = 'esp_transaction';
443
+		$sql = "TXN_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
445 444
 					  TXN_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
446 445
 					  TXN_total DECIMAL(10,3) DEFAULT '0.00',
447 446
 					  TXN_paid DECIMAL(10,3) NOT NULL DEFAULT '0.00',
@@ -453,9 +452,9 @@  discard block
 block discarded – undo
453 452
 					  PRIMARY KEY  (TXN_ID),
454 453
 					  KEY TXN_timestamp (TXN_timestamp),
455 454
 					  KEY STS_ID (STS_ID)";
456
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
457
-        $table_name = 'esp_venue_meta';
458
-        $sql = "VNUM_ID INT(11) NOT NULL AUTO_INCREMENT,
455
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
456
+		$table_name = 'esp_venue_meta';
457
+		$sql = "VNUM_ID INT(11) NOT NULL AUTO_INCREMENT,
459 458
 			VNU_ID BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
460 459
 			VNU_address VARCHAR(255) DEFAULT NULL,
461 460
 			VNU_address2 VARCHAR(255) DEFAULT NULL,
@@ -474,10 +473,10 @@  discard block
 block discarded – undo
474 473
 			KEY VNU_ID (VNU_ID),
475 474
 			KEY STA_ID (STA_ID),
476 475
 			KEY CNT_ISO (CNT_ISO)";
477
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
478
-        // modified tables
479
-        $table_name = "esp_price";
480
-        $sql = "PRC_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
476
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
477
+		// modified tables
478
+		$table_name = "esp_price";
479
+		$sql = "PRC_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
481 480
 					  PRT_ID TINYINT(3) UNSIGNED NOT NULL,
482 481
 					  PRC_amount DECIMAL(10,3) NOT NULL DEFAULT '0.00',
483 482
 					  PRC_name VARCHAR(245) NOT NULL,
@@ -490,9 +489,9 @@  discard block
 block discarded – undo
490 489
 					  PRC_parent INT(10) UNSIGNED DEFAULT 0,
491 490
 					  PRIMARY KEY  (PRC_ID),
492 491
 					  KEY PRT_ID (PRT_ID)";
493
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
494
-        $table_name = "esp_price_type";
495
-        $sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
492
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
493
+		$table_name = "esp_price_type";
494
+		$sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
496 495
 				  PRT_name VARCHAR(45) NOT NULL,
497 496
 				  PBT_ID TINYINT(3) UNSIGNED NOT NULL DEFAULT '1',
498 497
 				  PRT_is_percent TINYINT(1) NOT NULL DEFAULT '0',
@@ -501,9 +500,9 @@  discard block
 block discarded – undo
501 500
 				  PRT_deleted TINYINT(1) NOT NULL DEFAULT '0',
502 501
 				  UNIQUE KEY PRT_name_UNIQUE (PRT_name),
503 502
 				  PRIMARY KEY  (PRT_ID)";
504
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
505
-        $table_name = "esp_ticket";
506
-        $sql = "TKT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
503
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
504
+		$table_name = "esp_ticket";
505
+		$sql = "TKT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
507 506
 					  TTM_ID INT(10) UNSIGNED NOT NULL,
508 507
 					  TKT_name VARCHAR(245) NOT NULL DEFAULT '',
509 508
 					  TKT_description TEXT NOT NULL,
@@ -525,9 +524,9 @@  discard block
 block discarded – undo
525 524
 					  TKT_deleted TINYINT(1) NOT NULL DEFAULT '0',
526 525
 					  PRIMARY KEY  (TKT_ID),
527 526
 					  KEY TKT_start_date (TKT_start_date)";
528
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
529
-        $table_name = 'esp_question_group';
530
-        $sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
527
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
528
+		$table_name = 'esp_question_group';
529
+		$sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
531 530
 					QSG_name VARCHAR(255) NOT NULL,
532 531
 					QSG_identifier VARCHAR(100) NOT NULL,
533 532
 					QSG_desc TEXT NULL,
@@ -540,38 +539,38 @@  discard block
 block discarded – undo
540 539
 					PRIMARY KEY  (QSG_ID),
541 540
 					UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier),
542 541
 					KEY QSG_order (QSG_order)';
543
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
544
-        /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */
545
-        $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
546
-        // (because many need to convert old string states to foreign keys into the states table)
547
-        $script_4_1_defaults->insert_default_states();
548
-        $script_4_1_defaults->insert_default_countries();
549
-        /** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */
550
-        $script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0');
551
-        $script_4_5_defaults->insert_default_price_types();
552
-        $script_4_5_defaults->insert_default_prices();
553
-        $script_4_5_defaults->insert_default_tickets();
554
-        /** @var EE_DMS_Core_4_6_0 $script_4_6_defaults */
555
-        $script_4_6_defaults = EE_Registry::instance()->load_dms('Core_4_6_0');
556
-        $script_4_6_defaults->add_default_admin_only_payments();
557
-        $script_4_6_defaults->insert_default_currencies();
558
-        return true;
559
-    }
542
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
543
+		/** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */
544
+		$script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
545
+		// (because many need to convert old string states to foreign keys into the states table)
546
+		$script_4_1_defaults->insert_default_states();
547
+		$script_4_1_defaults->insert_default_countries();
548
+		/** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */
549
+		$script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0');
550
+		$script_4_5_defaults->insert_default_price_types();
551
+		$script_4_5_defaults->insert_default_prices();
552
+		$script_4_5_defaults->insert_default_tickets();
553
+		/** @var EE_DMS_Core_4_6_0 $script_4_6_defaults */
554
+		$script_4_6_defaults = EE_Registry::instance()->load_dms('Core_4_6_0');
555
+		$script_4_6_defaults->add_default_admin_only_payments();
556
+		$script_4_6_defaults->insert_default_currencies();
557
+		return true;
558
+	}
560 559
 
561 560
 
562 561
 
563
-    /**
564
-     * @return boolean
565
-     */
566
-    public function schema_changes_after_migration()
567
-    {
568
-        return true;
569
-    }
562
+	/**
563
+	 * @return boolean
564
+	 */
565
+	public function schema_changes_after_migration()
566
+	{
567
+		return true;
568
+	}
570 569
 
571 570
 
572 571
 
573
-    public function migration_page_hooks()
574
-    {
575
-    }
572
+	public function migration_page_hooks()
573
+	{
574
+	}
576 575
 }
577 576
 // end of file: /core/data_migration_scripts/EE_DMS_Core_4_7_0.dms.php
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -15,12 +15,12 @@  discard block
 block discarded – undo
15 15
 // unfortunately, this needs to be done upon INCLUSION of this file,
16 16
 // instead of construction, because it only gets constructed on first page load
17 17
 // (all other times it gets resurrected from a wordpress option)
18
-$stages = glob(EE_CORE . 'data_migration_scripts/4_7_0_stages/*');
18
+$stages = glob(EE_CORE.'data_migration_scripts/4_7_0_stages/*');
19 19
 $class_to_filepath = array();
20 20
 foreach ($stages as $filepath) {
21 21
     $matches = array();
22 22
     preg_match('~4_7_0_stages/(.*).dmsstage.php~', $filepath, $matches);
23
-    $class_to_filepath[ $matches[1] ] = $filepath;
23
+    $class_to_filepath[$matches[1]] = $filepath;
24 24
 }
25 25
 // give addons a chance to autoload their stages too
26 26
 $class_to_filepath = apply_filters('FHEE__EE_DMS_4_7_0__autoloaded_stages', $class_to_filepath);
@@ -76,9 +76,9 @@  discard block
 block discarded – undo
76 76
             )
77 77
         ) {
78 78
             return true;
79
-        } elseif (! $version_string) {
79
+        } elseif ( ! $version_string) {
80 80
             // no version string provided... this must be pre 4.3
81
-            return false;// changed mind. dont want people thinking they should migrate yet because they cant
81
+            return false; // changed mind. dont want people thinking they should migrate yet because they cant
82 82
         } else {
83 83
             return false;
84 84
         }
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
     public function schema_changes_before_migration()
93 93
     {
94 94
         // relies on 4.1's EEH_Activation::create_table
95
-        require_once(EE_HELPERS . 'EEH_Activation.helper.php');
95
+        require_once(EE_HELPERS.'EEH_Activation.helper.php');
96 96
         $table_name = 'esp_answer';
97 97
         $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
98 98
 					REG_ID INT UNSIGNED NOT NULL,
Please login to merge, or discard this patch.
4_9_0_stages/EE_DMS_4_9_0_Answers_With_No_Registration.dmsstage.php 2 patches
Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -15,44 +15,44 @@
 block discarded – undo
15 15
 
16 16
 
17 17
 
18
-    /**
19
-     * Just initializes the status of the migration
20
-     *
21
-     * @return EE_DMS_4_9_0_Answers_With_No_Registration
22
-     */
23
-    public function __construct()
24
-    {
25
-        $this->_pretty_name = __('Answer Cleanup', 'event_espresso');
26
-        parent::__construct();
27
-    }
18
+	/**
19
+	 * Just initializes the status of the migration
20
+	 *
21
+	 * @return EE_DMS_4_9_0_Answers_With_No_Registration
22
+	 */
23
+	public function __construct()
24
+	{
25
+		$this->_pretty_name = __('Answer Cleanup', 'event_espresso');
26
+		parent::__construct();
27
+	}
28 28
 
29
-    /**
30
-     * Counts the records to migrate; the public version may cache it
31
-     * @return int
32
-     */
33
-    protected function _count_records_to_migrate()
34
-    {
35
-        return 1;
36
-    }
29
+	/**
30
+	 * Counts the records to migrate; the public version may cache it
31
+	 * @return int
32
+	 */
33
+	protected function _count_records_to_migrate()
34
+	{
35
+		return 1;
36
+	}
37 37
 
38
-    /**
39
-     * IMPORTANT: if an error is encountered, or everything is finished, this stage should update its status property accordingly.
40
-     * Note: it should not alter the count of items migrated. That is done in the public function that calls this.
41
-     * IMPORTANT: The count of items migrated should ONLY be less than $num_items_to_migrate when it's the last migration step, otherwise it
42
-     * should always return $num_items_to_migrate. (Eg, if we're migrating attendees rows from the database, and $num_items_to_migrate is set to 50,
43
-     * then we SHOULD actually migrate 50 rows,but at very least we MUST report/return 50 items migrated)
44
-     * @param int $num_items_to_migrate
45
-     * @return int number of items ACTUALLY migrated
46
-     */
47
-    protected function _migration_step($num_items_to_migrate = 50)
48
-    {
49
-        global $wpdb;
50
-        $wpdb->delete(
51
-            $wpdb->prefix . 'esp_answer',
52
-            array( 'REG_ID' => 0 ),
53
-            array( '%d' )
54
-        );
55
-        $this->set_completed();
56
-        return 1;
57
-    }
38
+	/**
39
+	 * IMPORTANT: if an error is encountered, or everything is finished, this stage should update its status property accordingly.
40
+	 * Note: it should not alter the count of items migrated. That is done in the public function that calls this.
41
+	 * IMPORTANT: The count of items migrated should ONLY be less than $num_items_to_migrate when it's the last migration step, otherwise it
42
+	 * should always return $num_items_to_migrate. (Eg, if we're migrating attendees rows from the database, and $num_items_to_migrate is set to 50,
43
+	 * then we SHOULD actually migrate 50 rows,but at very least we MUST report/return 50 items migrated)
44
+	 * @param int $num_items_to_migrate
45
+	 * @return int number of items ACTUALLY migrated
46
+	 */
47
+	protected function _migration_step($num_items_to_migrate = 50)
48
+	{
49
+		global $wpdb;
50
+		$wpdb->delete(
51
+			$wpdb->prefix . 'esp_answer',
52
+			array( 'REG_ID' => 0 ),
53
+			array( '%d' )
54
+		);
55
+		$this->set_completed();
56
+		return 1;
57
+	}
58 58
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -48,9 +48,9 @@
 block discarded – undo
48 48
     {
49 49
         global $wpdb;
50 50
         $wpdb->delete(
51
-            $wpdb->prefix . 'esp_answer',
52
-            array( 'REG_ID' => 0 ),
53
-            array( '%d' )
51
+            $wpdb->prefix.'esp_answer',
52
+            array('REG_ID' => 0),
53
+            array('%d')
54 54
         );
55 55
         $this->set_completed();
56 56
         return 1;
Please login to merge, or discard this patch.
4_9_0_stages/EE_DMS_4_9_0_Email_System_Question.dmsstage.php 2 patches
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -14,48 +14,48 @@
 block discarded – undo
14 14
 
15 15
 
16 16
 
17
-    /**
18
-     * Just initializes the status of the migration
19
-     *
20
-     * @return EE_DMS_4_9_0_Email_System_Question
21
-     */
22
-    public function __construct()
23
-    {
24
-        global $wpdb;
25
-        $this->_pretty_name = __('Email - System Question', 'event_espresso');
26
-        $this->_old_table = $wpdb->prefix.'esp_question';
27
-        $this->_extra_where_sql = "WHERE QST_system = 'email'";
28
-        parent::__construct();
29
-    }
17
+	/**
18
+	 * Just initializes the status of the migration
19
+	 *
20
+	 * @return EE_DMS_4_9_0_Email_System_Question
21
+	 */
22
+	public function __construct()
23
+	{
24
+		global $wpdb;
25
+		$this->_pretty_name = __('Email - System Question', 'event_espresso');
26
+		$this->_old_table = $wpdb->prefix.'esp_question';
27
+		$this->_extra_where_sql = "WHERE QST_system = 'email'";
28
+		parent::__construct();
29
+	}
30 30
 
31 31
 
32 32
 
33
-    /**
34
-     * updates the question with the new question type
35
-     * @param array $question an associative array where keys are column names and values are their values.
36
-     * @return null
37
-     */
38
-    protected function _migrate_old_row($question)
39
-    {
40
-        if ($question['QST_ID'] && $question['QST_system'] == 'email') {
41
-            global $wpdb;
42
-            $success = $wpdb->update(
43
-                $this->_old_table,
44
-                array( 'QST_type' => 'EMAIL' ),  // data
45
-                array( 'QST_ID' => $question['QST_ID'] ),  // where
46
-                array( '%s' ),   // data format
47
-                array( '%d' )  // where format
48
-            );
49
-            if (! $success) {
50
-                $this->add_error(
51
-                    sprintf(
52
-                        __('Could not update question system name "%1$s" for question ID=%2$d because "%3$s"', 'event_espresso'),
53
-                        wp_json_encode($question['QST_system']),
54
-                        $question['QST_ID'],
55
-                        $wpdb->last_error
56
-                    )
57
-                );
58
-            }
59
-        }
60
-    }
33
+	/**
34
+	 * updates the question with the new question type
35
+	 * @param array $question an associative array where keys are column names and values are their values.
36
+	 * @return null
37
+	 */
38
+	protected function _migrate_old_row($question)
39
+	{
40
+		if ($question['QST_ID'] && $question['QST_system'] == 'email') {
41
+			global $wpdb;
42
+			$success = $wpdb->update(
43
+				$this->_old_table,
44
+				array( 'QST_type' => 'EMAIL' ),  // data
45
+				array( 'QST_ID' => $question['QST_ID'] ),  // where
46
+				array( '%s' ),   // data format
47
+				array( '%d' )  // where format
48
+			);
49
+			if (! $success) {
50
+				$this->add_error(
51
+					sprintf(
52
+						__('Could not update question system name "%1$s" for question ID=%2$d because "%3$s"', 'event_espresso'),
53
+						wp_json_encode($question['QST_system']),
54
+						$question['QST_ID'],
55
+						$wpdb->last_error
56
+					)
57
+				);
58
+			}
59
+		}
60
+	}
61 61
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -41,12 +41,12 @@
 block discarded – undo
41 41
             global $wpdb;
42 42
             $success = $wpdb->update(
43 43
                 $this->_old_table,
44
-                array( 'QST_type' => 'EMAIL' ),  // data
45
-                array( 'QST_ID' => $question['QST_ID'] ),  // where
46
-                array( '%s' ),   // data format
47
-                array( '%d' )  // where format
44
+                array('QST_type' => 'EMAIL'), // data
45
+                array('QST_ID' => $question['QST_ID']), // where
46
+                array('%s'), // data format
47
+                array('%d')  // where format
48 48
             );
49
-            if (! $success) {
49
+            if ( ! $success) {
50 50
                 $this->add_error(
51 51
                     sprintf(
52 52
                         __('Could not update question system name "%1$s" for question ID=%2$d because "%3$s"', 'event_espresso'),
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_DMS_Core_4_3_0.dms.php 2 patches
Indentation   +184 added lines, -184 removed lines patch added patch discarded remove patch
@@ -14,11 +14,11 @@  discard block
 block discarded – undo
14 14
 $stages = glob(EE_CORE . 'data_migration_scripts/4_3_0_stages/*');
15 15
 $class_to_filepath = array();
16 16
 if (! empty($stages)) {
17
-    foreach ($stages as $filepath) {
18
-        $matches = array();
19
-        preg_match('~4_3_0_stages/(.*).dmsstage.php~', $filepath, $matches);
20
-        $class_to_filepath[ $matches[1] ] = $filepath;
21
-    }
17
+	foreach ($stages as $filepath) {
18
+		$matches = array();
19
+		preg_match('~4_3_0_stages/(.*).dmsstage.php~', $filepath, $matches);
20
+		$class_to_filepath[ $matches[1] ] = $filepath;
21
+	}
22 22
 }
23 23
 // give addons a chance to autoload their stages too
24 24
 $class_to_filepath = apply_filters('FHEE__EE_DMS_4_3_0__autoloaded_stages', $class_to_filepath);
@@ -31,56 +31,56 @@  discard block
 block discarded – undo
31 31
 
32 32
 
33 33
 
34
-    /**
35
-     * EE_DMS_Core_4_3_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.3.0", "event_espresso");
43
-        $this->_priority = 10;
44
-        $this->_migration_stages = array(
45
-            new EE_DMS_4_3_0_question_option_order(),
46
-            new EE_DMS_4_3_0_event_message_templates(),
47
-        );
48
-        parent::__construct($table_manager, $table_analysis);
49
-    }
34
+	/**
35
+	 * EE_DMS_Core_4_3_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.3.0", "event_espresso");
43
+		$this->_priority = 10;
44
+		$this->_migration_stages = array(
45
+			new EE_DMS_4_3_0_question_option_order(),
46
+			new EE_DMS_4_3_0_event_message_templates(),
47
+		);
48
+		parent::__construct($table_manager, $table_analysis);
49
+	}
50 50
 
51 51
 
52 52
 
53
-    public function can_migrate_from_version($version_array)
54
-    {
55
-        $version_string = $version_array['Core'];
56
-        if (version_compare($version_string, '4.3.0', '<=') && version_compare($version_string, '4.2.0', '>=')) {
53
+	public function can_migrate_from_version($version_array)
54
+	{
55
+		$version_string = $version_array['Core'];
56
+		if (version_compare($version_string, '4.3.0', '<=') && version_compare($version_string, '4.2.0', '>=')) {
57 57
 //          echo "$version_string can be migrated fro";
58
-            return true;
59
-        } elseif (! $version_string) {
58
+			return true;
59
+		} elseif (! $version_string) {
60 60
 //          echo "no version string provided: $version_string";
61
-            // no version string provided... this must be pre 4.2
62
-            return false;// changed mind. dont want people thinking they should migrate yet because they cant
63
-        } else {
61
+			// no version string provided... this must be pre 4.2
62
+			return false;// changed mind. dont want people thinking they should migrate yet because they cant
63
+		} else {
64 64
 //          echo "$version_string doesnt apply";
65
-            return false;
66
-        }
67
-    }
65
+			return false;
66
+		}
67
+	}
68 68
 
69 69
 
70 70
 
71
-    public function schema_changes_before_migration()
72
-    {
73
-        // relies on 4.1's EEH_Activation::create_table
74
-        require_once(EE_HELPERS . 'EEH_Activation.helper.php');
75
-        $table_name = 'esp_answer';
76
-        $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
71
+	public function schema_changes_before_migration()
72
+	{
73
+		// relies on 4.1's EEH_Activation::create_table
74
+		require_once(EE_HELPERS . 'EEH_Activation.helper.php');
75
+		$table_name = 'esp_answer';
76
+		$sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
77 77
 					REG_ID INT UNSIGNED NOT NULL,
78 78
 					QST_ID INT UNSIGNED NOT NULL,
79 79
 					ANS_value TEXT NOT NULL,
80 80
 					PRIMARY KEY  (ANS_ID)";
81
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
82
-        $table_name = 'esp_attendee_meta';
83
-        $sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
81
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
82
+		$table_name = 'esp_attendee_meta';
83
+		$sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
84 84
 						ATT_ID BIGINT(20) UNSIGNED NOT NULL,
85 85
 						ATT_fname VARCHAR(45) NOT NULL,
86 86
 						ATT_lname VARCHAR(45) NOT	NULL,
@@ -96,9 +96,9 @@  discard block
 block discarded – undo
96 96
 								KEY ATT_fname (ATT_fname),
97 97
 								KEY ATT_lname (ATT_lname),
98 98
 								KEY ATT_email (ATT_email)";
99
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
100
-        $table_name = 'esp_country';
101
-        $sql = "CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL,
99
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
100
+		$table_name = 'esp_country';
101
+		$sql = "CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL,
102 102
 					  CNT_ISO3 VARCHAR(3) COLLATE utf8_bin NOT NULL,
103 103
 					  RGN_ID TINYINT(3) UNSIGNED DEFAULT NULL,
104 104
 					  CNT_name VARCHAR(45) COLLATE utf8_bin NOT NULL,
@@ -114,9 +114,9 @@  discard block
 block discarded – undo
114 114
 					  CNT_is_EU TINYINT(1) DEFAULT '0',
115 115
 					  CNT_active TINYINT(1) DEFAULT '0',
116 116
 					  PRIMARY KEY  (CNT_ISO)";
117
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
118
-        $table_name = 'esp_datetime';
119
-        $sql = "DTT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
117
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
118
+		$table_name = 'esp_datetime';
119
+		$sql = "DTT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
120 120
 				  EVT_ID BIGINT(20) UNSIGNED NOT NULL,
121 121
 				  DTT_name VARCHAR(255) NOT NULL DEFAULT '',
122 122
 				  DTT_description TEXT NOT NULL,
@@ -131,9 +131,9 @@  discard block
 block discarded – undo
131 131
 						PRIMARY KEY  (DTT_ID),
132 132
 						KEY EVT_ID (EVT_ID),
133 133
 						KEY DTT_is_primary (DTT_is_primary)";
134
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
135
-        $table_name = 'esp_event_meta';
136
-        $sql = "
134
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
135
+		$table_name = 'esp_event_meta';
136
+		$sql = "
137 137
 			EVTM_ID INT NOT NULL AUTO_INCREMENT,
138 138
 			EVT_ID BIGINT(20) UNSIGNED NOT NULL,
139 139
 			EVT_display_desc TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
@@ -148,31 +148,31 @@  discard block
 block discarded – undo
148 148
 			EVT_external_URL VARCHAR(200) NULL,
149 149
 			EVT_donations TINYINT(1) NULL,
150 150
 			PRIMARY KEY  (EVTM_ID)";
151
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
152
-        $table_name = 'esp_event_question_group';
153
-        $sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
151
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
152
+		$table_name = 'esp_event_question_group';
153
+		$sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
154 154
 					EVT_ID BIGINT(20) UNSIGNED NOT NULL,
155 155
 					QSG_ID INT UNSIGNED NOT NULL,
156 156
 					EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
157 157
 					PRIMARY KEY  (EQG_ID)";
158
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
159
-        $table_name = 'esp_event_venue';
160
-        $sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
158
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
159
+		$table_name = 'esp_event_venue';
160
+		$sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
161 161
 				EVT_ID BIGINT(20) UNSIGNED NOT NULL,
162 162
 				VNU_ID BIGINT(20) UNSIGNED NOT NULL,
163 163
 				EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
164 164
 				PRIMARY KEY  (EVV_ID)";
165
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
166
-        $table_name = 'esp_extra_meta';
167
-        $sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
165
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
166
+		$table_name = 'esp_extra_meta';
167
+		$sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
168 168
 				OBJ_ID INT(11) DEFAULT NULL,
169 169
 				EXM_type VARCHAR(45) DEFAULT NULL,
170 170
 				EXM_key VARCHAR(45) DEFAULT NULL,
171 171
 				EXM_value TEXT,
172 172
 				PRIMARY KEY  (EXM_ID)";
173
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
174
-        $table_name = 'esp_line_item';
175
-        $sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
173
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
174
+		$table_name = 'esp_line_item';
175
+		$sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
176 176
 				LIN_code VARCHAR(245) NOT NULL DEFAULT '',
177 177
 				TXN_ID INT(11) DEFAULT NULL,
178 178
 				LIN_name VARCHAR(245) NOT NULL DEFAULT '',
@@ -188,19 +188,19 @@  discard block
 block discarded – undo
188 188
 				OBJ_ID INT(11) DEFAULT NULL,
189 189
 				OBJ_type VARCHAR(45)DEFAULT NULL,
190 190
 				PRIMARY KEY  (LIN_ID)";
191
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
192
-        $table_name = 'esp_message_template';
193
-        $sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
191
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
192
+		$table_name = 'esp_message_template';
193
+		$sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
194 194
 					GRP_ID INT(10) UNSIGNED NOT NULL,
195 195
 					MTP_context VARCHAR(50) NOT NULL,
196 196
 					MTP_template_field VARCHAR(30) NOT NULL,
197 197
 					MTP_content TEXT NOT NULL,
198 198
 					PRIMARY KEY  (MTP_ID),
199 199
 					KEY GRP_ID (GRP_ID)";
200
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
201
-        $this->_get_table_manager()->dropIndex('esp_message_template_group', 'EVT_ID');
202
-        $table_name = 'esp_message_template_group';
203
-        $sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
200
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
201
+		$this->_get_table_manager()->dropIndex('esp_message_template_group', 'EVT_ID');
202
+		$table_name = 'esp_message_template_group';
203
+		$sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
204 204
 					MTP_user_id INT(10) NOT NULL DEFAULT '1',
205 205
 					MTP_name VARCHAR(245) NOT NULL DEFAULT '',
206 206
 					MTP_description VARCHAR(245) NOT NULL DEFAULT '',
@@ -212,17 +212,17 @@  discard block
 block discarded – undo
212 212
 					MTP_is_active TINYINT(1) NOT NULL DEFAULT '1',
213 213
 					PRIMARY KEY  (GRP_ID),
214 214
 					KEY MTP_user_id (MTP_user_id)";
215
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
216
-        $table_name = 'esp_event_message_template';
217
-        $sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
215
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
216
+		$table_name = 'esp_event_message_template';
217
+		$sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
218 218
 					EVT_ID BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
219 219
 					GRP_ID INT(10) UNSIGNED NOT NULL DEFAULT 0,
220 220
 					PRIMARY KEY  (EMT_ID),
221 221
 					KEY EVT_ID (EVT_ID),
222 222
 					KEY GRP_ID (GRP_ID)";
223
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
224
-        $table_name = 'esp_payment';
225
-        $sql = "PAY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
223
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
224
+		$table_name = 'esp_payment';
225
+		$sql = "PAY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
226 226
 					TXN_ID INT(10) UNSIGNED DEFAULT NULL,
227 227
 					STS_ID VARCHAR(3) COLLATE utf8_bin DEFAULT NULL,
228 228
 					PAY_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
@@ -238,9 +238,9 @@  discard block
 block discarded – undo
238 238
 					PRIMARY KEY  (PAY_ID),
239 239
 					KEY TXN_ID (TXN_ID),
240 240
 					KEY PAY_timestamp (PAY_timestamp)";
241
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
242
-        $table_name = "esp_ticket";
243
-        $sql = "TKT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
241
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
242
+		$table_name = "esp_ticket";
243
+		$sql = "TKT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
244 244
 					  TTM_ID INT(10) UNSIGNED NOT NULL,
245 245
 					  TKT_name VARCHAR(245) NOT NULL DEFAULT '',
246 246
 					  TKT_description TEXT NOT NULL,
@@ -260,28 +260,28 @@  discard block
 block discarded – undo
260 260
 					  TKT_parent INT(10) UNSIGNED DEFAULT '0',
261 261
 					  TKT_deleted TINYINT(1) NOT NULL DEFAULT '0',
262 262
 					  PRIMARY KEY  (TKT_ID)";
263
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
264
-        $table_name = "esp_ticket_price";
265
-        $sql = "TKP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
263
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
264
+		$table_name = "esp_ticket_price";
265
+		$sql = "TKP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
266 266
 					  TKT_ID INT(10) UNSIGNED NOT NULL,
267 267
 					  PRC_ID INT(10) UNSIGNED NOT NULL,
268 268
 					  PRIMARY KEY  (TKP_ID)";
269
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
270
-        $table_name = "esp_datetime_ticket";
271
-        $sql = "DTK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
269
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
270
+		$table_name = "esp_datetime_ticket";
271
+		$sql = "DTK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
272 272
 					  DTT_ID INT(10) UNSIGNED NOT NULL,
273 273
 					  TKT_ID INT(10) UNSIGNED NOT NULL,
274 274
 					  PRIMARY KEY  (DTK_ID)";
275
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
276
-        $table_name = "esp_ticket_template";
277
-        $sql = "TTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
275
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
276
+		$table_name = "esp_ticket_template";
277
+		$sql = "TTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
278 278
 					  TTM_name VARCHAR(45) NOT NULL,
279 279
 					  TTM_description TEXT,
280 280
 					  TTM_file VARCHAR(45),
281 281
 					  PRIMARY KEY  (TTM_ID)";
282
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
283
-        $table_name = "esp_price";
284
-        $sql = "PRC_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
282
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
283
+		$table_name = "esp_price";
284
+		$sql = "PRC_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
285 285
 					  PRT_ID TINYINT(3) UNSIGNED NOT NULL,
286 286
 					  PRC_amount DECIMAL(10,3) NOT NULL DEFAULT '0.00',
287 287
 					  PRC_name VARCHAR(245) NOT NULL,
@@ -292,9 +292,9 @@  discard block
 block discarded – undo
292 292
 					  PRC_order TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
293 293
 					  PRC_parent INT(10) UNSIGNED DEFAULT 0,
294 294
 					  PRIMARY KEY  (PRC_ID)";
295
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
296
-        $table_name = "esp_price_type";
297
-        $sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
295
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
296
+		$table_name = "esp_price_type";
297
+		$sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
298 298
 				  PRT_name VARCHAR(45) NOT NULL,
299 299
 				  PBT_ID TINYINT(3) UNSIGNED NOT NULL DEFAULT '1',
300 300
 				  PRT_is_percent TINYINT(1) NOT NULL DEFAULT '0',
@@ -302,9 +302,9 @@  discard block
 block discarded – undo
302 302
 				  PRT_deleted TINYINT(1) NOT NULL DEFAULT '0',
303 303
 				  UNIQUE KEY PRT_name_UNIQUE (PRT_name),
304 304
 				  PRIMARY KEY  (PRT_ID)";
305
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
306
-        $table_name = 'esp_question';
307
-        $sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
305
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
306
+		$table_name = 'esp_question';
307
+		$sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
308 308
 					QST_display_text TEXT NOT NULL,
309 309
 					QST_admin_label VARCHAR(255) NOT NULL,
310 310
 					QST_system VARCHAR(25) DEFAULT NULL,
@@ -316,10 +316,10 @@  discard block
 block discarded – undo
316 316
 					QST_wp_user BIGINT UNSIGNED NULL,
317 317
 					QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0,
318 318
 					PRIMARY KEY  (QST_ID)';
319
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
320
-        $this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE');
321
-        $table_name = 'esp_question_group';
322
-        $sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
319
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
320
+		$this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE');
321
+		$table_name = 'esp_question_group';
322
+		$sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
323 323
 					QSG_name VARCHAR(255) NOT NULL,
324 324
 					QSG_identifier VARCHAR(100) NOT NULL,
325 325
 					QSG_desc TEXT NULL,
@@ -330,25 +330,25 @@  discard block
 block discarded – undo
330 330
 					QSG_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
331 331
 					PRIMARY KEY  (QSG_ID),
332 332
 					UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier ASC)';
333
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
334
-        $table_name = 'esp_question_group_question';
335
-        $sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
333
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
334
+		$table_name = 'esp_question_group_question';
335
+		$sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
336 336
 					QSG_ID INT UNSIGNED NOT NULL,
337 337
 					QST_ID INT UNSIGNED NOT NULL,
338 338
 					QGQ_order INT UNSIGNED NOT NULL DEFAULT 0,
339 339
 					PRIMARY KEY  (QGQ_ID) ";
340
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
341
-        $table_name = 'esp_question_option';
342
-        $sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
340
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
341
+		$table_name = 'esp_question_option';
342
+		$sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
343 343
 					QSO_value VARCHAR(255) NOT NULL,
344 344
 					QSO_desc TEXT NOT NULL,
345 345
 					QST_ID INT UNSIGNED NOT NULL,
346 346
 					QSO_order INT UNSIGNED NOT NULL DEFAULT 0,
347 347
 					QSO_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
348 348
 					PRIMARY KEY  (QSO_ID)";
349
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
350
-        $table_name = 'esp_registration';
351
-        $sql = "REG_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
349
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
350
+		$table_name = 'esp_registration';
351
+		$sql = "REG_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
352 352
 					  EVT_ID BIGINT(20) UNSIGNED NOT NULL,
353 353
 					  ATT_ID BIGINT(20) UNSIGNED NOT NULL,
354 354
 					  TXN_ID INT(10) UNSIGNED NOT NULL,
@@ -371,25 +371,25 @@  discard block
 block discarded – undo
371 371
 					  KEY STS_ID (STS_ID),
372 372
 					  KEY REG_url_link (REG_url_link),
373 373
 					  KEY REG_code (REG_code)";
374
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
375
-        $table_name = 'esp_checkin';
376
-        $sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
374
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
375
+		$table_name = 'esp_checkin';
376
+		$sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
377 377
 					REG_ID INT(10) UNSIGNED NOT NULL,
378 378
 					DTT_ID INT(10) UNSIGNED NOT NULL,
379 379
 					CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
380 380
 					CHK_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
381 381
 					PRIMARY KEY  (CHK_ID)";
382
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
383
-        $table_name = 'esp_state';
384
-        $sql = "STA_ID smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT,
382
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
383
+		$table_name = 'esp_state';
384
+		$sql = "STA_ID smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT,
385 385
 					  CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL,
386 386
 					  STA_abbrev VARCHAR(6) COLLATE utf8_bin NOT NULL,
387 387
 					  STA_name VARCHAR(100) COLLATE utf8_bin NOT NULL,
388 388
 					  STA_active TINYINT(1) DEFAULT '1',
389 389
 					  PRIMARY KEY  (STA_ID)";
390
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
391
-        $table_name = 'esp_status';
392
-        $sql = "STS_ID VARCHAR(3) COLLATE utf8_bin NOT NULL,
390
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
391
+		$table_name = 'esp_status';
392
+		$sql = "STS_ID VARCHAR(3) COLLATE utf8_bin NOT NULL,
393 393
 					  STS_code VARCHAR(45) COLLATE utf8_bin NOT NULL,
394 394
 					  STS_type set('event','registration','transaction','payment','email') COLLATE utf8_bin NOT NULL,
395 395
 					  STS_can_edit TINYINT(1) NOT NULL DEFAULT 0,
@@ -397,9 +397,9 @@  discard block
 block discarded – undo
397 397
 					  STS_open TINYINT(1) NOT NULL DEFAULT 1,
398 398
 					  UNIQUE KEY STS_ID_UNIQUE (STS_ID),
399 399
 					  KEY STS_type (STS_type)";
400
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
401
-        $table_name = 'esp_transaction';
402
-        $sql = "TXN_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
400
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
401
+		$table_name = 'esp_transaction';
402
+		$sql = "TXN_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
403 403
 					  TXN_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
404 404
 					  TXN_total DECIMAL(10,3) DEFAULT '0.00',
405 405
 					  TXN_paid DECIMAL(10,3) NOT NULL DEFAULT '0.00',
@@ -409,9 +409,9 @@  discard block
 block discarded – undo
409 409
 					  PRIMARY KEY  (TXN_ID),
410 410
 					  KEY TXN_timestamp (TXN_timestamp),
411 411
 					  KEY STS_ID (STS_ID)";
412
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
413
-        $table_name = 'esp_venue_meta';
414
-        $sql = "VNUM_ID INT(11) NOT NULL AUTO_INCREMENT,
412
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
413
+		$table_name = 'esp_venue_meta';
414
+		$sql = "VNUM_ID INT(11) NOT NULL AUTO_INCREMENT,
415 415
 			VNU_ID BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
416 416
 			VNU_address VARCHAR(255) DEFAULT NULL,
417 417
 			VNU_address2 VARCHAR(255) DEFAULT NULL,
@@ -429,77 +429,77 @@  discard block
 block discarded – undo
429 429
 			PRIMARY KEY  (VNUM_ID),
430 430
 			KEY STA_ID (STA_ID),
431 431
 			KEY CNT_ISO (CNT_ISO)";
432
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
433
-        $script_with_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
434
-        // setting up the DEFAULT stats and countries is also essential for the data migrations to run
435
-        // (because many need to convert old string states to foreign keys into the states table)
436
-        $script_with_defaults->insert_default_states();
437
-        $script_with_defaults->insert_default_countries();
438
-        // setting up DEFAULT prices, price types, and tickets is also essential for the price migrations
439
-        $script_with_defaults->insert_default_price_types();
440
-        $script_with_defaults->insert_default_prices();
441
-        // but the schema on the tickets table has changed since 4.1, so use our DEFAULT ticket method instead of 4.1's
442
-        $this->insert_default_tickets();
443
-        // setting up the config wp option pretty well counts as a 'schema change', or at least should happen ehre
444
-        EE_Config::instance()->update_espresso_config(false, true);
445
-        return true;
446
-    }
432
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
433
+		$script_with_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
434
+		// setting up the DEFAULT stats and countries is also essential for the data migrations to run
435
+		// (because many need to convert old string states to foreign keys into the states table)
436
+		$script_with_defaults->insert_default_states();
437
+		$script_with_defaults->insert_default_countries();
438
+		// setting up DEFAULT prices, price types, and tickets is also essential for the price migrations
439
+		$script_with_defaults->insert_default_price_types();
440
+		$script_with_defaults->insert_default_prices();
441
+		// but the schema on the tickets table has changed since 4.1, so use our DEFAULT ticket method instead of 4.1's
442
+		$this->insert_default_tickets();
443
+		// setting up the config wp option pretty well counts as a 'schema change', or at least should happen ehre
444
+		EE_Config::instance()->update_espresso_config(false, true);
445
+		return true;
446
+	}
447 447
 
448 448
 
449 449
 
450
-    /**
451
-     * @return boolean
452
-     */
453
-    public function schema_changes_after_migration()
454
-    {
455
-        return true;
456
-    }
450
+	/**
451
+	 * @return boolean
452
+	 */
453
+	public function schema_changes_after_migration()
454
+	{
455
+		return true;
456
+	}
457 457
 
458 458
 
459 459
 
460
-    public function migration_page_hooks()
461
-    {
462
-    }
460
+	public function migration_page_hooks()
461
+	{
462
+	}
463 463
 
464 464
 
465 465
 
466
-    /**
467
-     * insert DEFAULT ticket
468
-     * Almost identical to EE_DMS_Core_4_1_0::insert_default_tickets, except is aware of the TKT_required field
469
-     *
470
-     * @access public
471
-     * @static
472
-     * @return void
473
-     */
474
-    public function insert_default_tickets()
475
-    {
476
-        global $wpdb;
477
-        $ticket_table = $wpdb->prefix . "esp_ticket";
478
-        if ($this->_get_table_analysis()->tableExists($ticket_table)) {
479
-            $SQL = 'SELECT COUNT(TKT_ID) FROM ' . $ticket_table;
480
-            $tickets_exist = $wpdb->get_var($SQL);
481
-            if (! $tickets_exist) {
482
-                $SQL = "INSERT INTO $ticket_table
466
+	/**
467
+	 * insert DEFAULT ticket
468
+	 * Almost identical to EE_DMS_Core_4_1_0::insert_default_tickets, except is aware of the TKT_required field
469
+	 *
470
+	 * @access public
471
+	 * @static
472
+	 * @return void
473
+	 */
474
+	public function insert_default_tickets()
475
+	{
476
+		global $wpdb;
477
+		$ticket_table = $wpdb->prefix . "esp_ticket";
478
+		if ($this->_get_table_analysis()->tableExists($ticket_table)) {
479
+			$SQL = 'SELECT COUNT(TKT_ID) FROM ' . $ticket_table;
480
+			$tickets_exist = $wpdb->get_var($SQL);
481
+			if (! $tickets_exist) {
482
+				$SQL = "INSERT INTO $ticket_table
483 483
 					( TKT_ID, TTM_ID, TKT_name, TKT_description, TKT_qty, TKT_sold, TKT_uses, TKT_required, TKT_min, TKT_max, TKT_price, TKT_start_date, TKT_end_date, TKT_taxable, TKT_order, TKT_row, TKT_is_default, TKT_parent, TKT_deleted ) VALUES
484 484
 					( 1, 0, '"
485
-                       . __("Free Ticket", "event_espresso")
486
-                       . "', '', 100, 0, -1, 0, 0, -1, 0.00, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, 0, 1, 1, 0, 0);";
487
-                $SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL', $SQL);
488
-                $wpdb->query($SQL);
489
-            }
490
-        }
491
-        $ticket_price_table = $wpdb->prefix . "esp_ticket_price";
492
-        if ($this->_get_table_analysis()->tableExists($ticket_price_table)) {
493
-            $SQL = 'SELECT COUNT(TKP_ID) FROM ' . $ticket_price_table;
494
-            $ticket_prc_exist = $wpdb->get_var($SQL);
495
-            if (! $ticket_prc_exist) {
496
-                $SQL = "INSERT INTO $ticket_price_table
485
+					   . __("Free Ticket", "event_espresso")
486
+					   . "', '', 100, 0, -1, 0, 0, -1, 0.00, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, 0, 1, 1, 0, 0);";
487
+				$SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL', $SQL);
488
+				$wpdb->query($SQL);
489
+			}
490
+		}
491
+		$ticket_price_table = $wpdb->prefix . "esp_ticket_price";
492
+		if ($this->_get_table_analysis()->tableExists($ticket_price_table)) {
493
+			$SQL = 'SELECT COUNT(TKP_ID) FROM ' . $ticket_price_table;
494
+			$ticket_prc_exist = $wpdb->get_var($SQL);
495
+			if (! $ticket_prc_exist) {
496
+				$SQL = "INSERT INTO $ticket_price_table
497 497
 				( TKP_ID, TKT_ID, PRC_ID ) VALUES
498 498
 				( 1, 1, 1 )
499 499
 				";
500
-                $SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL__ticket_price', $SQL);
501
-                $wpdb->query($SQL);
502
-            }
503
-        }
504
-    }
500
+				$SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL__ticket_price', $SQL);
501
+				$wpdb->query($SQL);
502
+			}
503
+		}
504
+	}
505 505
 }
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -11,13 +11,13 @@  discard block
 block discarded – undo
11 11
 // unfortunately, this needs to be done upon INCLUSION of this file,
12 12
 // instead of construction, because it only gets constructed on first page load
13 13
 // (all other times it gets resurrected from a wordpress option)
14
-$stages = glob(EE_CORE . 'data_migration_scripts/4_3_0_stages/*');
14
+$stages = glob(EE_CORE.'data_migration_scripts/4_3_0_stages/*');
15 15
 $class_to_filepath = array();
16
-if (! empty($stages)) {
16
+if ( ! empty($stages)) {
17 17
     foreach ($stages as $filepath) {
18 18
         $matches = array();
19 19
         preg_match('~4_3_0_stages/(.*).dmsstage.php~', $filepath, $matches);
20
-        $class_to_filepath[ $matches[1] ] = $filepath;
20
+        $class_to_filepath[$matches[1]] = $filepath;
21 21
     }
22 22
 }
23 23
 // give addons a chance to autoload their stages too
@@ -56,10 +56,10 @@  discard block
 block discarded – undo
56 56
         if (version_compare($version_string, '4.3.0', '<=') && version_compare($version_string, '4.2.0', '>=')) {
57 57
 //          echo "$version_string can be migrated fro";
58 58
             return true;
59
-        } elseif (! $version_string) {
59
+        } elseif ( ! $version_string) {
60 60
 //          echo "no version string provided: $version_string";
61 61
             // no version string provided... this must be pre 4.2
62
-            return false;// changed mind. dont want people thinking they should migrate yet because they cant
62
+            return false; // changed mind. dont want people thinking they should migrate yet because they cant
63 63
         } else {
64 64
 //          echo "$version_string doesnt apply";
65 65
             return false;
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
     public function schema_changes_before_migration()
72 72
     {
73 73
         // relies on 4.1's EEH_Activation::create_table
74
-        require_once(EE_HELPERS . 'EEH_Activation.helper.php');
74
+        require_once(EE_HELPERS.'EEH_Activation.helper.php');
75 75
         $table_name = 'esp_answer';
76 76
         $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
77 77
 					REG_ID INT UNSIGNED NOT NULL,
@@ -474,11 +474,11 @@  discard block
 block discarded – undo
474 474
     public function insert_default_tickets()
475 475
     {
476 476
         global $wpdb;
477
-        $ticket_table = $wpdb->prefix . "esp_ticket";
477
+        $ticket_table = $wpdb->prefix."esp_ticket";
478 478
         if ($this->_get_table_analysis()->tableExists($ticket_table)) {
479
-            $SQL = 'SELECT COUNT(TKT_ID) FROM ' . $ticket_table;
479
+            $SQL = 'SELECT COUNT(TKT_ID) FROM '.$ticket_table;
480 480
             $tickets_exist = $wpdb->get_var($SQL);
481
-            if (! $tickets_exist) {
481
+            if ( ! $tickets_exist) {
482 482
                 $SQL = "INSERT INTO $ticket_table
483 483
 					( TKT_ID, TTM_ID, TKT_name, TKT_description, TKT_qty, TKT_sold, TKT_uses, TKT_required, TKT_min, TKT_max, TKT_price, TKT_start_date, TKT_end_date, TKT_taxable, TKT_order, TKT_row, TKT_is_default, TKT_parent, TKT_deleted ) VALUES
484 484
 					( 1, 0, '"
@@ -488,11 +488,11 @@  discard block
 block discarded – undo
488 488
                 $wpdb->query($SQL);
489 489
             }
490 490
         }
491
-        $ticket_price_table = $wpdb->prefix . "esp_ticket_price";
491
+        $ticket_price_table = $wpdb->prefix."esp_ticket_price";
492 492
         if ($this->_get_table_analysis()->tableExists($ticket_price_table)) {
493
-            $SQL = 'SELECT COUNT(TKP_ID) FROM ' . $ticket_price_table;
493
+            $SQL = 'SELECT COUNT(TKP_ID) FROM '.$ticket_price_table;
494 494
             $ticket_prc_exist = $wpdb->get_var($SQL);
495
-            if (! $ticket_prc_exist) {
495
+            if ( ! $ticket_prc_exist) {
496 496
                 $SQL = "INSERT INTO $ticket_price_table
497 497
 				( TKP_ID, TKT_ID, PRC_ID ) VALUES
498 498
 				( 1, 1, 1 )
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_DMS_Core_4_8_0.dms.php 2 patches
Indentation   +357 added lines, -357 removed lines patch added patch discarded remove patch
@@ -17,9 +17,9 @@  discard block
 block discarded – undo
17 17
 $stages = glob(EE_CORE . 'data_migration_scripts/4_8_0_stages/*');
18 18
 $class_to_filepath = array();
19 19
 foreach ($stages as $filepath) {
20
-    $matches = array();
21
-    preg_match('~4_8_0_stages/(.*).dmsstage.php~', $filepath, $matches);
22
-    $class_to_filepath[ $matches[1] ] = $filepath;
20
+	$matches = array();
21
+	preg_match('~4_8_0_stages/(.*).dmsstage.php~', $filepath, $matches);
22
+	$class_to_filepath[ $matches[1] ] = $filepath;
23 23
 }
24 24
 // give addons a chance to autoload their stages too
25 25
 $class_to_filepath = apply_filters('FHEE__EE_DMS_4_8_0__autoloaded_stages', $class_to_filepath);
@@ -38,71 +38,71 @@  discard block
 block discarded – undo
38 38
 class EE_DMS_Core_4_8_0 extends EE_Data_Migration_Script_Base
39 39
 {
40 40
 
41
-    /**
42
-     * return EE_DMS_Core_4_8_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 = esc_html__("Data Update to Event Espresso 4.8.0", "event_espresso");
50
-        $this->_priority = 10;
51
-        $this->_migration_stages = array(
52
-            new EE_DMS_4_8_0_pretax_totals(),
53
-            new EE_DMS_4_8_0_event_subtotals(),
54
-        );
55
-        parent::__construct($table_manager, $table_analysis);
56
-    }
41
+	/**
42
+	 * return EE_DMS_Core_4_8_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 = esc_html__("Data Update to Event Espresso 4.8.0", "event_espresso");
50
+		$this->_priority = 10;
51
+		$this->_migration_stages = array(
52
+			new EE_DMS_4_8_0_pretax_totals(),
53
+			new EE_DMS_4_8_0_event_subtotals(),
54
+		);
55
+		parent::__construct($table_manager, $table_analysis);
56
+	}
57 57
 
58 58
 
59 59
 
60
-    /**
61
-     * Because this is being done at basically the same time as the MER-ready branch
62
-     * of core, it's possible people might have installed MEr-ready branch first,
63
-     * and then this one, in which case we still want to perform this migration,
64
-     * even though the version might not have increased
65
-     *
66
-     * @param array $version_array
67
-     * @return bool
68
-     */
69
-    public function can_migrate_from_version($version_array)
70
-    {
71
-        $version_string = $version_array['Core'];
72
-        if (version_compare($version_string, '4.8.0', '<=') && version_compare($version_string, '4.7.0', '>=')) {
60
+	/**
61
+	 * Because this is being done at basically the same time as the MER-ready branch
62
+	 * of core, it's possible people might have installed MEr-ready branch first,
63
+	 * and then this one, in which case we still want to perform this migration,
64
+	 * even though the version might not have increased
65
+	 *
66
+	 * @param array $version_array
67
+	 * @return bool
68
+	 */
69
+	public function can_migrate_from_version($version_array)
70
+	{
71
+		$version_string = $version_array['Core'];
72
+		if (version_compare($version_string, '4.8.0', '<=') && version_compare($version_string, '4.7.0', '>=')) {
73 73
 //          echo "$version_string can be migrated from";
74
-            return true;
75
-        } elseif (! $version_string) {
74
+			return true;
75
+		} elseif (! $version_string) {
76 76
 //          echo "no version string provided: $version_string";
77
-            // no version string provided... this must be pre 4.3
78
-            return false;// changed mind. dont want people thinking they should migrate yet because they cant
79
-        } else {
77
+			// no version string provided... this must be pre 4.3
78
+			return false;// changed mind. dont want people thinking they should migrate yet because they cant
79
+		} else {
80 80
 //          echo "$version_string doesnt apply";
81
-            return false;
82
-        }
83
-    }
81
+			return false;
82
+		}
83
+	}
84 84
 
85 85
 
86 86
 
87
-    /**
88
-     * @return bool
89
-     */
90
-    public function schema_changes_before_migration()
91
-    {
92
-        require_once(EE_HELPERS . 'EEH_Activation.helper.php');
93
-        $now_in_mysql = current_time('mysql', true);
94
-        require_once(EE_HELPERS . 'EEH_Activation.helper.php');
95
-        $table_name = 'esp_answer';
96
-        $sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
87
+	/**
88
+	 * @return bool
89
+	 */
90
+	public function schema_changes_before_migration()
91
+	{
92
+		require_once(EE_HELPERS . 'EEH_Activation.helper.php');
93
+		$now_in_mysql = current_time('mysql', true);
94
+		require_once(EE_HELPERS . 'EEH_Activation.helper.php');
95
+		$table_name = 'esp_answer';
96
+		$sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
97 97
 					REG_ID int(10) unsigned NOT NULL,
98 98
 					QST_ID int(10) unsigned NOT NULL,
99 99
 					ANS_value text NOT NULL,
100 100
 					PRIMARY KEY  (ANS_ID),
101 101
 					KEY REG_ID (REG_ID),
102 102
 					KEY QST_ID (QST_ID)";
103
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
104
-        $table_name = 'esp_attendee_meta';
105
-        $sql = "ATTM_ID int(10) unsigned NOT	NULL AUTO_INCREMENT,
103
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
104
+		$table_name = 'esp_attendee_meta';
105
+		$sql = "ATTM_ID int(10) unsigned NOT	NULL AUTO_INCREMENT,
106 106
 						ATT_ID bigint(20) unsigned NOT NULL,
107 107
 						ATT_fname varchar(45) NOT NULL,
108 108
 						ATT_lname varchar(45) NOT	NULL,
@@ -119,9 +119,9 @@  discard block
 block discarded – undo
119 119
 								KEY ATT_email (ATT_email),
120 120
 								KEY ATT_lname (ATT_lname),
121 121
 								KEY ATT_fname (ATT_fname)";
122
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
123
-        $table_name = 'esp_country';
124
-        $sql = "CNT_ISO varchar(2) collate utf8_bin NOT NULL,
122
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
123
+		$table_name = 'esp_country';
124
+		$sql = "CNT_ISO varchar(2) collate utf8_bin NOT NULL,
125 125
 					  CNT_ISO3 varchar(3) collate utf8_bin NOT NULL,
126 126
 					  RGN_ID tinyint(3) unsigned DEFAULT NULL,
127 127
 					  CNT_name varchar(45) collate utf8_bin NOT NULL,
@@ -137,25 +137,25 @@  discard block
 block discarded – undo
137 137
 					  CNT_is_EU tinyint(1) DEFAULT '0',
138 138
 					  CNT_active tinyint(1) DEFAULT '0',
139 139
 					  PRIMARY KEY  (CNT_ISO)";
140
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
141
-        $table_name = 'esp_currency';
142
-        $sql = "CUR_code varchar(6) collate utf8_bin NOT NULL,
140
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
141
+		$table_name = 'esp_currency';
142
+		$sql = "CUR_code varchar(6) collate utf8_bin NOT NULL,
143 143
 				CUR_single varchar(45) collate utf8_bin DEFAULT 'dollar',
144 144
 				CUR_plural varchar(45) collate utf8_bin DEFAULT 'dollars',
145 145
 				CUR_sign varchar(45) collate utf8_bin DEFAULT '$',
146 146
 				CUR_dec_plc varchar(1) collate utf8_bin NOT NULL DEFAULT '2',
147 147
 				CUR_active tinyint(1) DEFAULT '0',
148 148
 				PRIMARY KEY  (CUR_code)";
149
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
150
-        $table_name = 'esp_currency_payment_method';
151
-        $sql = "CPM_ID int(11) NOT NULL AUTO_INCREMENT,
149
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
150
+		$table_name = 'esp_currency_payment_method';
151
+		$sql = "CPM_ID int(11) NOT NULL AUTO_INCREMENT,
152 152
 				CUR_code varchar(6) collate utf8_bin NOT NULL,
153 153
 				PMD_ID int(11) NOT NULL,
154 154
 				PRIMARY KEY  (CPM_ID),
155 155
 				KEY PMD_ID (PMD_ID)";
156
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
157
-        $table_name = 'esp_datetime';
158
-        $sql = "DTT_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
156
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
157
+		$table_name = 'esp_datetime';
158
+		$sql = "DTT_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
159 159
 				  EVT_ID bigint(20) unsigned NOT NULL,
160 160
 				  DTT_name varchar(255) NOT NULL DEFAULT '',
161 161
 				  DTT_description text NOT NULL,
@@ -171,9 +171,9 @@  discard block
 block discarded – undo
171 171
 						KEY DTT_EVT_start (DTT_EVT_start),
172 172
 						KEY EVT_ID (EVT_ID),
173 173
 						KEY DTT_is_primary (DTT_is_primary)";
174
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
175
-        $table_name = 'esp_event_meta';
176
-        $sql = "
174
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
175
+		$table_name = 'esp_event_meta';
176
+		$sql = "
177 177
 			EVTM_ID int(10) NOT NULL AUTO_INCREMENT,
178 178
 			EVT_ID bigint(20) unsigned NOT NULL,
179 179
 			EVT_display_desc tinyint(1) unsigned NOT NULL DEFAULT 1,
@@ -189,34 +189,34 @@  discard block
 block discarded – undo
189 189
 			EVT_donations tinyint(1) NULL,
190 190
 			PRIMARY KEY  (EVTM_ID),
191 191
 			KEY EVT_ID (EVT_ID)";
192
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
193
-        $table_name = 'esp_event_question_group';
194
-        $sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
192
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
193
+		$table_name = 'esp_event_question_group';
194
+		$sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
195 195
 					EVT_ID bigint(20) unsigned NOT NULL,
196 196
 					QSG_ID int(10) unsigned NOT NULL,
197 197
 					EQG_primary tinyint(1) unsigned NOT NULL DEFAULT 0,
198 198
 					PRIMARY KEY  (EQG_ID),
199 199
 					KEY EVT_ID (EVT_ID),
200 200
 					KEY QSG_ID (QSG_ID)";
201
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
202
-        $table_name = 'esp_event_venue';
203
-        $sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT,
201
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
202
+		$table_name = 'esp_event_venue';
203
+		$sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT,
204 204
 				EVT_ID bigint(20) unsigned NOT NULL,
205 205
 				VNU_ID bigint(20) unsigned NOT NULL,
206 206
 				EVV_primary tinyint(1) unsigned NOT NULL DEFAULT 0,
207 207
 				PRIMARY KEY  (EVV_ID)";
208
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
209
-        $table_name = 'esp_extra_meta';
210
-        $sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT,
208
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
209
+		$table_name = 'esp_extra_meta';
210
+		$sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT,
211 211
 				OBJ_ID int(11) DEFAULT NULL,
212 212
 				EXM_type varchar(45) DEFAULT NULL,
213 213
 				EXM_key varchar(45) DEFAULT NULL,
214 214
 				EXM_value text,
215 215
 				PRIMARY KEY  (EXM_ID),
216 216
 				KEY EXM_type (EXM_type,OBJ_ID,EXM_key)";
217
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
218
-        $table_name = 'esp_extra_join';
219
-        $sql = "EXJ_ID int(11) NOT NULL AUTO_INCREMENT,
217
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
218
+		$table_name = 'esp_extra_join';
219
+		$sql = "EXJ_ID int(11) NOT NULL AUTO_INCREMENT,
220 220
 				EXJ_first_model_id varchar(6) NOT NULL,
221 221
 				EXJ_first_model_name varchar(20) NOT NULL,
222 222
 				EXJ_second_model_id varchar(6) NOT NULL,
@@ -224,9 +224,9 @@  discard block
 block discarded – undo
224 224
 				PRIMARY KEY  (EXJ_ID),
225 225
 				KEY first_model (EXJ_first_model_name,EXJ_first_model_id),
226 226
 				KEY second_model (EXJ_second_model_name,EXJ_second_model_id)";
227
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
228
-        $table_name = 'esp_line_item';
229
-        $sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT,
227
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
228
+		$table_name = 'esp_line_item';
229
+		$sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT,
230 230
 				LIN_code varchar(245) NOT NULL DEFAULT '',
231 231
 				TXN_ID int(11) DEFAULT NULL,
232 232
 				LIN_name varchar(245) NOT NULL DEFAULT '',
@@ -245,9 +245,9 @@  discard block
 block discarded – undo
245 245
 				PRIMARY KEY  (LIN_ID),
246 246
 				KEY LIN_code (LIN_code(191)),
247 247
 				KEY TXN_ID (TXN_ID)";
248
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
249
-        $table_name = 'esp_log';
250
-        $sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT,
248
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
249
+		$table_name = 'esp_log';
250
+		$sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT,
251 251
 				LOG_time datetime DEFAULT NULL,
252 252
 				OBJ_ID varchar(45) DEFAULT NULL,
253 253
 				OBJ_type varchar(45) DEFAULT NULL,
@@ -258,18 +258,18 @@  discard block
 block discarded – undo
258 258
 				KEY LOG_time (LOG_time),
259 259
 				KEY OBJ (OBJ_type,OBJ_ID),
260 260
 				KEY LOG_type (LOG_type)";
261
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
262
-        $table_name = 'esp_message_template';
263
-        $sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
261
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
262
+		$table_name = 'esp_message_template';
263
+		$sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
264 264
 					GRP_ID int(10) unsigned NOT NULL,
265 265
 					MTP_context varchar(50) NOT NULL,
266 266
 					MTP_template_field varchar(30) NOT NULL,
267 267
 					MTP_content text NOT NULL,
268 268
 					PRIMARY KEY  (MTP_ID),
269 269
 					KEY GRP_ID (GRP_ID)";
270
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
271
-        $table_name = 'esp_message_template_group';
272
-        $sql = "GRP_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
270
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
271
+		$table_name = 'esp_message_template_group';
272
+		$sql = "GRP_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
273 273
 					MTP_user_id int(10) NOT NULL DEFAULT '1',
274 274
 					MTP_name varchar(245) NOT NULL DEFAULT '',
275 275
 					MTP_description varchar(245) NOT NULL DEFAULT '',
@@ -281,17 +281,17 @@  discard block
 block discarded – undo
281 281
 					MTP_is_active tinyint(1) NOT NULL DEFAULT '1',
282 282
 					PRIMARY KEY  (GRP_ID),
283 283
 					KEY MTP_user_id (MTP_user_id)";
284
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
285
-        $table_name = 'esp_event_message_template';
286
-        $sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT,
284
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
285
+		$table_name = 'esp_event_message_template';
286
+		$sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT,
287 287
 					EVT_ID bigint(20) unsigned NOT NULL DEFAULT 0,
288 288
 					GRP_ID int(10) unsigned NOT NULL DEFAULT 0,
289 289
 					PRIMARY KEY  (EMT_ID),
290 290
 					KEY EVT_ID (EVT_ID),
291 291
 					KEY GRP_ID (GRP_ID)";
292
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
293
-        $table_name = 'esp_payment';
294
-        $sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
292
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
293
+		$table_name = 'esp_payment';
294
+		$sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
295 295
 					TXN_ID int(10) unsigned DEFAULT NULL,
296 296
 					STS_ID varchar(3) collate utf8_bin DEFAULT NULL,
297 297
 					PAY_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
@@ -308,9 +308,9 @@  discard block
 block discarded – undo
308 308
 					PRIMARY KEY  (PAY_ID),
309 309
 					KEY PAY_timestamp (PAY_timestamp),
310 310
 					KEY TXN_ID (TXN_ID)";
311
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
312
-        $table_name = 'esp_payment_method';
313
-        $sql = "PMD_ID int(11) NOT NULL AUTO_INCREMENT,
311
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
312
+		$table_name = 'esp_payment_method';
313
+		$sql = "PMD_ID int(11) NOT NULL AUTO_INCREMENT,
314 314
 				PMD_type varchar(124) DEFAULT NULL,
315 315
 				PMD_name varchar(255) DEFAULT NULL,
316 316
 				PMD_desc text,
@@ -326,32 +326,32 @@  discard block
 block discarded – undo
326 326
 				PRIMARY KEY  (PMD_ID),
327 327
 				UNIQUE KEY PMD_slug_UNIQUE (PMD_slug),
328 328
 				KEY PMD_type (PMD_type)";
329
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
330
-        $table_name = "esp_ticket_price";
331
-        $sql = "TKP_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
329
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
330
+		$table_name = "esp_ticket_price";
331
+		$sql = "TKP_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
332 332
 					  TKT_ID int(10) unsigned NOT NULL,
333 333
 					  PRC_ID int(10) unsigned NOT NULL,
334 334
 					  PRIMARY KEY  (TKP_ID),
335 335
 					  KEY TKT_ID (TKT_ID),
336 336
 					  KEY PRC_ID (PRC_ID)";
337
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
338
-        $table_name = "esp_datetime_ticket";
339
-        $sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
337
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
338
+		$table_name = "esp_datetime_ticket";
339
+		$sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
340 340
 					  DTT_ID int(10) unsigned NOT NULL,
341 341
 					  TKT_ID int(10) unsigned NOT NULL,
342 342
 					  PRIMARY KEY  (DTK_ID),
343 343
 					  KEY DTT_ID (DTT_ID),
344 344
 					  KEY TKT_ID (TKT_ID)";
345
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
346
-        $table_name = "esp_ticket_template";
347
-        $sql = "TTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
345
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
346
+		$table_name = "esp_ticket_template";
347
+		$sql = "TTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
348 348
 					  TTM_name varchar(45) NOT NULL,
349 349
 					  TTM_description text,
350 350
 					  TTM_file varchar(45),
351 351
 					  PRIMARY KEY  (TTM_ID)";
352
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
353
-        $table_name = 'esp_question';
354
-        $sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
352
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
353
+		$table_name = 'esp_question';
354
+		$sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
355 355
 					QST_display_text text NOT NULL,
356 356
 					QST_admin_label varchar(255) NOT NULL,
357 357
 					QST_system varchar(25) NOT NULL DEFAULT "",
@@ -365,18 +365,18 @@  discard block
 block discarded – undo
365 365
 					QST_deleted tinyint(2) unsigned NOT NULL DEFAULT 0,
366 366
 					PRIMARY KEY  (QST_ID),
367 367
 					KEY QST_order (QST_order)';
368
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
369
-        $table_name = 'esp_question_group_question';
370
-        $sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
368
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
369
+		$table_name = 'esp_question_group_question';
370
+		$sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
371 371
 					QSG_ID int(10) unsigned NOT NULL,
372 372
 					QST_ID int(10) unsigned NOT NULL,
373 373
 					QGQ_order int(10) unsigned NOT NULL DEFAULT 0,
374 374
 					PRIMARY KEY  (QGQ_ID),
375 375
 					KEY QST_ID (QST_ID),
376 376
 					KEY QSG_ID_order (QSG_ID,QGQ_order)";
377
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
378
-        $table_name = 'esp_question_option';
379
-        $sql = "QSO_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_question_option';
379
+		$sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
380 380
 					QSO_value varchar(255) NOT NULL,
381 381
 					QSO_desc text NOT NULL,
382 382
 					QST_ID int(10) unsigned NOT NULL,
@@ -386,9 +386,9 @@  discard block
 block discarded – undo
386 386
 					PRIMARY KEY  (QSO_ID),
387 387
 					KEY QST_ID (QST_ID),
388 388
 					KEY QSO_order (QSO_order)";
389
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
390
-        $table_name = 'esp_registration';
391
-        $sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
389
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
390
+		$table_name = 'esp_registration';
391
+		$sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
392 392
 					  EVT_ID bigint(20) unsigned NOT NULL,
393 393
 					  ATT_ID bigint(20) unsigned NOT NULL,
394 394
 					  TXN_ID int(10) unsigned NOT NULL,
@@ -412,18 +412,18 @@  discard block
 block discarded – undo
412 412
 					  KEY TKT_ID (TKT_ID),
413 413
 					  KEY EVT_ID (EVT_ID),
414 414
 					  KEY STS_ID (STS_ID)";
415
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
416
-        $table_name = 'esp_registration_payment';
417
-        $sql = "RPY_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
415
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
416
+		$table_name = 'esp_registration_payment';
417
+		$sql = "RPY_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
418 418
 					  REG_ID int(10) unsigned NOT NULL,
419 419
 					  PAY_ID int(10) unsigned NULL,
420 420
 					  RPY_amount decimal(10,3) NOT NULL DEFAULT '0.00',
421 421
 					  PRIMARY KEY  (RPY_ID),
422 422
 					  KEY REG_ID (REG_ID),
423 423
 					  KEY PAY_ID (PAY_ID)";
424
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
425
-        $table_name = 'esp_checkin';
426
-        $sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
424
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
425
+		$table_name = 'esp_checkin';
426
+		$sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
427 427
 					REG_ID int(10) unsigned NOT NULL,
428 428
 					DTT_ID int(10) unsigned NOT NULL,
429 429
 					CHK_in tinyint(1) unsigned NOT NULL DEFAULT 1,
@@ -431,9 +431,9 @@  discard block
 block discarded – undo
431 431
 					PRIMARY KEY  (CHK_ID),
432 432
 					KEY REG_ID (REG_ID),
433 433
 					KEY DTT_ID (DTT_ID)";
434
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
435
-        $table_name = 'esp_state';
436
-        $sql = "STA_ID smallint(5) unsigned NOT NULL AUTO_INCREMENT,
434
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
435
+		$table_name = 'esp_state';
436
+		$sql = "STA_ID smallint(5) unsigned NOT NULL AUTO_INCREMENT,
437 437
 					  CNT_ISO varchar(2) collate utf8_bin NOT NULL,
438 438
 					  STA_abbrev varchar(24) collate utf8_bin NOT NULL,
439 439
 					  STA_name varchar(100) collate utf8_bin NOT NULL,
@@ -441,9 +441,9 @@  discard block
 block discarded – undo
441 441
 					  PRIMARY KEY  (STA_ID),
442 442
 					  KEY STA_abbrev (STA_abbrev),
443 443
 					  KEY CNT_ISO (CNT_ISO)";
444
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
445
-        $table_name = 'esp_status';
446
-        $sql = "STS_ID varchar(3) NOT NULL,
444
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
445
+		$table_name = 'esp_status';
446
+		$sql = "STS_ID varchar(3) NOT NULL,
447 447
 					  STS_code varchar(45) NOT NULL,
448 448
 					  STS_type varchar(45) NOT NULL,
449 449
 					  STS_can_edit tinyint(1) NOT NULL DEFAULT 0,
@@ -451,9 +451,9 @@  discard block
 block discarded – undo
451 451
 					  STS_open tinyint(1) NOT NULL DEFAULT 1,
452 452
 					  UNIQUE KEY STS_ID_UNIQUE (STS_ID),
453 453
 					  KEY STS_type (STS_type)";
454
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
455
-        $table_name = 'esp_transaction';
456
-        $sql = "TXN_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
454
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
455
+		$table_name = 'esp_transaction';
456
+		$sql = "TXN_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
457 457
 					  TXN_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
458 458
 					  TXN_total decimal(10,3) DEFAULT '0.00',
459 459
 					  TXN_paid decimal(10,3) NOT NULL DEFAULT '0.00',
@@ -465,9 +465,9 @@  discard block
 block discarded – undo
465 465
 					  PRIMARY KEY  (TXN_ID),
466 466
 					  KEY TXN_timestamp (TXN_timestamp),
467 467
 					  KEY STS_ID (STS_ID)";
468
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
469
-        $table_name = 'esp_venue_meta';
470
-        $sql = "VNUM_ID int(11) NOT NULL AUTO_INCREMENT,
468
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
469
+		$table_name = 'esp_venue_meta';
470
+		$sql = "VNUM_ID int(11) NOT NULL AUTO_INCREMENT,
471 471
 			VNU_ID bigint(20) unsigned NOT NULL DEFAULT 0,
472 472
 			VNU_address varchar(255) DEFAULT NULL,
473 473
 			VNU_address2 varchar(255) DEFAULT NULL,
@@ -486,10 +486,10 @@  discard block
 block discarded – undo
486 486
 			KEY VNU_ID (VNU_ID),
487 487
 			KEY STA_ID (STA_ID),
488 488
 			KEY CNT_ISO (CNT_ISO)";
489
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
490
-        // modified tables
491
-        $table_name = "esp_price";
492
-        $sql = "PRC_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
489
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
490
+		// modified tables
491
+		$table_name = "esp_price";
492
+		$sql = "PRC_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
493 493
 					  PRT_ID tinyint(3) unsigned NOT NULL,
494 494
 					  PRC_amount decimal(10,3) NOT NULL DEFAULT '0.00',
495 495
 					  PRC_name varchar(245) NOT NULL,
@@ -502,9 +502,9 @@  discard block
 block discarded – undo
502 502
 					  PRC_parent int(10) unsigned DEFAULT 0,
503 503
 					  PRIMARY KEY  (PRC_ID),
504 504
 					  KEY PRT_ID (PRT_ID)";
505
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
506
-        $table_name = "esp_price_type";
507
-        $sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
505
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
506
+		$table_name = "esp_price_type";
507
+		$sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
508 508
 				  PRT_name varchar(45) NOT NULL,
509 509
 				  PBT_ID tinyint(3) unsigned NOT NULL DEFAULT '1',
510 510
 				  PRT_is_percent tinyint(1) NOT NULL DEFAULT '0',
@@ -513,9 +513,9 @@  discard block
 block discarded – undo
513 513
 				  PRT_deleted tinyint(1) NOT NULL DEFAULT '0',
514 514
 				  UNIQUE KEY PRT_name_UNIQUE (PRT_name),
515 515
 				  PRIMARY KEY  (PRT_ID)";
516
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
517
-        $table_name = "esp_ticket";
518
-        $sql = "TKT_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
516
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
517
+		$table_name = "esp_ticket";
518
+		$sql = "TKT_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
519 519
 					  TTM_ID int(10) unsigned NOT NULL,
520 520
 					  TKT_name varchar(245) NOT NULL DEFAULT '',
521 521
 					  TKT_description text NOT NULL,
@@ -537,9 +537,9 @@  discard block
 block discarded – undo
537 537
 					  TKT_deleted tinyint(1) NOT NULL DEFAULT '0',
538 538
 					  PRIMARY KEY  (TKT_ID),
539 539
 					  KEY TKT_start_date (TKT_start_date)";
540
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
541
-        $table_name = 'esp_question_group';
542
-        $sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
540
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
541
+		$table_name = 'esp_question_group';
542
+		$sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
543 543
 					QSG_name varchar(255) NOT NULL,
544 544
 					QSG_identifier varchar(100) NOT NULL,
545 545
 					QSG_desc text NULL,
@@ -552,223 +552,223 @@  discard block
 block discarded – undo
552 552
 					PRIMARY KEY  (QSG_ID),
553 553
 					UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier),
554 554
 					KEY QSG_order (QSG_order)';
555
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
556
-        /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */
557
-        $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
558
-        // (because many need to convert old string states to foreign keys into the states table)
559
-        $script_4_1_defaults->insert_default_states();
560
-        $script_4_1_defaults->insert_default_countries();
561
-        /** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */
562
-        $script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0');
563
-        $script_4_5_defaults->insert_default_price_types();
564
-        $script_4_5_defaults->insert_default_prices();
565
-        $script_4_5_defaults->insert_default_tickets();
566
-        /** @var EE_DMS_Core_4_6_0 $script_4_6_defaults */
567
-        $script_4_6_defaults = EE_Registry::instance()->load_dms('Core_4_6_0');
568
-        $script_4_6_defaults->add_default_admin_only_payments();
569
-        $script_4_6_defaults->insert_default_currencies();
570
-        $this->verify_new_countries();
571
-        $this->verify_new_currencies();
572
-        return true;
573
-    }
555
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
556
+		/** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */
557
+		$script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
558
+		// (because many need to convert old string states to foreign keys into the states table)
559
+		$script_4_1_defaults->insert_default_states();
560
+		$script_4_1_defaults->insert_default_countries();
561
+		/** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */
562
+		$script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0');
563
+		$script_4_5_defaults->insert_default_price_types();
564
+		$script_4_5_defaults->insert_default_prices();
565
+		$script_4_5_defaults->insert_default_tickets();
566
+		/** @var EE_DMS_Core_4_6_0 $script_4_6_defaults */
567
+		$script_4_6_defaults = EE_Registry::instance()->load_dms('Core_4_6_0');
568
+		$script_4_6_defaults->add_default_admin_only_payments();
569
+		$script_4_6_defaults->insert_default_currencies();
570
+		$this->verify_new_countries();
571
+		$this->verify_new_currencies();
572
+		return true;
573
+	}
574 574
 
575 575
 
576 576
 
577
-    /**
578
-     * @return boolean
579
-     */
580
-    public function schema_changes_after_migration()
581
-    {
582
-        $this->fix_non_default_taxes();
583
-        // this is actually the same as the last DMS
584
-        /** @var EE_DMS_Core_4_7_0 $script_4_7_defaults */
585
-        $script_4_7_defaults = EE_Registry::instance()->load_dms('Core_4_7_0');
586
-        return $script_4_7_defaults->schema_changes_after_migration();
587
-    }
577
+	/**
578
+	 * @return boolean
579
+	 */
580
+	public function schema_changes_after_migration()
581
+	{
582
+		$this->fix_non_default_taxes();
583
+		// this is actually the same as the last DMS
584
+		/** @var EE_DMS_Core_4_7_0 $script_4_7_defaults */
585
+		$script_4_7_defaults = EE_Registry::instance()->load_dms('Core_4_7_0');
586
+		return $script_4_7_defaults->schema_changes_after_migration();
587
+	}
588 588
 
589 589
 
590 590
 
591
-    public function migration_page_hooks()
592
-    {
593
-    }
591
+	public function migration_page_hooks()
592
+	{
593
+	}
594 594
 
595 595
 
596 596
 
597
-    /**
598
-     * verifies each of the new countries exists that somehow we missed in 4.1
599
-     */
600
-    public function verify_new_countries()
601
-    {
602
-        // a list of countries (and specifically some which were missed in another list):https://gist.github.com/adhipg/1600028
603
-        // how many decimal places? https://en.wikipedia.org/wiki/ISO_4217
604
-        // currency symbols: http://www.xe.com/symbols.php
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
606
-        // ('AD', 'AND', 0, 'Andorra', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+376', 0, 0),
607
-        $newer_countries = array(
608
-            array('AX', 'ALA', 0, '&#197;land Islands', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+358', 1, 0),
609
-            array('BL', 'BLM', 0, 'Saint Barthelemy', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0),
610
-            array('CW', 'CUW', 0, 'Curacao', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+599', 1, 0),
611
-            array('GG', 'GGY', 0, 'Guernsey', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+44', 0, 0),
612
-            array('IM', 'IMN', 0, 'Isle of Man', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0),
613
-            array('JE', 'JEY', 0, 'Jersey', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0),
614
-            array('MF', 'MAF', 0, 'Saint Martin', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0),
615
-            array('ME', 'MNE', 0, 'Montenegro', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+382', 0, 0),
616
-            array('RS', 'SRB', 0, 'Serbia', 'RSD', 'Dinar', 'Dinars', '', 0, 2, '+381', 1, 0),
617
-            array('SS', 'SSD', 0, 'South Sudan', 'SSP', 'Pound', 'Pounds', '£', 1, 2, '+211', 0, 0),
618
-            array('SX', 'SXM', 0, 'Sint Maarten', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+1', 1, 0),
619
-            array('XK', 'XKX', 0, 'Kosovo', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+383', 0, 0),
620
-            array('YT', 'MYT', 0, 'Mayotte', 'EUR', 'Euro', 'Euros', '€', 0, 2, '+262', 1, 0),
621
-            array(
622
-                'BQ',
623
-                'BES',
624
-                0,
625
-                'Bonaire, Saint Eustatius and Saba',
626
-                'USD',
627
-                'Dollar',
628
-                'Dollars',
629
-                '$',
630
-                1,
631
-                2,
632
-                '+599',
633
-                0,
634
-                0,
635
-            ),
636
-            array('BV', 'BVT', 0, 'Bouvet Island', 'NOK', 'Krone', 'Krones', 'kr', 1, 2, '+47', 0, 0),
637
-            array('IO', 'IOT', 0, 'British Indian Ocean Territory', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+246', 0, 0),
638
-            array('CX', 'CXR', 0, 'Christmas Island', 'AUD', 'Dollar', 'Dollars', '$', 1, 2, '+61', 0, 0),
639
-            array('CC', 'CCK', 0, 'Cocos (Keeling) Islands', 'AUD', 'Dollar', 'Dollars', '$', 1, 2, '+891', 0, 0),
640
-            array(
641
-                'HM',
642
-                'HMD',
643
-                0,
644
-                'Heard Island and McDonald Islands',
645
-                'AUD',
646
-                'Dollar',
647
-                'Dollars',
648
-                '$',
649
-                1,
650
-                2,
651
-                '+891',
652
-                0,
653
-                0,
654
-            ),
655
-            array('PS', 'PSE', 0, 'Palestinian Territory', 'ILS', 'Shekel', 'Shekels', '₪', 1, 2, '+970', 0, 0),
656
-            array(
657
-                'GS',
658
-                'SGS',
659
-                0,
660
-                'South Georgia and the South Sandwich Islands',
661
-                'GBP',
662
-                'Pound',
663
-                'Pounds',
664
-                '£',
665
-                1,
666
-                2,
667
-                '+500',
668
-                0,
669
-                0,
670
-            ),
671
-            array('TL', 'TLS', 0, 'Timor-Leste', 'USD', 'Dollar', 'Dollars', '$', 1, 2, '+670', 0, 0),
672
-            array('TF', 'ATF', 0, 'French Southern Territories', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+262', 0, 0),
673
-            array(
674
-                'UM',
675
-                'UMI',
676
-                0,
677
-                'United States Minor Outlying Islands',
678
-                'USD',
679
-                'Dollar',
680
-                'Dollars',
681
-                '$',
682
-                1,
683
-                2,
684
-                '+1',
685
-                0,
686
-                0,
687
-            ),
688
-        );
689
-        global $wpdb;
690
-        $country_table = $wpdb->prefix . "esp_country";
691
-        $country_format = array(
692
-            "CNT_ISO"         => '%s',
693
-            "CNT_ISO3"        => '%s',
694
-            "RGN_ID"          => '%d',
695
-            "CNT_name"        => '%s',
696
-            "CNT_cur_code"    => '%s',
697
-            "CNT_cur_single"  => '%s',
698
-            "CNT_cur_plural"  => '%s',
699
-            "CNT_cur_sign"    => '%s',
700
-            "CNT_cur_sign_b4" => '%d',
701
-            "CNT_cur_dec_plc" => '%d',
702
-            "CNT_tel_code"    => '%s',
703
-            "CNT_is_EU"       => '%d',
704
-            "CNT_active"      => '%d',
705
-        );
706
-        if ($this->_get_table_analysis()->tableExists($country_table)) {
707
-            foreach ($newer_countries as $country) {
708
-                $SQL = "SELECT COUNT('CNT_ISO') FROM {$country_table} WHERE CNT_ISO='{$country[0]}' LIMIT 1";
709
-                $countries = $wpdb->get_var($SQL);
710
-                if (! $countries) {
711
-                    $wpdb->insert(
712
-                        $country_table,
713
-                        array_combine(array_keys($country_format), $country),
714
-                        $country_format
715
-                    );
716
-                }
717
-            }
718
-        }
719
-    }
597
+	/**
598
+	 * verifies each of the new countries exists that somehow we missed in 4.1
599
+	 */
600
+	public function verify_new_countries()
601
+	{
602
+		// a list of countries (and specifically some which were missed in another list):https://gist.github.com/adhipg/1600028
603
+		// how many decimal places? https://en.wikipedia.org/wiki/ISO_4217
604
+		// currency symbols: http://www.xe.com/symbols.php
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
606
+		// ('AD', 'AND', 0, 'Andorra', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+376', 0, 0),
607
+		$newer_countries = array(
608
+			array('AX', 'ALA', 0, '&#197;land Islands', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+358', 1, 0),
609
+			array('BL', 'BLM', 0, 'Saint Barthelemy', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0),
610
+			array('CW', 'CUW', 0, 'Curacao', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+599', 1, 0),
611
+			array('GG', 'GGY', 0, 'Guernsey', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+44', 0, 0),
612
+			array('IM', 'IMN', 0, 'Isle of Man', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0),
613
+			array('JE', 'JEY', 0, 'Jersey', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0),
614
+			array('MF', 'MAF', 0, 'Saint Martin', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0),
615
+			array('ME', 'MNE', 0, 'Montenegro', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+382', 0, 0),
616
+			array('RS', 'SRB', 0, 'Serbia', 'RSD', 'Dinar', 'Dinars', '', 0, 2, '+381', 1, 0),
617
+			array('SS', 'SSD', 0, 'South Sudan', 'SSP', 'Pound', 'Pounds', '£', 1, 2, '+211', 0, 0),
618
+			array('SX', 'SXM', 0, 'Sint Maarten', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+1', 1, 0),
619
+			array('XK', 'XKX', 0, 'Kosovo', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+383', 0, 0),
620
+			array('YT', 'MYT', 0, 'Mayotte', 'EUR', 'Euro', 'Euros', '€', 0, 2, '+262', 1, 0),
621
+			array(
622
+				'BQ',
623
+				'BES',
624
+				0,
625
+				'Bonaire, Saint Eustatius and Saba',
626
+				'USD',
627
+				'Dollar',
628
+				'Dollars',
629
+				'$',
630
+				1,
631
+				2,
632
+				'+599',
633
+				0,
634
+				0,
635
+			),
636
+			array('BV', 'BVT', 0, 'Bouvet Island', 'NOK', 'Krone', 'Krones', 'kr', 1, 2, '+47', 0, 0),
637
+			array('IO', 'IOT', 0, 'British Indian Ocean Territory', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+246', 0, 0),
638
+			array('CX', 'CXR', 0, 'Christmas Island', 'AUD', 'Dollar', 'Dollars', '$', 1, 2, '+61', 0, 0),
639
+			array('CC', 'CCK', 0, 'Cocos (Keeling) Islands', 'AUD', 'Dollar', 'Dollars', '$', 1, 2, '+891', 0, 0),
640
+			array(
641
+				'HM',
642
+				'HMD',
643
+				0,
644
+				'Heard Island and McDonald Islands',
645
+				'AUD',
646
+				'Dollar',
647
+				'Dollars',
648
+				'$',
649
+				1,
650
+				2,
651
+				'+891',
652
+				0,
653
+				0,
654
+			),
655
+			array('PS', 'PSE', 0, 'Palestinian Territory', 'ILS', 'Shekel', 'Shekels', '₪', 1, 2, '+970', 0, 0),
656
+			array(
657
+				'GS',
658
+				'SGS',
659
+				0,
660
+				'South Georgia and the South Sandwich Islands',
661
+				'GBP',
662
+				'Pound',
663
+				'Pounds',
664
+				'£',
665
+				1,
666
+				2,
667
+				'+500',
668
+				0,
669
+				0,
670
+			),
671
+			array('TL', 'TLS', 0, 'Timor-Leste', 'USD', 'Dollar', 'Dollars', '$', 1, 2, '+670', 0, 0),
672
+			array('TF', 'ATF', 0, 'French Southern Territories', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+262', 0, 0),
673
+			array(
674
+				'UM',
675
+				'UMI',
676
+				0,
677
+				'United States Minor Outlying Islands',
678
+				'USD',
679
+				'Dollar',
680
+				'Dollars',
681
+				'$',
682
+				1,
683
+				2,
684
+				'+1',
685
+				0,
686
+				0,
687
+			),
688
+		);
689
+		global $wpdb;
690
+		$country_table = $wpdb->prefix . "esp_country";
691
+		$country_format = array(
692
+			"CNT_ISO"         => '%s',
693
+			"CNT_ISO3"        => '%s',
694
+			"RGN_ID"          => '%d',
695
+			"CNT_name"        => '%s',
696
+			"CNT_cur_code"    => '%s',
697
+			"CNT_cur_single"  => '%s',
698
+			"CNT_cur_plural"  => '%s',
699
+			"CNT_cur_sign"    => '%s',
700
+			"CNT_cur_sign_b4" => '%d',
701
+			"CNT_cur_dec_plc" => '%d',
702
+			"CNT_tel_code"    => '%s',
703
+			"CNT_is_EU"       => '%d',
704
+			"CNT_active"      => '%d',
705
+		);
706
+		if ($this->_get_table_analysis()->tableExists($country_table)) {
707
+			foreach ($newer_countries as $country) {
708
+				$SQL = "SELECT COUNT('CNT_ISO') FROM {$country_table} WHERE CNT_ISO='{$country[0]}' LIMIT 1";
709
+				$countries = $wpdb->get_var($SQL);
710
+				if (! $countries) {
711
+					$wpdb->insert(
712
+						$country_table,
713
+						array_combine(array_keys($country_format), $country),
714
+						$country_format
715
+					);
716
+				}
717
+			}
718
+		}
719
+	}
720 720
 
721 721
 
722 722
 
723
-    /**
724
-     * verifies each of the new currencies exists that somehow we missed in 4.6
725
-     */
726
-    public function verify_new_currencies()
727
-    {
728
-        // a list of countries (and specifically some which were missed in another list):https://gist.github.com/adhipg/1600028
729
-        // how many decimal places? https://en.wikipedia.org/wiki/ISO_4217
730
-        // currency symbols: http://www.xe.com/symbols.php
731
-        // CUR_code, CUR_single, CUR_plural, CUR_sign, CUR_dec_plc, CUR_active
732
-        // ( 'EUR',  'Euro',  'Euros',  '€',  2,1),
733
-        $newer_currencies = array(
734
-            array('RSD', 'Dinar', 'Dinars', '', 3, 1),
735
-        );
736
-        global $wpdb;
737
-        $currency_table = $wpdb->prefix . "esp_currency";
738
-        $currency_format = array(
739
-            "CUR_code"    => '%s',
740
-            "CUR_single"  => '%s',
741
-            "CUR_plural"  => '%s',
742
-            "CUR_sign"    => '%s',
743
-            "CUR_dec_plc" => '%d',
744
-            "CUR_active"  => '%d',
745
-        );
746
-        if ($this->_get_table_analysis()->tableExists($currency_table)) {
747
-            foreach ($newer_currencies as $currency) {
748
-                $SQL = "SELECT COUNT('CUR_code') FROM {$currency_table} WHERE CUR_code='{$currency[0]}' LIMIT 1";
749
-                $countries = $wpdb->get_var($SQL);
750
-                if (! $countries) {
751
-                    $wpdb->insert(
752
-                        $currency_table,
753
-                        array_combine(array_keys($currency_format), $currency),
754
-                        $currency_format
755
-                    );
756
-                }
757
-            }
758
-        }
759
-    }
723
+	/**
724
+	 * verifies each of the new currencies exists that somehow we missed in 4.6
725
+	 */
726
+	public function verify_new_currencies()
727
+	{
728
+		// a list of countries (and specifically some which were missed in another list):https://gist.github.com/adhipg/1600028
729
+		// how many decimal places? https://en.wikipedia.org/wiki/ISO_4217
730
+		// currency symbols: http://www.xe.com/symbols.php
731
+		// CUR_code, CUR_single, CUR_plural, CUR_sign, CUR_dec_plc, CUR_active
732
+		// ( 'EUR',  'Euro',  'Euros',  '€',  2,1),
733
+		$newer_currencies = array(
734
+			array('RSD', 'Dinar', 'Dinars', '', 3, 1),
735
+		);
736
+		global $wpdb;
737
+		$currency_table = $wpdb->prefix . "esp_currency";
738
+		$currency_format = array(
739
+			"CUR_code"    => '%s',
740
+			"CUR_single"  => '%s',
741
+			"CUR_plural"  => '%s',
742
+			"CUR_sign"    => '%s',
743
+			"CUR_dec_plc" => '%d',
744
+			"CUR_active"  => '%d',
745
+		);
746
+		if ($this->_get_table_analysis()->tableExists($currency_table)) {
747
+			foreach ($newer_currencies as $currency) {
748
+				$SQL = "SELECT COUNT('CUR_code') FROM {$currency_table} WHERE CUR_code='{$currency[0]}' LIMIT 1";
749
+				$countries = $wpdb->get_var($SQL);
750
+				if (! $countries) {
751
+					$wpdb->insert(
752
+						$currency_table,
753
+						array_combine(array_keys($currency_format), $currency),
754
+						$currency_format
755
+					);
756
+				}
757
+			}
758
+		}
759
+	}
760 760
 
761 761
 
762 762
 
763
-    /**
764
-     * addresses https://events.codebasehq.com/projects/event-espresso/tickets/8731
765
-     * which should just be a temporary issue for folks who installed 4.8.0-4.8.5;
766
-     * we should be able to stop doing this in 4.9
767
-     */
768
-    public function fix_non_default_taxes()
769
-    {
770
-        global $wpdb;
771
-        $query = $wpdb->prepare("UPDATE
763
+	/**
764
+	 * addresses https://events.codebasehq.com/projects/event-espresso/tickets/8731
765
+	 * which should just be a temporary issue for folks who installed 4.8.0-4.8.5;
766
+	 * we should be able to stop doing this in 4.9
767
+	 */
768
+	public function fix_non_default_taxes()
769
+	{
770
+		global $wpdb;
771
+		$query = $wpdb->prepare("UPDATE
772 772
 				{$wpdb->prefix}esp_price p INNER JOIN
773 773
 				{$wpdb->prefix}esp_price_type pt ON p.PRT_ID = pt.PRT_ID
774 774
 			SET
@@ -777,6 +777,6 @@  discard block
 block discarded – undo
777 777
 				p.PRC_is_default = 0 AND
778 778
 				pt.PBT_ID = %d
779 779
 					", EEM_Price_Type::base_type_tax);
780
-        $wpdb->query($query);
781
-    }
780
+		$wpdb->query($query);
781
+	}
782 782
 }
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -14,12 +14,12 @@  discard block
 block discarded – undo
14 14
 // unfortunately, this needs to be done upon INCLUSION of this file,
15 15
 // instead of construction, because it only gets constructed on first page load
16 16
 // (all other times it gets resurrected from a wordpress option)
17
-$stages = glob(EE_CORE . 'data_migration_scripts/4_8_0_stages/*');
17
+$stages = glob(EE_CORE.'data_migration_scripts/4_8_0_stages/*');
18 18
 $class_to_filepath = array();
19 19
 foreach ($stages as $filepath) {
20 20
     $matches = array();
21 21
     preg_match('~4_8_0_stages/(.*).dmsstage.php~', $filepath, $matches);
22
-    $class_to_filepath[ $matches[1] ] = $filepath;
22
+    $class_to_filepath[$matches[1]] = $filepath;
23 23
 }
24 24
 // give addons a chance to autoload their stages too
25 25
 $class_to_filepath = apply_filters('FHEE__EE_DMS_4_8_0__autoloaded_stages', $class_to_filepath);
@@ -72,10 +72,10 @@  discard block
 block discarded – undo
72 72
         if (version_compare($version_string, '4.8.0', '<=') && version_compare($version_string, '4.7.0', '>=')) {
73 73
 //          echo "$version_string can be migrated from";
74 74
             return true;
75
-        } elseif (! $version_string) {
75
+        } elseif ( ! $version_string) {
76 76
 //          echo "no version string provided: $version_string";
77 77
             // no version string provided... this must be pre 4.3
78
-            return false;// changed mind. dont want people thinking they should migrate yet because they cant
78
+            return false; // changed mind. dont want people thinking they should migrate yet because they cant
79 79
         } else {
80 80
 //          echo "$version_string doesnt apply";
81 81
             return false;
@@ -89,9 +89,9 @@  discard block
 block discarded – undo
89 89
      */
90 90
     public function schema_changes_before_migration()
91 91
     {
92
-        require_once(EE_HELPERS . 'EEH_Activation.helper.php');
92
+        require_once(EE_HELPERS.'EEH_Activation.helper.php');
93 93
         $now_in_mysql = current_time('mysql', true);
94
-        require_once(EE_HELPERS . 'EEH_Activation.helper.php');
94
+        require_once(EE_HELPERS.'EEH_Activation.helper.php');
95 95
         $table_name = 'esp_answer';
96 96
         $sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
97 97
 					REG_ID int(10) unsigned NOT NULL,
@@ -687,7 +687,7 @@  discard block
 block discarded – undo
687 687
             ),
688 688
         );
689 689
         global $wpdb;
690
-        $country_table = $wpdb->prefix . "esp_country";
690
+        $country_table = $wpdb->prefix."esp_country";
691 691
         $country_format = array(
692 692
             "CNT_ISO"         => '%s',
693 693
             "CNT_ISO3"        => '%s',
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
             foreach ($newer_countries as $country) {
708 708
                 $SQL = "SELECT COUNT('CNT_ISO') FROM {$country_table} WHERE CNT_ISO='{$country[0]}' LIMIT 1";
709 709
                 $countries = $wpdb->get_var($SQL);
710
-                if (! $countries) {
710
+                if ( ! $countries) {
711 711
                     $wpdb->insert(
712 712
                         $country_table,
713 713
                         array_combine(array_keys($country_format), $country),
@@ -734,7 +734,7 @@  discard block
 block discarded – undo
734 734
             array('RSD', 'Dinar', 'Dinars', '', 3, 1),
735 735
         );
736 736
         global $wpdb;
737
-        $currency_table = $wpdb->prefix . "esp_currency";
737
+        $currency_table = $wpdb->prefix."esp_currency";
738 738
         $currency_format = array(
739 739
             "CUR_code"    => '%s',
740 740
             "CUR_single"  => '%s',
@@ -747,7 +747,7 @@  discard block
 block discarded – undo
747 747
             foreach ($newer_currencies as $currency) {
748 748
                 $SQL = "SELECT COUNT('CUR_code') FROM {$currency_table} WHERE CUR_code='{$currency[0]}' LIMIT 1";
749 749
                 $countries = $wpdb->get_var($SQL);
750
-                if (! $countries) {
750
+                if ( ! $countries) {
751 751
                     $wpdb->insert(
752 752
                         $currency_table,
753 753
                         array_combine(array_keys($currency_format), $currency),
Please login to merge, or discard this patch.