@@ -10,75 +10,75 @@ |
||
10 | 10 | class EE_DMS_4_6_0_billing_info extends EE_Data_Migration_Script_Stage_Table |
11 | 11 | { |
12 | 12 | |
13 | - public function __construct() |
|
14 | - { |
|
15 | - global $wpdb; |
|
16 | - $this->_old_table = $wpdb->postmeta; |
|
17 | - $this->_pretty_name = esc_html__('Billing Info', 'event_espresso'); |
|
18 | - $this->_extra_where_sql = "WHERE meta_key LIKE 'billing_info_%'"; |
|
19 | - parent::__construct(); |
|
20 | - } |
|
13 | + public function __construct() |
|
14 | + { |
|
15 | + global $wpdb; |
|
16 | + $this->_old_table = $wpdb->postmeta; |
|
17 | + $this->_pretty_name = esc_html__('Billing Info', 'event_espresso'); |
|
18 | + $this->_extra_where_sql = "WHERE meta_key LIKE 'billing_info_%'"; |
|
19 | + parent::__construct(); |
|
20 | + } |
|
21 | 21 | |
22 | 22 | |
23 | - protected function _migrate_old_row($old_row) |
|
24 | - { |
|
25 | - $new_billing_info = []; |
|
26 | - $old_billing_info = maybe_unserialize($old_row['meta_value']); |
|
27 | - $gateway_name = str_replace("billing_info_", '', $old_row['meta_key']); |
|
28 | - $repetitive_prefix = '_reg-page-billing-'; |
|
29 | - $repetitive_suffix = "-" . $gateway_name; |
|
30 | - foreach ($old_billing_info as $old_input_name => $input_value) { |
|
31 | - $old_input_name_important_part = |
|
32 | - str_replace([$repetitive_prefix, $repetitive_suffix], ['', ''], $old_input_name); |
|
23 | + protected function _migrate_old_row($old_row) |
|
24 | + { |
|
25 | + $new_billing_info = []; |
|
26 | + $old_billing_info = maybe_unserialize($old_row['meta_value']); |
|
27 | + $gateway_name = str_replace("billing_info_", '', $old_row['meta_key']); |
|
28 | + $repetitive_prefix = '_reg-page-billing-'; |
|
29 | + $repetitive_suffix = "-" . $gateway_name; |
|
30 | + foreach ($old_billing_info as $old_input_name => $input_value) { |
|
31 | + $old_input_name_important_part = |
|
32 | + str_replace([$repetitive_prefix, $repetitive_suffix], ['', ''], $old_input_name); |
|
33 | 33 | |
34 | - switch ($old_input_name_important_part) { |
|
35 | - case 'fname': |
|
36 | - $new_input_name = 'first_name'; |
|
37 | - break; |
|
38 | - case 'lname': |
|
39 | - $new_input_name = 'last_name'; |
|
40 | - break; |
|
41 | - case 'state': |
|
42 | - // we used to store the state's id ,but now we just store the name |
|
43 | - $new_input_name = $old_input_name_important_part; |
|
44 | - $input_value = $this->_get_state_name_by_ID($input_value); |
|
45 | - break; |
|
46 | - case 'card-nmbr': |
|
47 | - $new_input_name = 'credit_card'; |
|
48 | - break; |
|
49 | - case 'card-type':// paypal pro only |
|
50 | - $new_input_name = 'credit_card_type'; |
|
51 | - break; |
|
52 | - case 'card-exp-date-mnth': |
|
53 | - $new_input_name = 'exp_month'; |
|
54 | - $input_value = ''; |
|
55 | - break; |
|
56 | - case 'card-exp-date-year': |
|
57 | - $new_input_name = 'exp_year'; |
|
58 | - $input_value = 0; |
|
59 | - break; |
|
60 | - case 'ccv-code': |
|
61 | - $new_input_name = 'cvv'; |
|
62 | - break; |
|
63 | - default: |
|
64 | - $new_input_name = $old_input_name_important_part; |
|
65 | - } |
|
66 | - $new_billing_info[ $new_input_name ] = $input_value; |
|
67 | - } |
|
68 | - update_post_meta($old_row['post_id'], $old_row['meta_key'], $new_billing_info); |
|
69 | - } |
|
34 | + switch ($old_input_name_important_part) { |
|
35 | + case 'fname': |
|
36 | + $new_input_name = 'first_name'; |
|
37 | + break; |
|
38 | + case 'lname': |
|
39 | + $new_input_name = 'last_name'; |
|
40 | + break; |
|
41 | + case 'state': |
|
42 | + // we used to store the state's id ,but now we just store the name |
|
43 | + $new_input_name = $old_input_name_important_part; |
|
44 | + $input_value = $this->_get_state_name_by_ID($input_value); |
|
45 | + break; |
|
46 | + case 'card-nmbr': |
|
47 | + $new_input_name = 'credit_card'; |
|
48 | + break; |
|
49 | + case 'card-type':// paypal pro only |
|
50 | + $new_input_name = 'credit_card_type'; |
|
51 | + break; |
|
52 | + case 'card-exp-date-mnth': |
|
53 | + $new_input_name = 'exp_month'; |
|
54 | + $input_value = ''; |
|
55 | + break; |
|
56 | + case 'card-exp-date-year': |
|
57 | + $new_input_name = 'exp_year'; |
|
58 | + $input_value = 0; |
|
59 | + break; |
|
60 | + case 'ccv-code': |
|
61 | + $new_input_name = 'cvv'; |
|
62 | + break; |
|
63 | + default: |
|
64 | + $new_input_name = $old_input_name_important_part; |
|
65 | + } |
|
66 | + $new_billing_info[ $new_input_name ] = $input_value; |
|
67 | + } |
|
68 | + update_post_meta($old_row['post_id'], $old_row['meta_key'], $new_billing_info); |
|
69 | + } |
|
70 | 70 | |
71 | 71 | |
72 | - /** |
|
73 | - * @param int $id |
|
74 | - * @return string |
|
75 | - * @global wpdb $wpdb |
|
76 | - */ |
|
77 | - protected function _get_state_name_by_ID(int $id): string |
|
78 | - { |
|
79 | - global $wpdb; |
|
80 | - return $wpdb->get_var( |
|
81 | - $wpdb->prepare("SELECT STA_name FROM " . $wpdb->prefix . "esp_state WHERE STA_ID = %d", $id) |
|
82 | - ); |
|
83 | - } |
|
72 | + /** |
|
73 | + * @param int $id |
|
74 | + * @return string |
|
75 | + * @global wpdb $wpdb |
|
76 | + */ |
|
77 | + protected function _get_state_name_by_ID(int $id): string |
|
78 | + { |
|
79 | + global $wpdb; |
|
80 | + return $wpdb->get_var( |
|
81 | + $wpdb->prepare("SELECT STA_name FROM " . $wpdb->prefix . "esp_state WHERE STA_ID = %d", $id) |
|
82 | + ); |
|
83 | + } |
|
84 | 84 | } |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | $old_billing_info = maybe_unserialize($old_row['meta_value']); |
27 | 27 | $gateway_name = str_replace("billing_info_", '', $old_row['meta_key']); |
28 | 28 | $repetitive_prefix = '_reg-page-billing-'; |
29 | - $repetitive_suffix = "-" . $gateway_name; |
|
29 | + $repetitive_suffix = "-".$gateway_name; |
|
30 | 30 | foreach ($old_billing_info as $old_input_name => $input_value) { |
31 | 31 | $old_input_name_important_part = |
32 | 32 | str_replace([$repetitive_prefix, $repetitive_suffix], ['', ''], $old_input_name); |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | default: |
64 | 64 | $new_input_name = $old_input_name_important_part; |
65 | 65 | } |
66 | - $new_billing_info[ $new_input_name ] = $input_value; |
|
66 | + $new_billing_info[$new_input_name] = $input_value; |
|
67 | 67 | } |
68 | 68 | update_post_meta($old_row['post_id'], $old_row['meta_key'], $new_billing_info); |
69 | 69 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | { |
79 | 79 | global $wpdb; |
80 | 80 | return $wpdb->get_var( |
81 | - $wpdb->prepare("SELECT STA_name FROM " . $wpdb->prefix . "esp_state WHERE STA_ID = %d", $id) |
|
81 | + $wpdb->prepare("SELECT STA_name FROM ".$wpdb->prefix."esp_state WHERE STA_ID = %d", $id) |
|
82 | 82 | ); |
83 | 83 | } |
84 | 84 | } |
@@ -13,67 +13,67 @@ |
||
13 | 13 | class EE_DMS_4_6_0_invoice_settings extends EE_Data_Migration_Script_Stage |
14 | 14 | { |
15 | 15 | |
16 | - /** |
|
17 | - * Just initializes the status of the migration |
|
18 | - */ |
|
19 | - public function __construct() |
|
20 | - { |
|
21 | - $this->_pretty_name = esc_html__('Update Invoice Settings', 'event_espresso'); |
|
22 | - parent::__construct(); |
|
23 | - } |
|
16 | + /** |
|
17 | + * Just initializes the status of the migration |
|
18 | + */ |
|
19 | + public function __construct() |
|
20 | + { |
|
21 | + $this->_pretty_name = esc_html__('Update Invoice Settings', 'event_espresso'); |
|
22 | + parent::__construct(); |
|
23 | + } |
|
24 | 24 | |
25 | 25 | |
26 | - /** |
|
27 | - * _count_records_to_migrate |
|
28 | - * Counts the records to migrate; the public version may cache it |
|
29 | - * |
|
30 | - * @access protected |
|
31 | - * @return int |
|
32 | - */ |
|
33 | - protected function _count_records_to_migrate(): int |
|
34 | - { |
|
35 | - return 1; |
|
36 | - } |
|
26 | + /** |
|
27 | + * _count_records_to_migrate |
|
28 | + * Counts the records to migrate; the public version may cache it |
|
29 | + * |
|
30 | + * @access protected |
|
31 | + * @return int |
|
32 | + */ |
|
33 | + protected function _count_records_to_migrate(): int |
|
34 | + { |
|
35 | + return 1; |
|
36 | + } |
|
37 | 37 | |
38 | 38 | |
39 | - /** |
|
40 | - * _migration_step |
|
41 | - * |
|
42 | - * @access protected |
|
43 | - * @param int $num_items_to_migrate |
|
44 | - * @return int number of items ACTUALLY migrated |
|
45 | - * @throws InvalidDataTypeException |
|
46 | - */ |
|
47 | - protected function _migration_step($num_items_to_migrate = 1) |
|
48 | - { |
|
49 | - $templates_relative_path = 'modules/gateways/Invoice/lib/templates/'; |
|
50 | - $overridden_invoice_body = EEH_Template::locate_template( |
|
51 | - $templates_relative_path . 'invoice_body.template.php', |
|
52 | - null, |
|
53 | - false, |
|
54 | - false, |
|
55 | - true |
|
56 | - ); |
|
57 | - $overridden_receipt_body = EEH_Template::locate_template( |
|
58 | - $templates_relative_path . 'receipt_body.template.php', |
|
59 | - null, |
|
60 | - false, |
|
61 | - false, |
|
62 | - true |
|
63 | - ); |
|
64 | - if ($overridden_invoice_body || $overridden_receipt_body) { |
|
65 | - new PersistentAdminNotice( |
|
66 | - 'invoice_overriding_templates', |
|
67 | - esc_html__( |
|
68 | - 'Note: in this version of Event Espresso, PDF and HTML Invoices and Receipts are now Messages and can be changed just like any other messages; however we noticed you had previously overridden the old default Invoice/Receipt templates. Because of this, your old Invoice/Receipt templates will continue to be used INSTEAD of the new Invoice/Receipt message equivalents (but this will be removed in an upcoming version). We recommend deleting your old Invoice/Receipt templates and using the new messages system. Then modify the new Invoice and Receipt messages\'s content in Messages -> Invoice and Messages -> Receipt.', |
|
69 | - 'event_espresso' |
|
70 | - ), |
|
71 | - true |
|
72 | - ); |
|
73 | - } |
|
39 | + /** |
|
40 | + * _migration_step |
|
41 | + * |
|
42 | + * @access protected |
|
43 | + * @param int $num_items_to_migrate |
|
44 | + * @return int number of items ACTUALLY migrated |
|
45 | + * @throws InvalidDataTypeException |
|
46 | + */ |
|
47 | + protected function _migration_step($num_items_to_migrate = 1) |
|
48 | + { |
|
49 | + $templates_relative_path = 'modules/gateways/Invoice/lib/templates/'; |
|
50 | + $overridden_invoice_body = EEH_Template::locate_template( |
|
51 | + $templates_relative_path . 'invoice_body.template.php', |
|
52 | + null, |
|
53 | + false, |
|
54 | + false, |
|
55 | + true |
|
56 | + ); |
|
57 | + $overridden_receipt_body = EEH_Template::locate_template( |
|
58 | + $templates_relative_path . 'receipt_body.template.php', |
|
59 | + null, |
|
60 | + false, |
|
61 | + false, |
|
62 | + true |
|
63 | + ); |
|
64 | + if ($overridden_invoice_body || $overridden_receipt_body) { |
|
65 | + new PersistentAdminNotice( |
|
66 | + 'invoice_overriding_templates', |
|
67 | + esc_html__( |
|
68 | + 'Note: in this version of Event Espresso, PDF and HTML Invoices and Receipts are now Messages and can be changed just like any other messages; however we noticed you had previously overridden the old default Invoice/Receipt templates. Because of this, your old Invoice/Receipt templates will continue to be used INSTEAD of the new Invoice/Receipt message equivalents (but this will be removed in an upcoming version). We recommend deleting your old Invoice/Receipt templates and using the new messages system. Then modify the new Invoice and Receipt messages\'s content in Messages -> Invoice and Messages -> Receipt.', |
|
69 | + 'event_espresso' |
|
70 | + ), |
|
71 | + true |
|
72 | + ); |
|
73 | + } |
|
74 | 74 | |
75 | - // regardless of whether it worked or not, we ought to continue the migration |
|
76 | - $this->set_completed(); |
|
77 | - return 1; |
|
78 | - } |
|
75 | + // regardless of whether it worked or not, we ought to continue the migration |
|
76 | + $this->set_completed(); |
|
77 | + return 1; |
|
78 | + } |
|
79 | 79 | } |
@@ -48,14 +48,14 @@ |
||
48 | 48 | { |
49 | 49 | $templates_relative_path = 'modules/gateways/Invoice/lib/templates/'; |
50 | 50 | $overridden_invoice_body = EEH_Template::locate_template( |
51 | - $templates_relative_path . 'invoice_body.template.php', |
|
51 | + $templates_relative_path.'invoice_body.template.php', |
|
52 | 52 | null, |
53 | 53 | false, |
54 | 54 | false, |
55 | 55 | true |
56 | 56 | ); |
57 | 57 | $overridden_receipt_body = EEH_Template::locate_template( |
58 | - $templates_relative_path . 'receipt_body.template.php', |
|
58 | + $templates_relative_path.'receipt_body.template.php', |
|
59 | 59 | null, |
60 | 60 | false, |
61 | 61 | false, |
@@ -11,44 +11,44 @@ |
||
11 | 11 | class EE_DMS_4_9_0_Answers_With_No_Registration extends EE_Data_Migration_Script_Stage |
12 | 12 | { |
13 | 13 | |
14 | - public function __construct() |
|
15 | - { |
|
16 | - $this->_pretty_name = esc_html__('Answer Cleanup', 'event_espresso'); |
|
17 | - parent::__construct(); |
|
18 | - } |
|
14 | + public function __construct() |
|
15 | + { |
|
16 | + $this->_pretty_name = esc_html__('Answer Cleanup', 'event_espresso'); |
|
17 | + parent::__construct(); |
|
18 | + } |
|
19 | 19 | |
20 | 20 | |
21 | - /** |
|
22 | - * Counts the records to migrate; the public version may cache it |
|
23 | - * |
|
24 | - * @return int |
|
25 | - */ |
|
26 | - protected function _count_records_to_migrate(): int |
|
27 | - { |
|
28 | - return 1; |
|
29 | - } |
|
21 | + /** |
|
22 | + * Counts the records to migrate; the public version may cache it |
|
23 | + * |
|
24 | + * @return int |
|
25 | + */ |
|
26 | + protected function _count_records_to_migrate(): int |
|
27 | + { |
|
28 | + return 1; |
|
29 | + } |
|
30 | 30 | |
31 | 31 | |
32 | - /** |
|
33 | - * IMPORTANT: if an error is encountered, or everything is finished, this stage should update its status property |
|
34 | - * accordingly. Note: it should not alter the count of items migrated. That is done in the public function that |
|
35 | - * calls this. IMPORTANT: The count of items migrated should ONLY be less than $num_items_to_migrate when it's the |
|
36 | - * last migration step, otherwise it should always return $num_items_to_migrate. (Eg, if we're migrating attendees |
|
37 | - * rows from the database, and $num_items_to_migrate is set to 50, then we SHOULD actually migrate 50 rows,but at |
|
38 | - * very least we MUST report/return 50 items migrated) |
|
39 | - * |
|
40 | - * @param int $num_items_to_migrate |
|
41 | - * @return int number of items ACTUALLY migrated |
|
42 | - */ |
|
43 | - protected function _migration_step($num_items_to_migrate = 50) |
|
44 | - { |
|
45 | - global $wpdb; |
|
46 | - $wpdb->delete( |
|
47 | - $wpdb->prefix . 'esp_answer', |
|
48 | - ['REG_ID' => 0], |
|
49 | - ['%d'] |
|
50 | - ); |
|
51 | - $this->set_completed(); |
|
52 | - return 1; |
|
53 | - } |
|
32 | + /** |
|
33 | + * IMPORTANT: if an error is encountered, or everything is finished, this stage should update its status property |
|
34 | + * accordingly. Note: it should not alter the count of items migrated. That is done in the public function that |
|
35 | + * calls this. IMPORTANT: The count of items migrated should ONLY be less than $num_items_to_migrate when it's the |
|
36 | + * last migration step, otherwise it should always return $num_items_to_migrate. (Eg, if we're migrating attendees |
|
37 | + * rows from the database, and $num_items_to_migrate is set to 50, then we SHOULD actually migrate 50 rows,but at |
|
38 | + * very least we MUST report/return 50 items migrated) |
|
39 | + * |
|
40 | + * @param int $num_items_to_migrate |
|
41 | + * @return int number of items ACTUALLY migrated |
|
42 | + */ |
|
43 | + protected function _migration_step($num_items_to_migrate = 50) |
|
44 | + { |
|
45 | + global $wpdb; |
|
46 | + $wpdb->delete( |
|
47 | + $wpdb->prefix . 'esp_answer', |
|
48 | + ['REG_ID' => 0], |
|
49 | + ['%d'] |
|
50 | + ); |
|
51 | + $this->set_completed(); |
|
52 | + return 1; |
|
53 | + } |
|
54 | 54 | } |
@@ -44,7 +44,7 @@ |
||
44 | 44 | { |
45 | 45 | global $wpdb; |
46 | 46 | $wpdb->delete( |
47 | - $wpdb->prefix . 'esp_answer', |
|
47 | + $wpdb->prefix.'esp_answer', |
|
48 | 48 | ['REG_ID' => 0], |
49 | 49 | ['%d'] |
50 | 50 | ); |
@@ -9,46 +9,46 @@ |
||
9 | 9 | */ |
10 | 10 | class EE_DMS_4_9_0_Email_System_Question extends EE_Data_Migration_Script_Stage_Table |
11 | 11 | { |
12 | - public function __construct() |
|
13 | - { |
|
14 | - global $wpdb; |
|
15 | - $this->_pretty_name = esc_html__('Email - System Question', 'event_espresso'); |
|
16 | - $this->_old_table = $wpdb->prefix . 'esp_question'; |
|
17 | - $this->_extra_where_sql = "WHERE QST_system = 'email'"; |
|
18 | - parent::__construct(); |
|
19 | - } |
|
12 | + public function __construct() |
|
13 | + { |
|
14 | + global $wpdb; |
|
15 | + $this->_pretty_name = esc_html__('Email - System Question', 'event_espresso'); |
|
16 | + $this->_old_table = $wpdb->prefix . 'esp_question'; |
|
17 | + $this->_extra_where_sql = "WHERE QST_system = 'email'"; |
|
18 | + parent::__construct(); |
|
19 | + } |
|
20 | 20 | |
21 | 21 | |
22 | - /** |
|
23 | - * updates the question with the new question type |
|
24 | - * |
|
25 | - * @param array $old_row an associative array where keys are column names and values are their values. |
|
26 | - * @return void |
|
27 | - */ |
|
28 | - protected function _migrate_old_row($old_row) |
|
29 | - { |
|
30 | - if ($old_row['QST_ID'] && $old_row['QST_system'] == 'email') { |
|
31 | - global $wpdb; |
|
32 | - $success = $wpdb->update( |
|
33 | - $this->_old_table, |
|
34 | - ['QST_type' => 'EMAIL'], // data |
|
35 | - ['QST_ID' => $old_row['QST_ID']], // where |
|
36 | - ['%s'], // data format |
|
37 | - ['%d'] // where format |
|
38 | - ); |
|
39 | - if (! $success) { |
|
40 | - $this->add_error( |
|
41 | - sprintf( |
|
42 | - esc_html__( |
|
43 | - 'Could not update question system name "%1$s" for question ID=%2$d because "%3$s"', |
|
44 | - 'event_espresso' |
|
45 | - ), |
|
46 | - wp_json_encode($old_row['QST_system']), |
|
47 | - $old_row['QST_ID'], |
|
48 | - $wpdb->last_error |
|
49 | - ) |
|
50 | - ); |
|
51 | - } |
|
52 | - } |
|
53 | - } |
|
22 | + /** |
|
23 | + * updates the question with the new question type |
|
24 | + * |
|
25 | + * @param array $old_row an associative array where keys are column names and values are their values. |
|
26 | + * @return void |
|
27 | + */ |
|
28 | + protected function _migrate_old_row($old_row) |
|
29 | + { |
|
30 | + if ($old_row['QST_ID'] && $old_row['QST_system'] == 'email') { |
|
31 | + global $wpdb; |
|
32 | + $success = $wpdb->update( |
|
33 | + $this->_old_table, |
|
34 | + ['QST_type' => 'EMAIL'], // data |
|
35 | + ['QST_ID' => $old_row['QST_ID']], // where |
|
36 | + ['%s'], // data format |
|
37 | + ['%d'] // where format |
|
38 | + ); |
|
39 | + if (! $success) { |
|
40 | + $this->add_error( |
|
41 | + sprintf( |
|
42 | + esc_html__( |
|
43 | + 'Could not update question system name "%1$s" for question ID=%2$d because "%3$s"', |
|
44 | + 'event_espresso' |
|
45 | + ), |
|
46 | + wp_json_encode($old_row['QST_system']), |
|
47 | + $old_row['QST_ID'], |
|
48 | + $wpdb->last_error |
|
49 | + ) |
|
50 | + ); |
|
51 | + } |
|
52 | + } |
|
53 | + } |
|
54 | 54 | } |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | { |
14 | 14 | global $wpdb; |
15 | 15 | $this->_pretty_name = esc_html__('Email - System Question', 'event_espresso'); |
16 | - $this->_old_table = $wpdb->prefix . 'esp_question'; |
|
16 | + $this->_old_table = $wpdb->prefix.'esp_question'; |
|
17 | 17 | $this->_extra_where_sql = "WHERE QST_system = 'email'"; |
18 | 18 | parent::__construct(); |
19 | 19 | } |
@@ -31,12 +31,12 @@ discard block |
||
31 | 31 | global $wpdb; |
32 | 32 | $success = $wpdb->update( |
33 | 33 | $this->_old_table, |
34 | - ['QST_type' => 'EMAIL'], // data |
|
35 | - ['QST_ID' => $old_row['QST_ID']], // where |
|
36 | - ['%s'], // data format |
|
34 | + ['QST_type' => 'EMAIL'], // data |
|
35 | + ['QST_ID' => $old_row['QST_ID']], // where |
|
36 | + ['%s'], // data format |
|
37 | 37 | ['%d'] // where format |
38 | 38 | ); |
39 | - if (! $success) { |
|
39 | + if ( ! $success) { |
|
40 | 40 | $this->add_error( |
41 | 41 | sprintf( |
42 | 42 | esc_html__( |
@@ -17,404 +17,404 @@ |
||
17 | 17 | */ |
18 | 18 | abstract class EE_Data_Migration_Class_Base |
19 | 19 | { |
20 | - /** |
|
21 | - * count of all that need to be migrated |
|
22 | - */ |
|
23 | - protected ?int $_records_to_migrate = null; |
|
24 | - |
|
25 | - protected int $_records_migrated = 0; |
|
26 | - |
|
27 | - protected $_new_table = ''; |
|
28 | - |
|
29 | - protected $_old_table = ''; |
|
30 | - |
|
31 | - /** |
|
32 | - * Whether this migration script is done or not. This COULD be deduced by |
|
33 | - * _records_to_migrate and _records_migrated, but that might nto be accurate |
|
34 | - * |
|
35 | - * @var string|null one of EE_Data_migration_Manager::status_* constants |
|
36 | - */ |
|
37 | - protected ?string $_status = null; |
|
38 | - |
|
39 | - /** |
|
40 | - * internationalized name of this class. Convention is to NOT restate that |
|
41 | - * this class if a migration script or a migration script stage |
|
42 | - * |
|
43 | - * @var string|null |
|
44 | - */ |
|
45 | - protected ?string $_pretty_name = null; |
|
46 | - |
|
47 | - /** |
|
48 | - * @var array |
|
49 | - */ |
|
50 | - protected array $_errors = array(); |
|
51 | - |
|
52 | - protected ?TableManager $_table_manager = null; |
|
53 | - |
|
54 | - protected ?TableAnalysis $_table_analysis = null; |
|
55 | - |
|
56 | - |
|
57 | - /** |
|
58 | - * Just initializes the status of the migration |
|
59 | - * |
|
60 | - * @param TableManager|null $table_manager |
|
61 | - * @param TableAnalysis|null $table_analysis |
|
62 | - */ |
|
63 | - public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) |
|
64 | - { |
|
65 | - $this->_table_manager = $table_manager ?? LoaderFactory::getShared(TableManager::class); |
|
66 | - $this->_table_analysis = $table_analysis ?? LoaderFactory::getShared(TableAnalysis::class); |
|
67 | - $this->set_status(EE_Data_Migration_Manager::status_continue); |
|
68 | - } |
|
69 | - |
|
70 | - |
|
71 | - /** |
|
72 | - * Just gets the pretty name for this migration script or stage |
|
73 | - * |
|
74 | - * @throws EE_Error |
|
75 | - * @return string |
|
76 | - */ |
|
77 | - public function pretty_name() |
|
78 | - { |
|
79 | - if (! $this->_pretty_name) { |
|
80 | - throw new EE_Error( |
|
81 | - sprintf( |
|
82 | - esc_html__( |
|
83 | - "Please give a pretty name to the migration script stage %s by assigning the property _pretty_name in the constructor", |
|
84 | - "event_espresso" |
|
85 | - ), |
|
86 | - get_class($this) |
|
87 | - ) |
|
88 | - ); |
|
89 | - } |
|
90 | - return $this->_pretty_name; |
|
91 | - } |
|
92 | - |
|
93 | - /** |
|
94 | - * |
|
95 | - * @return int |
|
96 | - */ |
|
97 | - public function count_records_to_migrate() |
|
98 | - { |
|
99 | - if ($this->_records_to_migrate == null) { |
|
100 | - $this->_records_to_migrate = $this->_count_records_to_migrate(); |
|
101 | - } |
|
102 | - return $this->_records_to_migrate; |
|
103 | - } |
|
104 | - |
|
105 | - /** |
|
106 | - * Counts records already migrated. This should only be implemented by EE_Data_Migration_Script_base and |
|
107 | - * EE_Data_migration_Script_Stage |
|
108 | - * |
|
109 | - * @return int |
|
110 | - */ |
|
111 | - abstract public function count_records_migrated(); |
|
112 | - |
|
113 | - /** |
|
114 | - * Counts the records to migrate; the public version may cache it |
|
115 | - * |
|
116 | - * @return int |
|
117 | - */ |
|
118 | - abstract protected function _count_records_to_migrate(); |
|
119 | - |
|
120 | - /** |
|
121 | - * Returns a string indicating the migration script's status. |
|
122 | - * |
|
123 | - * @return string one of EE_Data_Migration_Manager::status_* constants |
|
124 | - * @throws EE_Error |
|
125 | - */ |
|
126 | - public function get_status() |
|
127 | - { |
|
128 | - if ($this->_status === null) { |
|
129 | - throw new EE_Error( |
|
130 | - sprintf( |
|
131 | - esc_html__( |
|
132 | - "Trying to get status of Migration class %s, but it has not been initialized yet. It should be set in the constructor.", |
|
133 | - "event_espresso" |
|
134 | - ), |
|
135 | - get_class($this) |
|
136 | - ) |
|
137 | - ); |
|
138 | - } |
|
139 | - return $this->_status; |
|
140 | - } |
|
141 | - |
|
142 | - /** |
|
143 | - * |
|
144 | - * @param string $status |
|
145 | - * @return void |
|
146 | - */ |
|
147 | - protected function set_status($status) |
|
148 | - { |
|
149 | - $this->_status = $status; |
|
150 | - } |
|
151 | - |
|
152 | - /** |
|
153 | - * @return array of strings |
|
154 | - */ |
|
155 | - abstract public function get_errors(); |
|
156 | - |
|
157 | - /** |
|
158 | - * Returns the last error that occurred. If none occurred, returns null |
|
159 | - * |
|
160 | - * @return string |
|
161 | - */ |
|
162 | - public function get_last_error() |
|
163 | - { |
|
164 | - $errors = $this->get_errors(); |
|
165 | - if ($errors) { |
|
166 | - return end($errors); |
|
167 | - } else { |
|
168 | - return null; |
|
169 | - } |
|
170 | - } |
|
171 | - |
|
172 | - /** |
|
173 | - * Adds an error to the array of errors on this class. |
|
174 | - * |
|
175 | - * @param string $error a string describing the error that will be useful for debugging. Consider including all |
|
176 | - * the data that led to the error, and a stack trace etc. |
|
177 | - * @param boolean $force force the error to be added (because otherwise we have a limit). If forcing and errors are |
|
178 | - * already at their limit, we will purposefully forget the first half |
|
179 | - */ |
|
180 | - public function add_error($error, $force = false) |
|
181 | - { |
|
182 | - if (! defined('EE_DMS_ERROR_LIMIT')) { |
|
183 | - $limit = 50; |
|
184 | - } else { |
|
185 | - $limit = EE_DMS_ERROR_LIMIT; |
|
186 | - } |
|
187 | - // make sure errors is an array, see ticket #8261 |
|
188 | - if (is_string($this->_errors)) { |
|
189 | - $this->_errors = array($this->_errors); |
|
190 | - } |
|
191 | - if (count($this->_errors) >= $limit) { |
|
192 | - if ($force) { |
|
193 | - // get rid of the first half of the errors and any above the limit |
|
194 | - $this->_errors = array_slice($this->_errors, $limit / 2, $limit / 2); |
|
195 | - $this->_errors[] = "Limit reached; removed first half of errors to save space"; |
|
196 | - $this->_errors[] = $error; |
|
197 | - } else { |
|
198 | - $this->_errors[ $limit ] = 'More, but limit reached...'; |
|
199 | - } |
|
200 | - } else { |
|
201 | - $this->_errors[] = $error; |
|
202 | - } |
|
203 | - } |
|
204 | - |
|
205 | - /** |
|
206 | - * Indicates there was a fatal error and the migration cannot possibly continue |
|
207 | - * |
|
208 | - * @return boolean |
|
209 | - */ |
|
210 | - public function is_broken() |
|
211 | - { |
|
212 | - return $this->get_status() == EE_Data_Migration_Manager::status_fatal_error; |
|
213 | - } |
|
214 | - |
|
215 | - /** |
|
216 | - * @deprecated since 4.6.12 |
|
217 | - */ |
|
218 | - public function is_borked() |
|
219 | - { |
|
220 | - EE_Error::doing_it_wrong( |
|
221 | - 'is_borked', |
|
222 | - esc_html__( |
|
223 | - 'The cheeky "is_borked" method had been replaced with the more proper "is_broken"', |
|
224 | - 'event_espresso' |
|
225 | - ), |
|
226 | - '4.6.12' |
|
227 | - ); |
|
228 | - return $this->is_broken(); |
|
229 | - } |
|
230 | - |
|
231 | - /** |
|
232 | - * Sets the status to as having a fatal error |
|
233 | - */ |
|
234 | - public function set_broken() |
|
235 | - { |
|
236 | - $this->_status = EE_Data_Migration_Manager::status_fatal_error; |
|
237 | - } |
|
238 | - |
|
239 | - /** |
|
240 | - * |
|
241 | - * @deprecated since 4.6.12 |
|
242 | - */ |
|
243 | - public function set_borked() |
|
244 | - { |
|
245 | - EE_Error::doing_it_wrong( |
|
246 | - 'is_borked', |
|
247 | - esc_html__( |
|
248 | - 'The cheeky "is_borked" method had been replaced with the more proper "is_broken"', |
|
249 | - 'event_espresso' |
|
250 | - ), |
|
251 | - '4.6.12' |
|
252 | - ); |
|
253 | - $this->set_broken(); |
|
254 | - } |
|
255 | - |
|
256 | - /** |
|
257 | - * Checks if this thing believes it is completed |
|
258 | - * |
|
259 | - * @return boolean |
|
260 | - */ |
|
261 | - public function is_completed() |
|
262 | - { |
|
263 | - return $this->get_status() == EE_Data_Migration_Manager::status_completed; |
|
264 | - } |
|
265 | - |
|
266 | - |
|
267 | - /** |
|
268 | - * Checks if the current script has more to do or not (ie, if it's status is CONTINUE) |
|
269 | - * |
|
270 | - * @return boolean |
|
271 | - * @throws EE_Error |
|
272 | - */ |
|
273 | - public function has_more_to_do() |
|
274 | - { |
|
275 | - return $this->get_status() == EE_Data_Migration_Manager::status_continue; |
|
276 | - } |
|
277 | - |
|
278 | - /** |
|
279 | - * Marks that we believe this migration thing is completed |
|
280 | - */ |
|
281 | - public function set_completed() |
|
282 | - { |
|
283 | - $this->_status = EE_Data_Migration_Manager::status_completed; |
|
284 | - } |
|
285 | - |
|
286 | - /** |
|
287 | - * Marks that we think this migration class can continue to migrate |
|
288 | - */ |
|
289 | - public function reattempt() |
|
290 | - { |
|
291 | - $this->_status = EE_Data_Migration_Manager::status_continue; |
|
292 | - $this->add_error(esc_html__('Reattempt migration', 'event_espresso'), true); |
|
293 | - } |
|
294 | - |
|
295 | - /** |
|
296 | - * A lot like "__sleep()" magic method in purpose, this is meant for persisting this class' |
|
297 | - * properties to the DB. However, we don't want to use __sleep() because it's quite |
|
298 | - * possible that this class is defined when it goes to sleep, but NOT available when it |
|
299 | - * awakes (eg, this class is part of an addon that is deactivated at some point). |
|
300 | - */ |
|
301 | - public function properties_as_array() |
|
302 | - { |
|
303 | - $properties = get_object_vars($this); |
|
304 | - $properties['class'] = get_class($this); |
|
305 | - unset($properties['_migration_script']); |
|
306 | - unset($properties['_table_manager']); |
|
307 | - unset($properties['_table_analysis']); |
|
308 | - return $properties; |
|
309 | - } |
|
310 | - |
|
311 | - /** |
|
312 | - * Sets all the properties of this script stage to match what's in the array, which is assumed |
|
313 | - * to have been made from the properties_as_array() function. |
|
314 | - * |
|
315 | - * @param array $array_of_properties like what's produced from properties_as_array() method |
|
316 | - */ |
|
317 | - abstract public function instantiate_from_array_of_properties($array_of_properties); |
|
318 | - |
|
319 | - /** |
|
320 | - * Convenience method for showing a database insertion error |
|
321 | - * |
|
322 | - * @param string $old_table |
|
323 | - * @param array $old_row_as_array |
|
324 | - * @param string $new_table |
|
325 | - * @param array $new_row_as_array columns=>values like used in wpdb->insert |
|
326 | - * @param array $data_types numerically indexed |
|
327 | - * @return string |
|
328 | - */ |
|
329 | - protected function _create_error_message_for_db_insertion( |
|
330 | - $old_table, |
|
331 | - $old_row_as_array, |
|
332 | - $new_table, |
|
333 | - $new_row_as_array, |
|
334 | - $data_types |
|
335 | - ) { |
|
336 | - global $wpdb; |
|
337 | - $old_columns_and_values_for_string = array(); |
|
338 | - foreach ($old_row_as_array as $column => $value) { |
|
339 | - $old_columns_and_values_for_string[] = "$column => $value"; |
|
340 | - } |
|
341 | - $new_columns_and_values_for_string = array(); |
|
342 | - $count = 0; |
|
343 | - foreach ($new_row_as_array as $column => $value) { |
|
344 | - $new_columns_and_values_for_string[] = " $column => $value (" . $data_types[ $count++ ] . ")"; |
|
345 | - } |
|
346 | - return sprintf( |
|
347 | - esc_html__( |
|
348 | - 'Received error "%6$s" inserting row %5$s %1$s %5$s into table %2$s.%5$s Data used was %5$s %3$s %5$s from table %4$s.', |
|
349 | - 'event_espresso' |
|
350 | - ), |
|
351 | - implode(", ", $new_columns_and_values_for_string), |
|
352 | - $new_table, |
|
353 | - implode(", ", $old_columns_and_values_for_string), |
|
354 | - $old_table, |
|
355 | - '<br/>', |
|
356 | - $wpdb->last_error |
|
357 | - ); |
|
358 | - } |
|
359 | - |
|
360 | - |
|
361 | - /** |
|
362 | - * Same as json_encode, just avoids putting |
|
363 | - * serialized arrays into the http build query, as that would |
|
364 | - * |
|
365 | - * @param array $array_of_data |
|
366 | - * @return string |
|
367 | - */ |
|
368 | - protected function _json_encode($array_of_data) |
|
369 | - { |
|
370 | - // we'd rather NOT serialize the transaction details |
|
371 | - $fields_to_include = array(); |
|
372 | - foreach ($array_of_data as $name => $value) { |
|
373 | - $unserialized_data = @unserialize($value); |
|
374 | - if ($unserialized_data === false) { |
|
375 | - $fields_to_include[ $name ] = $value; |
|
376 | - } |
|
377 | - } |
|
378 | - return wp_json_encode($fields_to_include); |
|
379 | - } |
|
380 | - |
|
381 | - /** |
|
382 | - * Gets the table manager (or throws an exception if it cannot be retrieved) |
|
383 | - * |
|
384 | - * @return TableManager |
|
385 | - * @throws EE_Error |
|
386 | - */ |
|
387 | - protected function _get_table_manager() |
|
388 | - { |
|
389 | - if ($this->_table_manager instanceof TableManager) { |
|
390 | - return $this->_table_manager; |
|
391 | - } else { |
|
392 | - throw new EE_Error( |
|
393 | - sprintf( |
|
394 | - esc_html__('Table manager on migration class %1$s is not set properly.', 'event_espresso'), |
|
395 | - get_class($this) |
|
396 | - ) |
|
397 | - ); |
|
398 | - } |
|
399 | - } |
|
400 | - |
|
401 | - /** |
|
402 | - * Gets the injected table analyzer, or throws an exception |
|
403 | - * |
|
404 | - * @return TableAnalysis |
|
405 | - * @throws EE_Error |
|
406 | - */ |
|
407 | - protected function _get_table_analysis() |
|
408 | - { |
|
409 | - if ($this->_table_analysis instanceof TableAnalysis) { |
|
410 | - return $this->_table_analysis; |
|
411 | - } else { |
|
412 | - throw new EE_Error( |
|
413 | - sprintf( |
|
414 | - esc_html__('Table analysis class on migration class %1$s is not set properly.', 'event_espresso'), |
|
415 | - get_class($this) |
|
416 | - ) |
|
417 | - ); |
|
418 | - } |
|
419 | - } |
|
20 | + /** |
|
21 | + * count of all that need to be migrated |
|
22 | + */ |
|
23 | + protected ?int $_records_to_migrate = null; |
|
24 | + |
|
25 | + protected int $_records_migrated = 0; |
|
26 | + |
|
27 | + protected $_new_table = ''; |
|
28 | + |
|
29 | + protected $_old_table = ''; |
|
30 | + |
|
31 | + /** |
|
32 | + * Whether this migration script is done or not. This COULD be deduced by |
|
33 | + * _records_to_migrate and _records_migrated, but that might nto be accurate |
|
34 | + * |
|
35 | + * @var string|null one of EE_Data_migration_Manager::status_* constants |
|
36 | + */ |
|
37 | + protected ?string $_status = null; |
|
38 | + |
|
39 | + /** |
|
40 | + * internationalized name of this class. Convention is to NOT restate that |
|
41 | + * this class if a migration script or a migration script stage |
|
42 | + * |
|
43 | + * @var string|null |
|
44 | + */ |
|
45 | + protected ?string $_pretty_name = null; |
|
46 | + |
|
47 | + /** |
|
48 | + * @var array |
|
49 | + */ |
|
50 | + protected array $_errors = array(); |
|
51 | + |
|
52 | + protected ?TableManager $_table_manager = null; |
|
53 | + |
|
54 | + protected ?TableAnalysis $_table_analysis = null; |
|
55 | + |
|
56 | + |
|
57 | + /** |
|
58 | + * Just initializes the status of the migration |
|
59 | + * |
|
60 | + * @param TableManager|null $table_manager |
|
61 | + * @param TableAnalysis|null $table_analysis |
|
62 | + */ |
|
63 | + public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) |
|
64 | + { |
|
65 | + $this->_table_manager = $table_manager ?? LoaderFactory::getShared(TableManager::class); |
|
66 | + $this->_table_analysis = $table_analysis ?? LoaderFactory::getShared(TableAnalysis::class); |
|
67 | + $this->set_status(EE_Data_Migration_Manager::status_continue); |
|
68 | + } |
|
69 | + |
|
70 | + |
|
71 | + /** |
|
72 | + * Just gets the pretty name for this migration script or stage |
|
73 | + * |
|
74 | + * @throws EE_Error |
|
75 | + * @return string |
|
76 | + */ |
|
77 | + public function pretty_name() |
|
78 | + { |
|
79 | + if (! $this->_pretty_name) { |
|
80 | + throw new EE_Error( |
|
81 | + sprintf( |
|
82 | + esc_html__( |
|
83 | + "Please give a pretty name to the migration script stage %s by assigning the property _pretty_name in the constructor", |
|
84 | + "event_espresso" |
|
85 | + ), |
|
86 | + get_class($this) |
|
87 | + ) |
|
88 | + ); |
|
89 | + } |
|
90 | + return $this->_pretty_name; |
|
91 | + } |
|
92 | + |
|
93 | + /** |
|
94 | + * |
|
95 | + * @return int |
|
96 | + */ |
|
97 | + public function count_records_to_migrate() |
|
98 | + { |
|
99 | + if ($this->_records_to_migrate == null) { |
|
100 | + $this->_records_to_migrate = $this->_count_records_to_migrate(); |
|
101 | + } |
|
102 | + return $this->_records_to_migrate; |
|
103 | + } |
|
104 | + |
|
105 | + /** |
|
106 | + * Counts records already migrated. This should only be implemented by EE_Data_Migration_Script_base and |
|
107 | + * EE_Data_migration_Script_Stage |
|
108 | + * |
|
109 | + * @return int |
|
110 | + */ |
|
111 | + abstract public function count_records_migrated(); |
|
112 | + |
|
113 | + /** |
|
114 | + * Counts the records to migrate; the public version may cache it |
|
115 | + * |
|
116 | + * @return int |
|
117 | + */ |
|
118 | + abstract protected function _count_records_to_migrate(); |
|
119 | + |
|
120 | + /** |
|
121 | + * Returns a string indicating the migration script's status. |
|
122 | + * |
|
123 | + * @return string one of EE_Data_Migration_Manager::status_* constants |
|
124 | + * @throws EE_Error |
|
125 | + */ |
|
126 | + public function get_status() |
|
127 | + { |
|
128 | + if ($this->_status === null) { |
|
129 | + throw new EE_Error( |
|
130 | + sprintf( |
|
131 | + esc_html__( |
|
132 | + "Trying to get status of Migration class %s, but it has not been initialized yet. It should be set in the constructor.", |
|
133 | + "event_espresso" |
|
134 | + ), |
|
135 | + get_class($this) |
|
136 | + ) |
|
137 | + ); |
|
138 | + } |
|
139 | + return $this->_status; |
|
140 | + } |
|
141 | + |
|
142 | + /** |
|
143 | + * |
|
144 | + * @param string $status |
|
145 | + * @return void |
|
146 | + */ |
|
147 | + protected function set_status($status) |
|
148 | + { |
|
149 | + $this->_status = $status; |
|
150 | + } |
|
151 | + |
|
152 | + /** |
|
153 | + * @return array of strings |
|
154 | + */ |
|
155 | + abstract public function get_errors(); |
|
156 | + |
|
157 | + /** |
|
158 | + * Returns the last error that occurred. If none occurred, returns null |
|
159 | + * |
|
160 | + * @return string |
|
161 | + */ |
|
162 | + public function get_last_error() |
|
163 | + { |
|
164 | + $errors = $this->get_errors(); |
|
165 | + if ($errors) { |
|
166 | + return end($errors); |
|
167 | + } else { |
|
168 | + return null; |
|
169 | + } |
|
170 | + } |
|
171 | + |
|
172 | + /** |
|
173 | + * Adds an error to the array of errors on this class. |
|
174 | + * |
|
175 | + * @param string $error a string describing the error that will be useful for debugging. Consider including all |
|
176 | + * the data that led to the error, and a stack trace etc. |
|
177 | + * @param boolean $force force the error to be added (because otherwise we have a limit). If forcing and errors are |
|
178 | + * already at their limit, we will purposefully forget the first half |
|
179 | + */ |
|
180 | + public function add_error($error, $force = false) |
|
181 | + { |
|
182 | + if (! defined('EE_DMS_ERROR_LIMIT')) { |
|
183 | + $limit = 50; |
|
184 | + } else { |
|
185 | + $limit = EE_DMS_ERROR_LIMIT; |
|
186 | + } |
|
187 | + // make sure errors is an array, see ticket #8261 |
|
188 | + if (is_string($this->_errors)) { |
|
189 | + $this->_errors = array($this->_errors); |
|
190 | + } |
|
191 | + if (count($this->_errors) >= $limit) { |
|
192 | + if ($force) { |
|
193 | + // get rid of the first half of the errors and any above the limit |
|
194 | + $this->_errors = array_slice($this->_errors, $limit / 2, $limit / 2); |
|
195 | + $this->_errors[] = "Limit reached; removed first half of errors to save space"; |
|
196 | + $this->_errors[] = $error; |
|
197 | + } else { |
|
198 | + $this->_errors[ $limit ] = 'More, but limit reached...'; |
|
199 | + } |
|
200 | + } else { |
|
201 | + $this->_errors[] = $error; |
|
202 | + } |
|
203 | + } |
|
204 | + |
|
205 | + /** |
|
206 | + * Indicates there was a fatal error and the migration cannot possibly continue |
|
207 | + * |
|
208 | + * @return boolean |
|
209 | + */ |
|
210 | + public function is_broken() |
|
211 | + { |
|
212 | + return $this->get_status() == EE_Data_Migration_Manager::status_fatal_error; |
|
213 | + } |
|
214 | + |
|
215 | + /** |
|
216 | + * @deprecated since 4.6.12 |
|
217 | + */ |
|
218 | + public function is_borked() |
|
219 | + { |
|
220 | + EE_Error::doing_it_wrong( |
|
221 | + 'is_borked', |
|
222 | + esc_html__( |
|
223 | + 'The cheeky "is_borked" method had been replaced with the more proper "is_broken"', |
|
224 | + 'event_espresso' |
|
225 | + ), |
|
226 | + '4.6.12' |
|
227 | + ); |
|
228 | + return $this->is_broken(); |
|
229 | + } |
|
230 | + |
|
231 | + /** |
|
232 | + * Sets the status to as having a fatal error |
|
233 | + */ |
|
234 | + public function set_broken() |
|
235 | + { |
|
236 | + $this->_status = EE_Data_Migration_Manager::status_fatal_error; |
|
237 | + } |
|
238 | + |
|
239 | + /** |
|
240 | + * |
|
241 | + * @deprecated since 4.6.12 |
|
242 | + */ |
|
243 | + public function set_borked() |
|
244 | + { |
|
245 | + EE_Error::doing_it_wrong( |
|
246 | + 'is_borked', |
|
247 | + esc_html__( |
|
248 | + 'The cheeky "is_borked" method had been replaced with the more proper "is_broken"', |
|
249 | + 'event_espresso' |
|
250 | + ), |
|
251 | + '4.6.12' |
|
252 | + ); |
|
253 | + $this->set_broken(); |
|
254 | + } |
|
255 | + |
|
256 | + /** |
|
257 | + * Checks if this thing believes it is completed |
|
258 | + * |
|
259 | + * @return boolean |
|
260 | + */ |
|
261 | + public function is_completed() |
|
262 | + { |
|
263 | + return $this->get_status() == EE_Data_Migration_Manager::status_completed; |
|
264 | + } |
|
265 | + |
|
266 | + |
|
267 | + /** |
|
268 | + * Checks if the current script has more to do or not (ie, if it's status is CONTINUE) |
|
269 | + * |
|
270 | + * @return boolean |
|
271 | + * @throws EE_Error |
|
272 | + */ |
|
273 | + public function has_more_to_do() |
|
274 | + { |
|
275 | + return $this->get_status() == EE_Data_Migration_Manager::status_continue; |
|
276 | + } |
|
277 | + |
|
278 | + /** |
|
279 | + * Marks that we believe this migration thing is completed |
|
280 | + */ |
|
281 | + public function set_completed() |
|
282 | + { |
|
283 | + $this->_status = EE_Data_Migration_Manager::status_completed; |
|
284 | + } |
|
285 | + |
|
286 | + /** |
|
287 | + * Marks that we think this migration class can continue to migrate |
|
288 | + */ |
|
289 | + public function reattempt() |
|
290 | + { |
|
291 | + $this->_status = EE_Data_Migration_Manager::status_continue; |
|
292 | + $this->add_error(esc_html__('Reattempt migration', 'event_espresso'), true); |
|
293 | + } |
|
294 | + |
|
295 | + /** |
|
296 | + * A lot like "__sleep()" magic method in purpose, this is meant for persisting this class' |
|
297 | + * properties to the DB. However, we don't want to use __sleep() because it's quite |
|
298 | + * possible that this class is defined when it goes to sleep, but NOT available when it |
|
299 | + * awakes (eg, this class is part of an addon that is deactivated at some point). |
|
300 | + */ |
|
301 | + public function properties_as_array() |
|
302 | + { |
|
303 | + $properties = get_object_vars($this); |
|
304 | + $properties['class'] = get_class($this); |
|
305 | + unset($properties['_migration_script']); |
|
306 | + unset($properties['_table_manager']); |
|
307 | + unset($properties['_table_analysis']); |
|
308 | + return $properties; |
|
309 | + } |
|
310 | + |
|
311 | + /** |
|
312 | + * Sets all the properties of this script stage to match what's in the array, which is assumed |
|
313 | + * to have been made from the properties_as_array() function. |
|
314 | + * |
|
315 | + * @param array $array_of_properties like what's produced from properties_as_array() method |
|
316 | + */ |
|
317 | + abstract public function instantiate_from_array_of_properties($array_of_properties); |
|
318 | + |
|
319 | + /** |
|
320 | + * Convenience method for showing a database insertion error |
|
321 | + * |
|
322 | + * @param string $old_table |
|
323 | + * @param array $old_row_as_array |
|
324 | + * @param string $new_table |
|
325 | + * @param array $new_row_as_array columns=>values like used in wpdb->insert |
|
326 | + * @param array $data_types numerically indexed |
|
327 | + * @return string |
|
328 | + */ |
|
329 | + protected function _create_error_message_for_db_insertion( |
|
330 | + $old_table, |
|
331 | + $old_row_as_array, |
|
332 | + $new_table, |
|
333 | + $new_row_as_array, |
|
334 | + $data_types |
|
335 | + ) { |
|
336 | + global $wpdb; |
|
337 | + $old_columns_and_values_for_string = array(); |
|
338 | + foreach ($old_row_as_array as $column => $value) { |
|
339 | + $old_columns_and_values_for_string[] = "$column => $value"; |
|
340 | + } |
|
341 | + $new_columns_and_values_for_string = array(); |
|
342 | + $count = 0; |
|
343 | + foreach ($new_row_as_array as $column => $value) { |
|
344 | + $new_columns_and_values_for_string[] = " $column => $value (" . $data_types[ $count++ ] . ")"; |
|
345 | + } |
|
346 | + return sprintf( |
|
347 | + esc_html__( |
|
348 | + 'Received error "%6$s" inserting row %5$s %1$s %5$s into table %2$s.%5$s Data used was %5$s %3$s %5$s from table %4$s.', |
|
349 | + 'event_espresso' |
|
350 | + ), |
|
351 | + implode(", ", $new_columns_and_values_for_string), |
|
352 | + $new_table, |
|
353 | + implode(", ", $old_columns_and_values_for_string), |
|
354 | + $old_table, |
|
355 | + '<br/>', |
|
356 | + $wpdb->last_error |
|
357 | + ); |
|
358 | + } |
|
359 | + |
|
360 | + |
|
361 | + /** |
|
362 | + * Same as json_encode, just avoids putting |
|
363 | + * serialized arrays into the http build query, as that would |
|
364 | + * |
|
365 | + * @param array $array_of_data |
|
366 | + * @return string |
|
367 | + */ |
|
368 | + protected function _json_encode($array_of_data) |
|
369 | + { |
|
370 | + // we'd rather NOT serialize the transaction details |
|
371 | + $fields_to_include = array(); |
|
372 | + foreach ($array_of_data as $name => $value) { |
|
373 | + $unserialized_data = @unserialize($value); |
|
374 | + if ($unserialized_data === false) { |
|
375 | + $fields_to_include[ $name ] = $value; |
|
376 | + } |
|
377 | + } |
|
378 | + return wp_json_encode($fields_to_include); |
|
379 | + } |
|
380 | + |
|
381 | + /** |
|
382 | + * Gets the table manager (or throws an exception if it cannot be retrieved) |
|
383 | + * |
|
384 | + * @return TableManager |
|
385 | + * @throws EE_Error |
|
386 | + */ |
|
387 | + protected function _get_table_manager() |
|
388 | + { |
|
389 | + if ($this->_table_manager instanceof TableManager) { |
|
390 | + return $this->_table_manager; |
|
391 | + } else { |
|
392 | + throw new EE_Error( |
|
393 | + sprintf( |
|
394 | + esc_html__('Table manager on migration class %1$s is not set properly.', 'event_espresso'), |
|
395 | + get_class($this) |
|
396 | + ) |
|
397 | + ); |
|
398 | + } |
|
399 | + } |
|
400 | + |
|
401 | + /** |
|
402 | + * Gets the injected table analyzer, or throws an exception |
|
403 | + * |
|
404 | + * @return TableAnalysis |
|
405 | + * @throws EE_Error |
|
406 | + */ |
|
407 | + protected function _get_table_analysis() |
|
408 | + { |
|
409 | + if ($this->_table_analysis instanceof TableAnalysis) { |
|
410 | + return $this->_table_analysis; |
|
411 | + } else { |
|
412 | + throw new EE_Error( |
|
413 | + sprintf( |
|
414 | + esc_html__('Table analysis class on migration class %1$s is not set properly.', 'event_espresso'), |
|
415 | + get_class($this) |
|
416 | + ) |
|
417 | + ); |
|
418 | + } |
|
419 | + } |
|
420 | 420 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public function pretty_name() |
78 | 78 | { |
79 | - if (! $this->_pretty_name) { |
|
79 | + if ( ! $this->_pretty_name) { |
|
80 | 80 | throw new EE_Error( |
81 | 81 | sprintf( |
82 | 82 | esc_html__( |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | */ |
180 | 180 | public function add_error($error, $force = false) |
181 | 181 | { |
182 | - if (! defined('EE_DMS_ERROR_LIMIT')) { |
|
182 | + if ( ! defined('EE_DMS_ERROR_LIMIT')) { |
|
183 | 183 | $limit = 50; |
184 | 184 | } else { |
185 | 185 | $limit = EE_DMS_ERROR_LIMIT; |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | $this->_errors[] = "Limit reached; removed first half of errors to save space"; |
196 | 196 | $this->_errors[] = $error; |
197 | 197 | } else { |
198 | - $this->_errors[ $limit ] = 'More, but limit reached...'; |
|
198 | + $this->_errors[$limit] = 'More, but limit reached...'; |
|
199 | 199 | } |
200 | 200 | } else { |
201 | 201 | $this->_errors[] = $error; |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | $new_columns_and_values_for_string = array(); |
342 | 342 | $count = 0; |
343 | 343 | foreach ($new_row_as_array as $column => $value) { |
344 | - $new_columns_and_values_for_string[] = " $column => $value (" . $data_types[ $count++ ] . ")"; |
|
344 | + $new_columns_and_values_for_string[] = " $column => $value (".$data_types[$count++].")"; |
|
345 | 345 | } |
346 | 346 | return sprintf( |
347 | 347 | esc_html__( |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | foreach ($array_of_data as $name => $value) { |
373 | 373 | $unserialized_data = @unserialize($value); |
374 | 374 | if ($unserialized_data === false) { |
375 | - $fields_to_include[ $name ] = $value; |
|
375 | + $fields_to_include[$name] = $value; |
|
376 | 376 | } |
377 | 377 | } |
378 | 378 | return wp_json_encode($fields_to_include); |
@@ -10,9 +10,9 @@ discard block |
||
10 | 10 | $stages = glob(EE_CORE . 'data_migration_scripts/4_5_0_stages/*'); |
11 | 11 | $class_to_filepath = []; |
12 | 12 | foreach ($stages as $filepath) { |
13 | - $matches = []; |
|
14 | - preg_match('~4_5_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
15 | - $class_to_filepath[ $matches[1] ] = $filepath; |
|
13 | + $matches = []; |
|
14 | + preg_match('~4_5_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
15 | + $class_to_filepath[ $matches[1] ] = $filepath; |
|
16 | 16 | } |
17 | 17 | // give addons a chance to autoload their stages too |
18 | 18 | $class_to_filepath = apply_filters('FHEE__EE_DMS_4_5_0__autoloaded_stages', $class_to_filepath); |
@@ -31,70 +31,70 @@ discard block |
||
31 | 31 | class EE_DMS_Core_4_5_0 extends EE_Data_Migration_Script_Base |
32 | 32 | { |
33 | 33 | |
34 | - /** |
|
35 | - * EE_DMS_Core_4_5_0 constructor. |
|
36 | - * |
|
37 | - * @param TableManager|null $table_manager |
|
38 | - * @param TableAnalysis|null $table_analysis |
|
39 | - */ |
|
40 | - public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) |
|
41 | - { |
|
42 | - $this->_pretty_name = esc_html__("Data Update to Event Espresso 4.5.0", "event_espresso"); |
|
43 | - $this->_priority = 10; |
|
44 | - $this->_migration_stages = [ |
|
45 | - new EE_DMS_4_5_0_update_wp_user_for_tickets(), |
|
46 | - new EE_DMS_4_5_0_update_wp_user_for_prices(), |
|
47 | - new EE_DMS_4_5_0_update_wp_user_for_price_types(), |
|
48 | - new EE_DMS_4_5_0_update_wp_user_for_question_groups(), |
|
49 | - new EE_DMS_4_5_0_invoice_settings(), |
|
50 | - ]; |
|
51 | - parent::__construct($table_manager, $table_analysis); |
|
52 | - } |
|
53 | - |
|
54 | - |
|
55 | - public function can_migrate_from_version($version_array) |
|
56 | - { |
|
57 | - $version_string = $version_array['Core']; |
|
58 | - if ( |
|
59 | - version_compare($version_string, '4.5.0.decaf', '<') && version_compare( |
|
60 | - $version_string, |
|
61 | - '4.3.0.decaf', |
|
62 | - '>=' |
|
63 | - ) |
|
64 | - ) { |
|
65 | - // echo "$version_string can be migrated from"; |
|
66 | - return true; |
|
67 | - } elseif (! $version_string) { |
|
68 | - // echo "no version string provided: $version_string"; |
|
69 | - // no version string provided... this must be pre 4.3 |
|
70 | - return false;// changed mind. dont want people thinking they should migrate yet because they cant |
|
71 | - } else { |
|
72 | - // echo "$version_string doesnt apply"; |
|
73 | - return false; |
|
74 | - } |
|
75 | - } |
|
76 | - |
|
77 | - |
|
78 | - /** |
|
79 | - * @return true |
|
80 | - * @throws EE_Error |
|
81 | - * @throws ReflectionException |
|
82 | - */ |
|
83 | - public function schema_changes_before_migration() |
|
84 | - { |
|
85 | - // relies on 4.1's EEH_Activation::create_table |
|
86 | - require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
87 | - |
|
88 | - $table_name = 'esp_answer'; |
|
89 | - $sql = "ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
34 | + /** |
|
35 | + * EE_DMS_Core_4_5_0 constructor. |
|
36 | + * |
|
37 | + * @param TableManager|null $table_manager |
|
38 | + * @param TableAnalysis|null $table_analysis |
|
39 | + */ |
|
40 | + public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) |
|
41 | + { |
|
42 | + $this->_pretty_name = esc_html__("Data Update to Event Espresso 4.5.0", "event_espresso"); |
|
43 | + $this->_priority = 10; |
|
44 | + $this->_migration_stages = [ |
|
45 | + new EE_DMS_4_5_0_update_wp_user_for_tickets(), |
|
46 | + new EE_DMS_4_5_0_update_wp_user_for_prices(), |
|
47 | + new EE_DMS_4_5_0_update_wp_user_for_price_types(), |
|
48 | + new EE_DMS_4_5_0_update_wp_user_for_question_groups(), |
|
49 | + new EE_DMS_4_5_0_invoice_settings(), |
|
50 | + ]; |
|
51 | + parent::__construct($table_manager, $table_analysis); |
|
52 | + } |
|
53 | + |
|
54 | + |
|
55 | + public function can_migrate_from_version($version_array) |
|
56 | + { |
|
57 | + $version_string = $version_array['Core']; |
|
58 | + if ( |
|
59 | + version_compare($version_string, '4.5.0.decaf', '<') && version_compare( |
|
60 | + $version_string, |
|
61 | + '4.3.0.decaf', |
|
62 | + '>=' |
|
63 | + ) |
|
64 | + ) { |
|
65 | + // echo "$version_string can be migrated from"; |
|
66 | + return true; |
|
67 | + } elseif (! $version_string) { |
|
68 | + // echo "no version string provided: $version_string"; |
|
69 | + // no version string provided... this must be pre 4.3 |
|
70 | + return false;// changed mind. dont want people thinking they should migrate yet because they cant |
|
71 | + } else { |
|
72 | + // echo "$version_string doesnt apply"; |
|
73 | + return false; |
|
74 | + } |
|
75 | + } |
|
76 | + |
|
77 | + |
|
78 | + /** |
|
79 | + * @return true |
|
80 | + * @throws EE_Error |
|
81 | + * @throws ReflectionException |
|
82 | + */ |
|
83 | + public function schema_changes_before_migration() |
|
84 | + { |
|
85 | + // relies on 4.1's EEH_Activation::create_table |
|
86 | + require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
87 | + |
|
88 | + $table_name = 'esp_answer'; |
|
89 | + $sql = "ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
90 | 90 | REG_ID int(10) unsigned NOT NULL, |
91 | 91 | QST_ID int(10) unsigned NOT NULL, |
92 | 92 | ANS_value text NOT NULL, |
93 | 93 | PRIMARY KEY (ANS_ID)"; |
94 | - $this->_table_should_exist_previously($table_name, $sql); |
|
94 | + $this->_table_should_exist_previously($table_name, $sql); |
|
95 | 95 | |
96 | - $table_name = 'esp_attendee_meta'; |
|
97 | - $sql = "ATTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
96 | + $table_name = 'esp_attendee_meta'; |
|
97 | + $sql = "ATTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
98 | 98 | ATT_ID bigint(20) unsigned NOT NULL, |
99 | 99 | ATT_fname varchar(45) NOT NULL, |
100 | 100 | ATT_lname varchar(45) NOT NULL, |
@@ -110,10 +110,10 @@ discard block |
||
110 | 110 | KEY ATT_fname (ATT_fname), |
111 | 111 | KEY ATT_lname (ATT_lname), |
112 | 112 | KEY ATT_email (ATT_email(191))"; |
113 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
113 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
114 | 114 | |
115 | - $table_name = 'esp_country'; |
|
116 | - $sql = "CNT_ISO varchar(2) COLLATE utf8_bin NOT NULL, |
|
115 | + $table_name = 'esp_country'; |
|
116 | + $sql = "CNT_ISO varchar(2) COLLATE utf8_bin NOT NULL, |
|
117 | 117 | CNT_ISO3 varchar(3) COLLATE utf8_bin NOT NULL, |
118 | 118 | RGN_ID tinyint(3) unsigned DEFAULT NULL, |
119 | 119 | CNT_name varchar(45) COLLATE utf8_bin NOT NULL, |
@@ -129,10 +129,10 @@ discard block |
||
129 | 129 | CNT_is_EU tinyint(1) DEFAULT '0', |
130 | 130 | CNT_active tinyint(1) DEFAULT '0', |
131 | 131 | PRIMARY KEY (CNT_ISO)"; |
132 | - $this->_table_should_exist_previously($table_name, $sql); |
|
132 | + $this->_table_should_exist_previously($table_name, $sql); |
|
133 | 133 | |
134 | - $table_name = 'esp_datetime'; |
|
135 | - $sql = "DTT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
134 | + $table_name = 'esp_datetime'; |
|
135 | + $sql = "DTT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
136 | 136 | EVT_ID bigint(20) unsigned NOT NULL, |
137 | 137 | DTT_name varchar(255) NOT NULL DEFAULT '', |
138 | 138 | DTT_description text NOT NULL, |
@@ -147,10 +147,10 @@ discard block |
||
147 | 147 | PRIMARY KEY (DTT_ID), |
148 | 148 | KEY EVT_ID (EVT_ID), |
149 | 149 | KEY DTT_is_primary (DTT_is_primary)"; |
150 | - $this->_table_should_exist_previously($table_name, $sql); |
|
150 | + $this->_table_should_exist_previously($table_name, $sql); |
|
151 | 151 | |
152 | - $table_name = 'esp_event_meta'; |
|
153 | - $sql = " |
|
152 | + $table_name = 'esp_event_meta'; |
|
153 | + $sql = " |
|
154 | 154 | EVTM_ID int(10) NOT NULL AUTO_INCREMENT, |
155 | 155 | EVT_ID bigint(20) unsigned NOT NULL, |
156 | 156 | EVT_display_desc tinyint(1) unsigned NOT NULL DEFAULT 1, |
@@ -165,35 +165,35 @@ discard block |
||
165 | 165 | EVT_external_URL varchar(200) NULL, |
166 | 166 | EVT_donations tinyint(1) NULL, |
167 | 167 | PRIMARY KEY (EVTM_ID)"; |
168 | - $this->_table_should_exist_previously($table_name, $sql); |
|
168 | + $this->_table_should_exist_previously($table_name, $sql); |
|
169 | 169 | |
170 | - $table_name = 'esp_event_question_group'; |
|
171 | - $sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
170 | + $table_name = 'esp_event_question_group'; |
|
171 | + $sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
172 | 172 | EVT_ID bigint(20) unsigned NOT NULL, |
173 | 173 | QSG_ID int(10) unsigned NOT NULL, |
174 | 174 | EQG_primary tinyint(1) unsigned NOT NULL DEFAULT 0, |
175 | 175 | PRIMARY KEY (EQG_ID)"; |
176 | - $this->_table_should_exist_previously($table_name, $sql); |
|
176 | + $this->_table_should_exist_previously($table_name, $sql); |
|
177 | 177 | |
178 | - $table_name = 'esp_event_venue'; |
|
179 | - $sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT, |
|
178 | + $table_name = 'esp_event_venue'; |
|
179 | + $sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT, |
|
180 | 180 | EVT_ID bigint(20) unsigned NOT NULL, |
181 | 181 | VNU_ID bigint(20) unsigned NOT NULL, |
182 | 182 | EVV_primary tinyint(1) unsigned NOT NULL DEFAULT 0, |
183 | 183 | PRIMARY KEY (EVV_ID)"; |
184 | - $this->_table_should_exist_previously($table_name, $sql); |
|
184 | + $this->_table_should_exist_previously($table_name, $sql); |
|
185 | 185 | |
186 | - $table_name = 'esp_extra_meta'; |
|
187 | - $sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
186 | + $table_name = 'esp_extra_meta'; |
|
187 | + $sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
188 | 188 | OBJ_ID int(11) DEFAULT NULL, |
189 | 189 | EXM_type varchar(45) DEFAULT NULL, |
190 | 190 | EXM_key varchar(45) DEFAULT NULL, |
191 | 191 | EXM_value text, |
192 | 192 | PRIMARY KEY (EXM_ID)"; |
193 | - $this->_table_should_exist_previously($table_name, $sql); |
|
193 | + $this->_table_should_exist_previously($table_name, $sql); |
|
194 | 194 | |
195 | - $table_name = 'esp_line_item'; |
|
196 | - $sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT, |
|
195 | + $table_name = 'esp_line_item'; |
|
196 | + $sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT, |
|
197 | 197 | LIN_code varchar(245) NOT NULL DEFAULT '', |
198 | 198 | TXN_ID int(11) DEFAULT NULL, |
199 | 199 | LIN_name varchar(245) NOT NULL DEFAULT '', |
@@ -209,21 +209,21 @@ discard block |
||
209 | 209 | OBJ_ID int(11) DEFAULT NULL, |
210 | 210 | OBJ_type varchar(45)DEFAULT NULL, |
211 | 211 | PRIMARY KEY (LIN_ID)"; |
212 | - $this->_table_should_exist_previously($table_name, $sql); |
|
212 | + $this->_table_should_exist_previously($table_name, $sql); |
|
213 | 213 | |
214 | - $table_name = 'esp_message_template'; |
|
215 | - $sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
214 | + $table_name = 'esp_message_template'; |
|
215 | + $sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
216 | 216 | GRP_ID int(10) unsigned NOT NULL, |
217 | 217 | MTP_context varchar(50) NOT NULL, |
218 | 218 | MTP_template_field varchar(30) NOT NULL, |
219 | 219 | MTP_content text NOT NULL, |
220 | 220 | PRIMARY KEY (MTP_ID), |
221 | 221 | KEY GRP_ID (GRP_ID)"; |
222 | - $this->_table_should_exist_previously($table_name, $sql); |
|
223 | - $this->_get_table_manager()->dropIndex('esp_message_template_group', 'EVT_ID'); |
|
222 | + $this->_table_should_exist_previously($table_name, $sql); |
|
223 | + $this->_get_table_manager()->dropIndex('esp_message_template_group', 'EVT_ID'); |
|
224 | 224 | |
225 | - $table_name = 'esp_message_template_group'; |
|
226 | - $sql = "GRP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
225 | + $table_name = 'esp_message_template_group'; |
|
226 | + $sql = "GRP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
227 | 227 | MTP_user_id int(10) NOT NULL DEFAULT '1', |
228 | 228 | MTP_name varchar(245) NOT NULL DEFAULT '', |
229 | 229 | MTP_description varchar(245) NOT NULL DEFAULT '', |
@@ -235,19 +235,19 @@ discard block |
||
235 | 235 | MTP_is_active tinyint(1) NOT NULL DEFAULT '1', |
236 | 236 | PRIMARY KEY (GRP_ID), |
237 | 237 | KEY MTP_user_id (MTP_user_id)"; |
238 | - $this->_table_should_exist_previously($table_name, $sql); |
|
238 | + $this->_table_should_exist_previously($table_name, $sql); |
|
239 | 239 | |
240 | - $table_name = 'esp_event_message_template'; |
|
241 | - $sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
|
240 | + $table_name = 'esp_event_message_template'; |
|
241 | + $sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
|
242 | 242 | EVT_ID bigint(20) unsigned NOT NULL DEFAULT 0, |
243 | 243 | GRP_ID int(10) unsigned NOT NULL DEFAULT 0, |
244 | 244 | PRIMARY KEY (EMT_ID), |
245 | 245 | KEY EVT_ID (EVT_ID), |
246 | 246 | KEY GRP_ID (GRP_ID)"; |
247 | - $this->_table_should_exist_previously($table_name, $sql); |
|
247 | + $this->_table_should_exist_previously($table_name, $sql); |
|
248 | 248 | |
249 | - $table_name = 'esp_payment'; |
|
250 | - $sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
249 | + $table_name = 'esp_payment'; |
|
250 | + $sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
251 | 251 | TXN_ID int(10) unsigned DEFAULT NULL, |
252 | 252 | STS_ID varchar(3) COLLATE utf8_bin DEFAULT NULL, |
253 | 253 | PAY_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00', |
@@ -263,32 +263,32 @@ discard block |
||
263 | 263 | PRIMARY KEY (PAY_ID), |
264 | 264 | KEY TXN_ID (TXN_ID), |
265 | 265 | KEY PAY_timestamp (PAY_timestamp)"; |
266 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
266 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
267 | 267 | |
268 | - $table_name = "esp_ticket_price"; |
|
269 | - $sql = "TKP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
268 | + $table_name = "esp_ticket_price"; |
|
269 | + $sql = "TKP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
270 | 270 | TKT_ID int(10) unsigned NOT NULL, |
271 | 271 | PRC_ID int(10) unsigned NOT NULL, |
272 | 272 | PRIMARY KEY (TKP_ID)"; |
273 | - $this->_table_should_exist_previously($table_name, $sql); |
|
273 | + $this->_table_should_exist_previously($table_name, $sql); |
|
274 | 274 | |
275 | - $table_name = "esp_datetime_ticket"; |
|
276 | - $sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
275 | + $table_name = "esp_datetime_ticket"; |
|
276 | + $sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
277 | 277 | DTT_ID int(10) unsigned NOT NULL, |
278 | 278 | TKT_ID int(10) unsigned NOT NULL, |
279 | 279 | PRIMARY KEY (DTK_ID)"; |
280 | - $this->_table_should_exist_previously($table_name, $sql); |
|
280 | + $this->_table_should_exist_previously($table_name, $sql); |
|
281 | 281 | |
282 | - $table_name = "esp_ticket_template"; |
|
283 | - $sql = "TTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
282 | + $table_name = "esp_ticket_template"; |
|
283 | + $sql = "TTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
284 | 284 | TTM_name varchar(45) NOT NULL, |
285 | 285 | TTM_description text, |
286 | 286 | TTM_file varchar(45), |
287 | 287 | PRIMARY KEY (TTM_ID)"; |
288 | - $this->_table_should_exist_previously($table_name, $sql); |
|
288 | + $this->_table_should_exist_previously($table_name, $sql); |
|
289 | 289 | |
290 | - $table_name = 'esp_question'; |
|
291 | - $sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
290 | + $table_name = 'esp_question'; |
|
291 | + $sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
292 | 292 | QST_display_text text NOT NULL, |
293 | 293 | QST_admin_label varchar(255) NOT NULL, |
294 | 294 | QST_system varchar(25) DEFAULT NULL, |
@@ -300,28 +300,28 @@ discard block |
||
300 | 300 | QST_wp_user bigint(20) unsigned NULL, |
301 | 301 | QST_deleted tinyint(1) unsigned NOT NULL DEFAULT 0, |
302 | 302 | PRIMARY KEY (QST_ID)'; |
303 | - $this->_table_should_exist_previously($table_name, $sql); |
|
303 | + $this->_table_should_exist_previously($table_name, $sql); |
|
304 | 304 | |
305 | - $table_name = 'esp_question_group_question'; |
|
306 | - $sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
305 | + $table_name = 'esp_question_group_question'; |
|
306 | + $sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
307 | 307 | QSG_ID int(10) unsigned NOT NULL, |
308 | 308 | QST_ID int(10) unsigned NOT NULL, |
309 | 309 | QGQ_order int(10) unsigned NOT NULL DEFAULT 0, |
310 | 310 | PRIMARY KEY (QGQ_ID) "; |
311 | - $this->_table_should_exist_previously($table_name, $sql); |
|
311 | + $this->_table_should_exist_previously($table_name, $sql); |
|
312 | 312 | |
313 | - $table_name = 'esp_question_option'; |
|
314 | - $sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
313 | + $table_name = 'esp_question_option'; |
|
314 | + $sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
315 | 315 | QSO_value varchar(255) NOT NULL, |
316 | 316 | QSO_desc text NOT NULL, |
317 | 317 | QST_ID int(10) unsigned NOT NULL, |
318 | 318 | QSO_order int(10) unsigned NOT NULL DEFAULT 0, |
319 | 319 | QSO_deleted tinyint(1) unsigned NOT NULL DEFAULT 0, |
320 | 320 | PRIMARY KEY (QSO_ID)"; |
321 | - $this->_table_should_exist_previously($table_name, $sql); |
|
321 | + $this->_table_should_exist_previously($table_name, $sql); |
|
322 | 322 | |
323 | - $table_name = 'esp_registration'; |
|
324 | - $sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
323 | + $table_name = 'esp_registration'; |
|
324 | + $sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
325 | 325 | EVT_ID bigint(20) unsigned NOT NULL, |
326 | 326 | ATT_ID bigint(20) unsigned NOT NULL, |
327 | 327 | TXN_ID int(10) unsigned NOT NULL, |
@@ -344,28 +344,28 @@ discard block |
||
344 | 344 | KEY STS_ID (STS_ID), |
345 | 345 | KEY REG_url_link (REG_url_link), |
346 | 346 | KEY REG_code (REG_code)"; |
347 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
347 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
348 | 348 | |
349 | - $table_name = 'esp_checkin'; |
|
350 | - $sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
349 | + $table_name = 'esp_checkin'; |
|
350 | + $sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
351 | 351 | REG_ID int(10) unsigned NOT NULL, |
352 | 352 | DTT_ID int(10) unsigned NOT NULL, |
353 | 353 | CHK_in tinyint(1) unsigned NOT NULL DEFAULT 1, |
354 | 354 | CHK_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00', |
355 | 355 | PRIMARY KEY (CHK_ID)"; |
356 | - $this->_table_should_exist_previously($table_name, $sql); |
|
356 | + $this->_table_should_exist_previously($table_name, $sql); |
|
357 | 357 | |
358 | - $table_name = 'esp_state'; |
|
359 | - $sql = "STA_ID smallint(5) unsigned NOT NULL AUTO_INCREMENT, |
|
358 | + $table_name = 'esp_state'; |
|
359 | + $sql = "STA_ID smallint(5) unsigned NOT NULL AUTO_INCREMENT, |
|
360 | 360 | CNT_ISO varchar(2) COLLATE utf8_bin NOT NULL, |
361 | 361 | STA_abbrev varchar(6) COLLATE utf8_bin NOT NULL, |
362 | 362 | STA_name varchar(100) COLLATE utf8_bin NOT NULL, |
363 | 363 | STA_active tinyint(1) DEFAULT '1', |
364 | 364 | PRIMARY KEY (STA_ID)"; |
365 | - $this->_table_should_exist_previously($table_name, $sql); |
|
365 | + $this->_table_should_exist_previously($table_name, $sql); |
|
366 | 366 | |
367 | - $table_name = 'esp_status'; |
|
368 | - $sql = "STS_ID varchar(3) COLLATE utf8_bin NOT NULL, |
|
367 | + $table_name = 'esp_status'; |
|
368 | + $sql = "STS_ID varchar(3) COLLATE utf8_bin NOT NULL, |
|
369 | 369 | STS_code varchar(45) COLLATE utf8_bin NOT NULL, |
370 | 370 | STS_type set('event','registration','transaction','payment','email') COLLATE utf8_bin NOT NULL, |
371 | 371 | STS_can_edit tinyint(1) NOT NULL DEFAULT 0, |
@@ -373,10 +373,10 @@ discard block |
||
373 | 373 | STS_open tinyint(1) NOT NULL DEFAULT 1, |
374 | 374 | UNIQUE KEY STS_ID_UNIQUE (STS_ID), |
375 | 375 | KEY STS_type (STS_type)"; |
376 | - $this->_table_should_exist_previously($table_name, $sql); |
|
376 | + $this->_table_should_exist_previously($table_name, $sql); |
|
377 | 377 | |
378 | - $table_name = 'esp_transaction'; |
|
379 | - $sql = "TXN_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
378 | + $table_name = 'esp_transaction'; |
|
379 | + $sql = "TXN_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
380 | 380 | TXN_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00', |
381 | 381 | TXN_total decimal(10,3) DEFAULT '0.00', |
382 | 382 | TXN_paid decimal(10,3) NOT NULL DEFAULT '0.00', |
@@ -387,10 +387,10 @@ discard block |
||
387 | 387 | PRIMARY KEY (TXN_ID), |
388 | 388 | KEY TXN_timestamp (TXN_timestamp), |
389 | 389 | KEY STS_ID (STS_ID)"; |
390 | - $this->_table_should_exist_previously($table_name, $sql); |
|
390 | + $this->_table_should_exist_previously($table_name, $sql); |
|
391 | 391 | |
392 | - $table_name = 'esp_venue_meta'; |
|
393 | - $sql = "VNUM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
392 | + $table_name = 'esp_venue_meta'; |
|
393 | + $sql = "VNUM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
394 | 394 | VNU_ID bigint(20) unsigned NOT NULL DEFAULT 0, |
395 | 395 | VNU_address varchar(255) DEFAULT NULL, |
396 | 396 | VNU_address2 varchar(255) DEFAULT NULL, |
@@ -408,10 +408,10 @@ discard block |
||
408 | 408 | PRIMARY KEY (VNUM_ID), |
409 | 409 | KEY STA_ID (STA_ID), |
410 | 410 | KEY CNT_ISO (CNT_ISO)"; |
411 | - $this->_table_should_exist_previously($table_name, $sql); |
|
412 | - // modified tables |
|
413 | - $table_name = "esp_price"; |
|
414 | - $sql = "PRC_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
411 | + $this->_table_should_exist_previously($table_name, $sql); |
|
412 | + // modified tables |
|
413 | + $table_name = "esp_price"; |
|
414 | + $sql = "PRC_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
415 | 415 | PRT_ID tinyint(3) unsigned NOT NULL, |
416 | 416 | PRC_amount decimal(10,3) NOT NULL DEFAULT '0.00', |
417 | 417 | PRC_name varchar(245) NOT NULL, |
@@ -423,10 +423,10 @@ discard block |
||
423 | 423 | PRC_wp_user bigint(20) unsigned NULL, |
424 | 424 | PRC_parent int(10) unsigned DEFAULT 0, |
425 | 425 | PRIMARY KEY (PRC_ID)"; |
426 | - $this->_table_should_exist_previously($table_name, $sql); |
|
426 | + $this->_table_should_exist_previously($table_name, $sql); |
|
427 | 427 | |
428 | - $table_name = "esp_price_type"; |
|
429 | - $sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT, |
|
428 | + $table_name = "esp_price_type"; |
|
429 | + $sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT, |
|
430 | 430 | PRT_name varchar(45) NOT NULL, |
431 | 431 | PBT_ID tinyint(3) unsigned NOT NULL DEFAULT '1', |
432 | 432 | PRT_is_percent tinyint(1) NOT NULL DEFAULT '0', |
@@ -435,10 +435,10 @@ discard block |
||
435 | 435 | PRT_deleted tinyint(1) NOT NULL DEFAULT '0', |
436 | 436 | UNIQUE KEY PRT_name_UNIQUE (PRT_name), |
437 | 437 | PRIMARY KEY (PRT_ID)"; |
438 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
438 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
439 | 439 | |
440 | - $table_name = "esp_ticket"; |
|
441 | - $sql = "TKT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
440 | + $table_name = "esp_ticket"; |
|
441 | + $sql = "TKT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
442 | 442 | TTM_ID int(10) unsigned NOT NULL, |
443 | 443 | TKT_name varchar(245) NOT NULL DEFAULT '', |
444 | 444 | TKT_description text NOT NULL, |
@@ -459,11 +459,11 @@ discard block |
||
459 | 459 | TKT_parent int(10) unsigned DEFAULT '0', |
460 | 460 | TKT_deleted tinyint(1) NOT NULL DEFAULT '0', |
461 | 461 | PRIMARY KEY (TKT_ID)"; |
462 | - $this->_table_should_exist_previously($table_name, $sql); |
|
463 | - $this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE'); |
|
462 | + $this->_table_should_exist_previously($table_name, $sql); |
|
463 | + $this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE'); |
|
464 | 464 | |
465 | - $table_name = 'esp_question_group'; |
|
466 | - $sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
465 | + $table_name = 'esp_question_group'; |
|
466 | + $sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
467 | 467 | QSG_name varchar(255) NOT NULL, |
468 | 468 | QSG_identifier varchar(100) NOT NULL, |
469 | 469 | QSG_desc text NULL, |
@@ -475,137 +475,137 @@ discard block |
||
475 | 475 | QSG_wp_user bigint(20) unsigned NULL, |
476 | 476 | PRIMARY KEY (QSG_ID), |
477 | 477 | UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier ASC)'; |
478 | - $this->_table_should_exist_previously($table_name, $sql); |
|
479 | - $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
|
480 | - // (because many need to convert old string states to foreign keys into the states table) |
|
481 | - $script_4_1_defaults->insert_default_states(); |
|
482 | - $script_4_1_defaults->insert_default_countries(); |
|
483 | - // schema on price, price_types and tickets has changed so use the DEFAULT method in here instead of 4.1's and later. |
|
484 | - $this->insert_default_price_types(); |
|
485 | - $this->insert_default_prices(); |
|
486 | - $this->insert_default_tickets(); |
|
487 | - // setting up the config wp option pretty well counts as a 'schema change', or at least should happen here |
|
488 | - EE_Config::instance()->update_espresso_config(); |
|
489 | - return true; |
|
490 | - } |
|
491 | - |
|
492 | - |
|
493 | - /** |
|
494 | - * @return boolean |
|
495 | - */ |
|
496 | - public function schema_changes_after_migration() |
|
497 | - { |
|
498 | - return true; |
|
499 | - } |
|
500 | - |
|
501 | - |
|
502 | - public function migration_page_hooks() |
|
503 | - { |
|
504 | - } |
|
505 | - |
|
506 | - |
|
507 | - /** |
|
508 | - * insert_default_price_types |
|
509 | - * |
|
510 | - * @return void |
|
511 | - * @throws EE_Error |
|
512 | - * @throws ReflectionException |
|
513 | - * @since 4.5.0 |
|
514 | - */ |
|
515 | - public function insert_default_price_types() |
|
516 | - { |
|
517 | - global $wpdb; |
|
518 | - $price_type_table = $wpdb->prefix . "esp_price_type"; |
|
519 | - if ($this->_get_table_analysis()->tableExists($price_type_table)) { |
|
520 | - $SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table; |
|
521 | - $price_types_exist = $wpdb->get_var($SQL); |
|
522 | - if (! $price_types_exist) { |
|
523 | - $user_id = EEH_Activation::get_default_creator_id(); |
|
524 | - $user_id = $user_id ?: 0; |
|
525 | - $SQL = "INSERT INTO $price_type_table ( PRT_ID, PRT_name, PBT_ID, PRT_is_percent, PRT_order, PRT_wp_user, PRT_deleted ) VALUES |
|
478 | + $this->_table_should_exist_previously($table_name, $sql); |
|
479 | + $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
|
480 | + // (because many need to convert old string states to foreign keys into the states table) |
|
481 | + $script_4_1_defaults->insert_default_states(); |
|
482 | + $script_4_1_defaults->insert_default_countries(); |
|
483 | + // schema on price, price_types and tickets has changed so use the DEFAULT method in here instead of 4.1's and later. |
|
484 | + $this->insert_default_price_types(); |
|
485 | + $this->insert_default_prices(); |
|
486 | + $this->insert_default_tickets(); |
|
487 | + // setting up the config wp option pretty well counts as a 'schema change', or at least should happen here |
|
488 | + EE_Config::instance()->update_espresso_config(); |
|
489 | + return true; |
|
490 | + } |
|
491 | + |
|
492 | + |
|
493 | + /** |
|
494 | + * @return boolean |
|
495 | + */ |
|
496 | + public function schema_changes_after_migration() |
|
497 | + { |
|
498 | + return true; |
|
499 | + } |
|
500 | + |
|
501 | + |
|
502 | + public function migration_page_hooks() |
|
503 | + { |
|
504 | + } |
|
505 | + |
|
506 | + |
|
507 | + /** |
|
508 | + * insert_default_price_types |
|
509 | + * |
|
510 | + * @return void |
|
511 | + * @throws EE_Error |
|
512 | + * @throws ReflectionException |
|
513 | + * @since 4.5.0 |
|
514 | + */ |
|
515 | + public function insert_default_price_types() |
|
516 | + { |
|
517 | + global $wpdb; |
|
518 | + $price_type_table = $wpdb->prefix . "esp_price_type"; |
|
519 | + if ($this->_get_table_analysis()->tableExists($price_type_table)) { |
|
520 | + $SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table; |
|
521 | + $price_types_exist = $wpdb->get_var($SQL); |
|
522 | + if (! $price_types_exist) { |
|
523 | + $user_id = EEH_Activation::get_default_creator_id(); |
|
524 | + $user_id = $user_id ?: 0; |
|
525 | + $SQL = "INSERT INTO $price_type_table ( PRT_ID, PRT_name, PBT_ID, PRT_is_percent, PRT_order, PRT_wp_user, PRT_deleted ) VALUES |
|
526 | 526 | (1, '" . esc_html__('Base Price', 'event_espresso') . "', 1, 0, 0, $user_id, 0), |
527 | 527 | (2, '" . esc_html__('Percent Discount', 'event_espresso') . "', 2, 1, 20, $user_id, 0), |
528 | 528 | (3, '" . esc_html__('Dollar Discount', 'event_espresso') . "', 2, 0, 30, $user_id, 0), |
529 | 529 | (4, '" . esc_html__('Percent Surcharge', 'event_espresso') . "', 3, 1, 40, $user_id, 0), |
530 | 530 | (5, '" . esc_html__('Dollar Surcharge', 'event_espresso') . "', 3, 0, 50, $user_id, 0);"; |
531 | - $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_price_types__SQL', $SQL); |
|
532 | - $wpdb->query($SQL); |
|
533 | - } |
|
534 | - } |
|
535 | - } |
|
536 | - |
|
537 | - |
|
538 | - /** |
|
539 | - * insert DEFAULT prices. |
|
540 | - * If we're INSTALLING 4.x CAF, then we add a few extra DEFAULT prices |
|
541 | - * when EEH_Activation's initialize_db_content is called via a hook in |
|
542 | - * EE_Brewing_regular |
|
543 | - * |
|
544 | - * @return void |
|
545 | - * @throws EE_Error |
|
546 | - * @throws ReflectionException |
|
547 | - * @since 4.5.0 |
|
548 | - */ |
|
549 | - public function insert_default_prices() |
|
550 | - { |
|
551 | - global $wpdb; |
|
552 | - $price_table = $wpdb->prefix . "esp_price"; |
|
553 | - if ($this->_get_table_analysis()->tableExists($price_table)) { |
|
554 | - $SQL = 'SELECT COUNT(PRC_ID) FROM ' . $price_table; |
|
555 | - $prices_exist = $wpdb->get_var($SQL); |
|
556 | - if (! $prices_exist) { |
|
557 | - $user_id = EEH_Activation::get_default_creator_id(); |
|
558 | - $user_id = $user_id ?: 0; |
|
559 | - $SQL = "INSERT INTO $price_table |
|
531 | + $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_price_types__SQL', $SQL); |
|
532 | + $wpdb->query($SQL); |
|
533 | + } |
|
534 | + } |
|
535 | + } |
|
536 | + |
|
537 | + |
|
538 | + /** |
|
539 | + * insert DEFAULT prices. |
|
540 | + * If we're INSTALLING 4.x CAF, then we add a few extra DEFAULT prices |
|
541 | + * when EEH_Activation's initialize_db_content is called via a hook in |
|
542 | + * EE_Brewing_regular |
|
543 | + * |
|
544 | + * @return void |
|
545 | + * @throws EE_Error |
|
546 | + * @throws ReflectionException |
|
547 | + * @since 4.5.0 |
|
548 | + */ |
|
549 | + public function insert_default_prices() |
|
550 | + { |
|
551 | + global $wpdb; |
|
552 | + $price_table = $wpdb->prefix . "esp_price"; |
|
553 | + if ($this->_get_table_analysis()->tableExists($price_table)) { |
|
554 | + $SQL = 'SELECT COUNT(PRC_ID) FROM ' . $price_table; |
|
555 | + $prices_exist = $wpdb->get_var($SQL); |
|
556 | + if (! $prices_exist) { |
|
557 | + $user_id = EEH_Activation::get_default_creator_id(); |
|
558 | + $user_id = $user_id ?: 0; |
|
559 | + $SQL = "INSERT INTO $price_table |
|
560 | 560 | (PRC_ID, PRT_ID, PRC_amount, PRC_name, PRC_desc, PRC_is_default, PRC_overrides, PRC_wp_user, PRC_order, PRC_deleted, PRC_parent ) VALUES |
561 | 561 | (1, 1, '0.00', 'Admission', '', 1, NULL, $user_id, 0, 0, 0);"; |
562 | - $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_prices__SQL', $SQL); |
|
563 | - $wpdb->query($SQL); |
|
564 | - } |
|
565 | - } |
|
566 | - } |
|
567 | - |
|
568 | - |
|
569 | - /** |
|
570 | - * insert DEFAULT ticket |
|
571 | - * Almost identical to EE_DMS_Core_4_3_0::insert_default_tickets, except is aware of the TKT_wp_user field |
|
572 | - * |
|
573 | - * @return void |
|
574 | - * @throws EE_Error |
|
575 | - * @throws ReflectionException |
|
576 | - * @since 4.5.0 |
|
577 | - */ |
|
578 | - public function insert_default_tickets() |
|
579 | - { |
|
580 | - global $wpdb; |
|
581 | - $ticket_table = $wpdb->prefix . "esp_ticket"; |
|
582 | - if ($this->_get_table_analysis()->tableExists($ticket_table)) { |
|
583 | - $SQL = 'SELECT COUNT(TKT_ID) FROM ' . $ticket_table; |
|
584 | - $tickets_exist = $wpdb->get_var($SQL); |
|
585 | - if (! $tickets_exist) { |
|
586 | - $user_id = EEH_Activation::get_default_creator_id(); |
|
587 | - $user_id = $user_id ?: 0; |
|
588 | - $SQL = "INSERT INTO $ticket_table |
|
562 | + $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_prices__SQL', $SQL); |
|
563 | + $wpdb->query($SQL); |
|
564 | + } |
|
565 | + } |
|
566 | + } |
|
567 | + |
|
568 | + |
|
569 | + /** |
|
570 | + * insert DEFAULT ticket |
|
571 | + * Almost identical to EE_DMS_Core_4_3_0::insert_default_tickets, except is aware of the TKT_wp_user field |
|
572 | + * |
|
573 | + * @return void |
|
574 | + * @throws EE_Error |
|
575 | + * @throws ReflectionException |
|
576 | + * @since 4.5.0 |
|
577 | + */ |
|
578 | + public function insert_default_tickets() |
|
579 | + { |
|
580 | + global $wpdb; |
|
581 | + $ticket_table = $wpdb->prefix . "esp_ticket"; |
|
582 | + if ($this->_get_table_analysis()->tableExists($ticket_table)) { |
|
583 | + $SQL = 'SELECT COUNT(TKT_ID) FROM ' . $ticket_table; |
|
584 | + $tickets_exist = $wpdb->get_var($SQL); |
|
585 | + if (! $tickets_exist) { |
|
586 | + $user_id = EEH_Activation::get_default_creator_id(); |
|
587 | + $user_id = $user_id ?: 0; |
|
588 | + $SQL = "INSERT INTO $ticket_table |
|
589 | 589 | ( TKT_ID, TTM_ID, TKT_name, TKT_description, TKT_qty, TKT_sold, TKT_uses, TKT_required, TKT_min, TKT_max, TKT_price, TKT_start_date, TKT_end_date, TKT_taxable, TKT_order, TKT_row, TKT_is_default, TKT_parent, TKT_wp_user, TKT_deleted ) VALUES |
590 | 590 | ( 1, 0, '" . |
591 | - esc_html__("Free Ticket", "event_espresso") . |
|
592 | - "', '', 100, 0, -1, 0, 0, -1, 0.00, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, 0, 1, 1, 0, $user_id, 0);"; |
|
593 | - $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_tickets__SQL', $SQL); |
|
594 | - $wpdb->query($SQL); |
|
595 | - } |
|
596 | - } |
|
597 | - $ticket_price_table = $wpdb->prefix . "esp_ticket_price"; |
|
598 | - if ($this->_get_table_analysis()->tableExists($ticket_price_table)) { |
|
599 | - $SQL = 'SELECT COUNT(TKP_ID) FROM ' . $ticket_price_table; |
|
600 | - $ticket_prc_exist = $wpdb->get_var($SQL); |
|
601 | - if (! $ticket_prc_exist) { |
|
602 | - $SQL = "INSERT INTO $ticket_price_table |
|
591 | + esc_html__("Free Ticket", "event_espresso") . |
|
592 | + "', '', 100, 0, -1, 0, 0, -1, 0.00, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, 0, 1, 1, 0, $user_id, 0);"; |
|
593 | + $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_tickets__SQL', $SQL); |
|
594 | + $wpdb->query($SQL); |
|
595 | + } |
|
596 | + } |
|
597 | + $ticket_price_table = $wpdb->prefix . "esp_ticket_price"; |
|
598 | + if ($this->_get_table_analysis()->tableExists($ticket_price_table)) { |
|
599 | + $SQL = 'SELECT COUNT(TKP_ID) FROM ' . $ticket_price_table; |
|
600 | + $ticket_prc_exist = $wpdb->get_var($SQL); |
|
601 | + if (! $ticket_prc_exist) { |
|
602 | + $SQL = "INSERT INTO $ticket_price_table |
|
603 | 603 | ( TKP_ID, TKT_ID, PRC_ID ) VALUES |
604 | 604 | ( 1, 1, 1 ) |
605 | 605 | "; |
606 | - $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_tickets__SQL__ticket_price', $SQL); |
|
607 | - $wpdb->query($SQL); |
|
608 | - } |
|
609 | - } |
|
610 | - } |
|
606 | + $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_tickets__SQL__ticket_price', $SQL); |
|
607 | + $wpdb->query($SQL); |
|
608 | + } |
|
609 | + } |
|
610 | + } |
|
611 | 611 | } |
@@ -7,12 +7,12 @@ discard block |
||
7 | 7 | // unfortunately, this needs to be done upon INCLUSION of this file, |
8 | 8 | // instead of construction, because it only gets constructed on first page load |
9 | 9 | // (all other times it gets resurrected from a wordpress option) |
10 | -$stages = glob(EE_CORE . 'data_migration_scripts/4_5_0_stages/*'); |
|
10 | +$stages = glob(EE_CORE.'data_migration_scripts/4_5_0_stages/*'); |
|
11 | 11 | $class_to_filepath = []; |
12 | 12 | foreach ($stages as $filepath) { |
13 | 13 | $matches = []; |
14 | 14 | preg_match('~4_5_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
15 | - $class_to_filepath[ $matches[1] ] = $filepath; |
|
15 | + $class_to_filepath[$matches[1]] = $filepath; |
|
16 | 16 | } |
17 | 17 | // give addons a chance to autoload their stages too |
18 | 18 | $class_to_filepath = apply_filters('FHEE__EE_DMS_4_5_0__autoloaded_stages', $class_to_filepath); |
@@ -64,10 +64,10 @@ discard block |
||
64 | 64 | ) { |
65 | 65 | // echo "$version_string can be migrated from"; |
66 | 66 | return true; |
67 | - } elseif (! $version_string) { |
|
67 | + } elseif ( ! $version_string) { |
|
68 | 68 | // echo "no version string provided: $version_string"; |
69 | 69 | // no version string provided... this must be pre 4.3 |
70 | - return false;// changed mind. dont want people thinking they should migrate yet because they cant |
|
70 | + return false; // changed mind. dont want people thinking they should migrate yet because they cant |
|
71 | 71 | } else { |
72 | 72 | // echo "$version_string doesnt apply"; |
73 | 73 | return false; |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | public function schema_changes_before_migration() |
84 | 84 | { |
85 | 85 | // relies on 4.1's EEH_Activation::create_table |
86 | - require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
86 | + require_once(EE_HELPERS.'EEH_Activation.helper.php'); |
|
87 | 87 | |
88 | 88 | $table_name = 'esp_answer'; |
89 | 89 | $sql = "ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
@@ -515,20 +515,20 @@ discard block |
||
515 | 515 | public function insert_default_price_types() |
516 | 516 | { |
517 | 517 | global $wpdb; |
518 | - $price_type_table = $wpdb->prefix . "esp_price_type"; |
|
518 | + $price_type_table = $wpdb->prefix."esp_price_type"; |
|
519 | 519 | if ($this->_get_table_analysis()->tableExists($price_type_table)) { |
520 | - $SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table; |
|
520 | + $SQL = 'SELECT COUNT(PRT_ID) FROM '.$price_type_table; |
|
521 | 521 | $price_types_exist = $wpdb->get_var($SQL); |
522 | - if (! $price_types_exist) { |
|
522 | + if ( ! $price_types_exist) { |
|
523 | 523 | $user_id = EEH_Activation::get_default_creator_id(); |
524 | 524 | $user_id = $user_id ?: 0; |
525 | 525 | $SQL = "INSERT INTO $price_type_table ( PRT_ID, PRT_name, PBT_ID, PRT_is_percent, PRT_order, PRT_wp_user, PRT_deleted ) VALUES |
526 | - (1, '" . esc_html__('Base Price', 'event_espresso') . "', 1, 0, 0, $user_id, 0), |
|
527 | - (2, '" . esc_html__('Percent Discount', 'event_espresso') . "', 2, 1, 20, $user_id, 0), |
|
528 | - (3, '" . esc_html__('Dollar Discount', 'event_espresso') . "', 2, 0, 30, $user_id, 0), |
|
529 | - (4, '" . esc_html__('Percent Surcharge', 'event_espresso') . "', 3, 1, 40, $user_id, 0), |
|
530 | - (5, '" . esc_html__('Dollar Surcharge', 'event_espresso') . "', 3, 0, 50, $user_id, 0);"; |
|
531 | - $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_price_types__SQL', $SQL); |
|
526 | + (1, '".esc_html__('Base Price', 'event_espresso')."', 1, 0, 0, $user_id, 0), |
|
527 | + (2, '".esc_html__('Percent Discount', 'event_espresso')."', 2, 1, 20, $user_id, 0), |
|
528 | + (3, '".esc_html__('Dollar Discount', 'event_espresso')."', 2, 0, 30, $user_id, 0), |
|
529 | + (4, '".esc_html__('Percent Surcharge', 'event_espresso')."', 3, 1, 40, $user_id, 0), |
|
530 | + (5, '".esc_html__('Dollar Surcharge', 'event_espresso')."', 3, 0, 50, $user_id, 0);"; |
|
531 | + $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_price_types__SQL', $SQL); |
|
532 | 532 | $wpdb->query($SQL); |
533 | 533 | } |
534 | 534 | } |
@@ -549,11 +549,11 @@ discard block |
||
549 | 549 | public function insert_default_prices() |
550 | 550 | { |
551 | 551 | global $wpdb; |
552 | - $price_table = $wpdb->prefix . "esp_price"; |
|
552 | + $price_table = $wpdb->prefix."esp_price"; |
|
553 | 553 | if ($this->_get_table_analysis()->tableExists($price_table)) { |
554 | - $SQL = 'SELECT COUNT(PRC_ID) FROM ' . $price_table; |
|
554 | + $SQL = 'SELECT COUNT(PRC_ID) FROM '.$price_table; |
|
555 | 555 | $prices_exist = $wpdb->get_var($SQL); |
556 | - if (! $prices_exist) { |
|
556 | + if ( ! $prices_exist) { |
|
557 | 557 | $user_id = EEH_Activation::get_default_creator_id(); |
558 | 558 | $user_id = $user_id ?: 0; |
559 | 559 | $SQL = "INSERT INTO $price_table |
@@ -578,27 +578,27 @@ discard block |
||
578 | 578 | public function insert_default_tickets() |
579 | 579 | { |
580 | 580 | global $wpdb; |
581 | - $ticket_table = $wpdb->prefix . "esp_ticket"; |
|
581 | + $ticket_table = $wpdb->prefix."esp_ticket"; |
|
582 | 582 | if ($this->_get_table_analysis()->tableExists($ticket_table)) { |
583 | - $SQL = 'SELECT COUNT(TKT_ID) FROM ' . $ticket_table; |
|
583 | + $SQL = 'SELECT COUNT(TKT_ID) FROM '.$ticket_table; |
|
584 | 584 | $tickets_exist = $wpdb->get_var($SQL); |
585 | - if (! $tickets_exist) { |
|
585 | + if ( ! $tickets_exist) { |
|
586 | 586 | $user_id = EEH_Activation::get_default_creator_id(); |
587 | 587 | $user_id = $user_id ?: 0; |
588 | 588 | $SQL = "INSERT INTO $ticket_table |
589 | 589 | ( TKT_ID, TTM_ID, TKT_name, TKT_description, TKT_qty, TKT_sold, TKT_uses, TKT_required, TKT_min, TKT_max, TKT_price, TKT_start_date, TKT_end_date, TKT_taxable, TKT_order, TKT_row, TKT_is_default, TKT_parent, TKT_wp_user, TKT_deleted ) VALUES |
590 | - ( 1, 0, '" . |
|
591 | - esc_html__("Free Ticket", "event_espresso") . |
|
590 | + ( 1, 0, '". |
|
591 | + esc_html__("Free Ticket", "event_espresso"). |
|
592 | 592 | "', '', 100, 0, -1, 0, 0, -1, 0.00, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, 0, 1, 1, 0, $user_id, 0);"; |
593 | - $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_tickets__SQL', $SQL); |
|
593 | + $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_tickets__SQL', $SQL); |
|
594 | 594 | $wpdb->query($SQL); |
595 | 595 | } |
596 | 596 | } |
597 | - $ticket_price_table = $wpdb->prefix . "esp_ticket_price"; |
|
597 | + $ticket_price_table = $wpdb->prefix."esp_ticket_price"; |
|
598 | 598 | if ($this->_get_table_analysis()->tableExists($ticket_price_table)) { |
599 | - $SQL = 'SELECT COUNT(TKP_ID) FROM ' . $ticket_price_table; |
|
599 | + $SQL = 'SELECT COUNT(TKP_ID) FROM '.$ticket_price_table; |
|
600 | 600 | $ticket_prc_exist = $wpdb->get_var($SQL); |
601 | - if (! $ticket_prc_exist) { |
|
601 | + if ( ! $ticket_prc_exist) { |
|
602 | 602 | $SQL = "INSERT INTO $ticket_price_table |
603 | 603 | ( TKP_ID, TKT_ID, PRC_ID ) VALUES |
604 | 604 | ( 1, 1, 1 ) |
@@ -10,9 +10,9 @@ discard block |
||
10 | 10 | $stages = glob(EE_CORE . 'data_migration_scripts/4_6_0_stages/*'); |
11 | 11 | $class_to_filepath = []; |
12 | 12 | foreach ($stages as $filepath) { |
13 | - $matches = []; |
|
14 | - preg_match('~4_6_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
15 | - $class_to_filepath[ $matches[1] ] = $filepath; |
|
13 | + $matches = []; |
|
14 | + preg_match('~4_6_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
15 | + $class_to_filepath[ $matches[1] ] = $filepath; |
|
16 | 16 | } |
17 | 17 | // give addons a chance to autoload their stages too |
18 | 18 | $class_to_filepath = apply_filters('FHEE__EE_DMS_4_6_0__autoloaded_stages', $class_to_filepath); |
@@ -33,77 +33,77 @@ discard block |
||
33 | 33 | class EE_DMS_Core_4_6_0 extends EE_Data_Migration_Script_Base |
34 | 34 | { |
35 | 35 | |
36 | - /** |
|
37 | - * return EE_DMS_Core_4_6_0 |
|
38 | - * |
|
39 | - * @param TableManager|null $table_manager |
|
40 | - * @param TableAnalysis|null $table_analysis |
|
41 | - */ |
|
42 | - public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) |
|
43 | - { |
|
44 | - $this->_pretty_name = esc_html__("Data Update to Event Espresso 4.6.0", "event_espresso"); |
|
45 | - $this->_priority = 10; |
|
46 | - $this->_migration_stages = [ |
|
47 | - new EE_DMS_4_6_0_gateways(), |
|
48 | - new EE_DMS_4_6_0_question_types(), |
|
49 | - new EE_DMS_4_6_0_country_system_question(), |
|
50 | - new EE_DMS_4_6_0_state_system_question(), |
|
51 | - new EE_DMS_4_6_0_billing_info(), |
|
52 | - new EE_DMS_4_6_0_transactions(), |
|
53 | - new EE_DMS_4_6_0_payments(), |
|
54 | - new EE_DMS_4_6_0_invoice_settings(), |
|
55 | - ]; |
|
56 | - parent::__construct($table_manager, $table_analysis); |
|
57 | - } |
|
58 | - |
|
59 | - |
|
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.6.0.decaf', '<') && version_compare( |
|
69 | - $version_string, |
|
70 | - '4.5.0.decaf', |
|
71 | - '>=' |
|
72 | - ) |
|
73 | - ) { |
|
74 | - // echo "$version_string can be migrated from"; |
|
75 | - return true; |
|
76 | - } elseif (! $version_string) { |
|
77 | - // echo "no version string provided: $version_string"; |
|
78 | - // no version string provided... this must be pre 4.3 |
|
79 | - return false;// changed mind. dont want people thinking they should migrate yet because they cant |
|
80 | - } else { |
|
81 | - // echo "$version_string doesnt apply"; |
|
82 | - return false; |
|
83 | - } |
|
84 | - } |
|
85 | - |
|
86 | - |
|
87 | - /** |
|
88 | - * @return bool |
|
89 | - * @throws EE_Error |
|
90 | - * @throws ReflectionException |
|
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 | - |
|
97 | - $table_name = 'esp_answer'; |
|
98 | - $sql = "ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
36 | + /** |
|
37 | + * return EE_DMS_Core_4_6_0 |
|
38 | + * |
|
39 | + * @param TableManager|null $table_manager |
|
40 | + * @param TableAnalysis|null $table_analysis |
|
41 | + */ |
|
42 | + public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) |
|
43 | + { |
|
44 | + $this->_pretty_name = esc_html__("Data Update to Event Espresso 4.6.0", "event_espresso"); |
|
45 | + $this->_priority = 10; |
|
46 | + $this->_migration_stages = [ |
|
47 | + new EE_DMS_4_6_0_gateways(), |
|
48 | + new EE_DMS_4_6_0_question_types(), |
|
49 | + new EE_DMS_4_6_0_country_system_question(), |
|
50 | + new EE_DMS_4_6_0_state_system_question(), |
|
51 | + new EE_DMS_4_6_0_billing_info(), |
|
52 | + new EE_DMS_4_6_0_transactions(), |
|
53 | + new EE_DMS_4_6_0_payments(), |
|
54 | + new EE_DMS_4_6_0_invoice_settings(), |
|
55 | + ]; |
|
56 | + parent::__construct($table_manager, $table_analysis); |
|
57 | + } |
|
58 | + |
|
59 | + |
|
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.6.0.decaf', '<') && version_compare( |
|
69 | + $version_string, |
|
70 | + '4.5.0.decaf', |
|
71 | + '>=' |
|
72 | + ) |
|
73 | + ) { |
|
74 | + // echo "$version_string can be migrated from"; |
|
75 | + return true; |
|
76 | + } elseif (! $version_string) { |
|
77 | + // echo "no version string provided: $version_string"; |
|
78 | + // no version string provided... this must be pre 4.3 |
|
79 | + return false;// changed mind. dont want people thinking they should migrate yet because they cant |
|
80 | + } else { |
|
81 | + // echo "$version_string doesnt apply"; |
|
82 | + return false; |
|
83 | + } |
|
84 | + } |
|
85 | + |
|
86 | + |
|
87 | + /** |
|
88 | + * @return bool |
|
89 | + * @throws EE_Error |
|
90 | + * @throws ReflectionException |
|
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 | + |
|
97 | + $table_name = 'esp_answer'; |
|
98 | + $sql = "ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
99 | 99 | REG_ID int(10) unsigned NOT NULL, |
100 | 100 | QST_ID int(10) unsigned NOT NULL, |
101 | 101 | ANS_value text NOT NULL, |
102 | 102 | PRIMARY KEY (ANS_ID)"; |
103 | - $this->_table_should_exist_previously($table_name, $sql); |
|
103 | + $this->_table_should_exist_previously($table_name, $sql); |
|
104 | 104 | |
105 | - $table_name = 'esp_attendee_meta'; |
|
106 | - $sql = "ATTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
105 | + $table_name = 'esp_attendee_meta'; |
|
106 | + $sql = "ATTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
107 | 107 | ATT_ID bigint(20) unsigned NOT NULL, |
108 | 108 | ATT_fname varchar(45) NOT NULL, |
109 | 109 | ATT_lname varchar(45) NOT NULL, |
@@ -119,10 +119,10 @@ discard block |
||
119 | 119 | KEY ATT_fname (ATT_fname), |
120 | 120 | KEY ATT_lname (ATT_lname), |
121 | 121 | KEY ATT_email (ATT_email(191))"; |
122 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
122 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
123 | 123 | |
124 | - $table_name = 'esp_country'; |
|
125 | - $sql = "CNT_ISO varchar(2) COLLATE utf8_bin NOT NULL, |
|
124 | + $table_name = 'esp_country'; |
|
125 | + $sql = "CNT_ISO varchar(2) COLLATE utf8_bin NOT NULL, |
|
126 | 126 | CNT_ISO3 varchar(3) COLLATE utf8_bin NOT NULL, |
127 | 127 | RGN_ID tinyint(3) unsigned DEFAULT NULL, |
128 | 128 | CNT_name varchar(45) COLLATE utf8_bin NOT NULL, |
@@ -138,20 +138,20 @@ discard block |
||
138 | 138 | CNT_is_EU tinyint(1) DEFAULT '0', |
139 | 139 | CNT_active tinyint(1) DEFAULT '0', |
140 | 140 | PRIMARY KEY (CNT_ISO)"; |
141 | - $this->_table_should_exist_previously($table_name, $sql); |
|
141 | + $this->_table_should_exist_previously($table_name, $sql); |
|
142 | 142 | |
143 | - $table_name = 'esp_currency'; |
|
144 | - $sql = "CUR_code varchar(6) COLLATE utf8_bin NOT NULL, |
|
143 | + $table_name = 'esp_currency'; |
|
144 | + $sql = "CUR_code varchar(6) COLLATE utf8_bin NOT NULL, |
|
145 | 145 | CUR_single varchar(45) COLLATE utf8_bin DEFAULT 'dollar', |
146 | 146 | CUR_plural varchar(45) COLLATE utf8_bin DEFAULT 'dollars', |
147 | 147 | CUR_sign varchar(45) COLLATE utf8_bin DEFAULT '$', |
148 | 148 | CUR_dec_plc varchar(1) COLLATE utf8_bin NOT NULL DEFAULT '2', |
149 | 149 | CUR_active tinyint(1) DEFAULT '0', |
150 | 150 | PRIMARY KEY (CUR_code)"; |
151 | - $this->_table_is_new_in_this_version($table_name, $sql); |
|
151 | + $this->_table_is_new_in_this_version($table_name, $sql); |
|
152 | 152 | |
153 | - $table_name = 'esp_datetime'; |
|
154 | - $sql = "DTT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
153 | + $table_name = 'esp_datetime'; |
|
154 | + $sql = "DTT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
155 | 155 | EVT_ID bigint(20) unsigned NOT NULL, |
156 | 156 | DTT_name varchar(255) NOT NULL DEFAULT '', |
157 | 157 | DTT_description text NOT NULL, |
@@ -166,10 +166,10 @@ discard block |
||
166 | 166 | PRIMARY KEY (DTT_ID), |
167 | 167 | KEY EVT_ID (EVT_ID), |
168 | 168 | KEY DTT_is_primary (DTT_is_primary)"; |
169 | - $this->_table_should_exist_previously($table_name, $sql); |
|
169 | + $this->_table_should_exist_previously($table_name, $sql); |
|
170 | 170 | |
171 | - $table_name = 'esp_event_meta'; |
|
172 | - $sql = " |
|
171 | + $table_name = 'esp_event_meta'; |
|
172 | + $sql = " |
|
173 | 173 | EVTM_ID int(10) NOT NULL AUTO_INCREMENT, |
174 | 174 | EVT_ID bigint(20) unsigned NOT NULL, |
175 | 175 | EVT_display_desc tinyint(1) unsigned NOT NULL DEFAULT 1, |
@@ -184,35 +184,35 @@ discard block |
||
184 | 184 | EVT_external_URL varchar(200) NULL, |
185 | 185 | EVT_donations tinyint(1) NULL, |
186 | 186 | PRIMARY KEY (EVTM_ID)"; |
187 | - $this->_table_should_exist_previously($table_name, $sql); |
|
187 | + $this->_table_should_exist_previously($table_name, $sql); |
|
188 | 188 | |
189 | - $table_name = 'esp_event_question_group'; |
|
190 | - $sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
189 | + $table_name = 'esp_event_question_group'; |
|
190 | + $sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
191 | 191 | EVT_ID bigint(20) unsigned NOT NULL, |
192 | 192 | QSG_ID int(10) unsigned NOT NULL, |
193 | 193 | EQG_primary tinyint(1) unsigned NOT NULL DEFAULT 0, |
194 | 194 | PRIMARY KEY (EQG_ID)"; |
195 | - $this->_table_should_exist_previously($table_name, $sql); |
|
195 | + $this->_table_should_exist_previously($table_name, $sql); |
|
196 | 196 | |
197 | - $table_name = 'esp_event_venue'; |
|
198 | - $sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT, |
|
197 | + $table_name = 'esp_event_venue'; |
|
198 | + $sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT, |
|
199 | 199 | EVT_ID bigint(20) unsigned NOT NULL, |
200 | 200 | VNU_ID bigint(20) unsigned NOT NULL, |
201 | 201 | EVV_primary tinyint(1) unsigned NOT NULL DEFAULT 0, |
202 | 202 | PRIMARY KEY (EVV_ID)"; |
203 | - $this->_table_should_exist_previously($table_name, $sql); |
|
203 | + $this->_table_should_exist_previously($table_name, $sql); |
|
204 | 204 | |
205 | - $table_name = 'esp_extra_meta'; |
|
206 | - $sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
205 | + $table_name = 'esp_extra_meta'; |
|
206 | + $sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
207 | 207 | OBJ_ID int(11) DEFAULT NULL, |
208 | 208 | EXM_type varchar(45) DEFAULT NULL, |
209 | 209 | EXM_key varchar(45) DEFAULT NULL, |
210 | 210 | EXM_value text, |
211 | 211 | PRIMARY KEY (EXM_ID)"; |
212 | - $this->_table_should_exist_previously($table_name, $sql); |
|
212 | + $this->_table_should_exist_previously($table_name, $sql); |
|
213 | 213 | |
214 | - $table_name = 'esp_line_item'; |
|
215 | - $sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT, |
|
214 | + $table_name = 'esp_line_item'; |
|
215 | + $sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT, |
|
216 | 216 | LIN_code varchar(245) NOT NULL DEFAULT '', |
217 | 217 | TXN_ID int(11) DEFAULT NULL, |
218 | 218 | LIN_name varchar(245) NOT NULL DEFAULT '', |
@@ -228,10 +228,10 @@ discard block |
||
228 | 228 | OBJ_ID int(11) DEFAULT NULL, |
229 | 229 | OBJ_type varchar(45)DEFAULT NULL, |
230 | 230 | PRIMARY KEY (LIN_ID)"; |
231 | - $this->_table_should_exist_previously($table_name, $sql); |
|
231 | + $this->_table_should_exist_previously($table_name, $sql); |
|
232 | 232 | |
233 | - $table_name = 'esp_log'; |
|
234 | - $sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT, |
|
233 | + $table_name = 'esp_log'; |
|
234 | + $sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT, |
|
235 | 235 | LOG_time datetime DEFAULT NULL, |
236 | 236 | OBJ_ID varchar(45) DEFAULT NULL, |
237 | 237 | OBJ_type varchar(45) DEFAULT NULL, |
@@ -239,21 +239,21 @@ discard block |
||
239 | 239 | LOG_message text, |
240 | 240 | LOG_wp_user int(11) DEFAULT NULL, |
241 | 241 | PRIMARY KEY (LOG_ID)"; |
242 | - $this->_table_is_new_in_this_version($table_name, $sql); |
|
242 | + $this->_table_is_new_in_this_version($table_name, $sql); |
|
243 | 243 | |
244 | - $table_name = 'esp_message_template'; |
|
245 | - $sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
244 | + $table_name = 'esp_message_template'; |
|
245 | + $sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
246 | 246 | GRP_ID int(10) unsigned NOT NULL, |
247 | 247 | MTP_context varchar(50) NOT NULL, |
248 | 248 | MTP_template_field varchar(30) NOT NULL, |
249 | 249 | MTP_content text NOT NULL, |
250 | 250 | PRIMARY KEY (MTP_ID), |
251 | 251 | KEY GRP_ID (GRP_ID)"; |
252 | - $this->_table_should_exist_previously($table_name, $sql); |
|
253 | - $this->_get_table_manager()->dropIndex('esp_message_template_group', 'EVT_ID'); |
|
252 | + $this->_table_should_exist_previously($table_name, $sql); |
|
253 | + $this->_get_table_manager()->dropIndex('esp_message_template_group', 'EVT_ID'); |
|
254 | 254 | |
255 | - $table_name = 'esp_message_template_group'; |
|
256 | - $sql = "GRP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
255 | + $table_name = 'esp_message_template_group'; |
|
256 | + $sql = "GRP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
257 | 257 | MTP_user_id int(10) NOT NULL DEFAULT '1', |
258 | 258 | MTP_name varchar(245) NOT NULL DEFAULT '', |
259 | 259 | MTP_description varchar(245) NOT NULL DEFAULT '', |
@@ -265,19 +265,19 @@ discard block |
||
265 | 265 | MTP_is_active tinyint(1) NOT NULL DEFAULT '1', |
266 | 266 | PRIMARY KEY (GRP_ID), |
267 | 267 | KEY MTP_user_id (MTP_user_id)"; |
268 | - $this->_table_should_exist_previously($table_name, $sql); |
|
268 | + $this->_table_should_exist_previously($table_name, $sql); |
|
269 | 269 | |
270 | - $table_name = 'esp_event_message_template'; |
|
271 | - $sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
|
270 | + $table_name = 'esp_event_message_template'; |
|
271 | + $sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
|
272 | 272 | EVT_ID bigint(20) unsigned NOT NULL DEFAULT 0, |
273 | 273 | GRP_ID int(10) unsigned NOT NULL DEFAULT 0, |
274 | 274 | PRIMARY KEY (EMT_ID), |
275 | 275 | KEY EVT_ID (EVT_ID), |
276 | 276 | KEY GRP_ID (GRP_ID)"; |
277 | - $this->_table_should_exist_previously($table_name, $sql); |
|
277 | + $this->_table_should_exist_previously($table_name, $sql); |
|
278 | 278 | |
279 | - $table_name = 'esp_payment'; |
|
280 | - $sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
279 | + $table_name = 'esp_payment'; |
|
280 | + $sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
281 | 281 | TXN_ID int(10) unsigned DEFAULT NULL, |
282 | 282 | STS_ID varchar(3) COLLATE utf8_bin DEFAULT NULL, |
283 | 283 | PAY_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00', |
@@ -294,10 +294,10 @@ discard block |
||
294 | 294 | PRIMARY KEY (PAY_ID), |
295 | 295 | KEY TXN_ID (TXN_ID), |
296 | 296 | KEY PAY_timestamp (PAY_timestamp)"; |
297 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
297 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
298 | 298 | |
299 | - $table_name = 'esp_payment_method'; |
|
300 | - $sql = "PMD_ID int(11) NOT NULL AUTO_INCREMENT, |
|
299 | + $table_name = 'esp_payment_method'; |
|
300 | + $sql = "PMD_ID int(11) NOT NULL AUTO_INCREMENT, |
|
301 | 301 | PMD_type varchar(124) DEFAULT NULL, |
302 | 302 | PMD_name varchar(255) DEFAULT NULL, |
303 | 303 | PMD_desc text, |
@@ -312,32 +312,32 @@ discard block |
||
312 | 312 | PMD_scope varchar(255) NULL DEFAULT 'frontend', |
313 | 313 | PRIMARY KEY (PMD_ID), |
314 | 314 | UNIQUE KEY PMD_slug_UNIQUE (PMD_slug)"; |
315 | - $this->_table_is_new_in_this_version($table_name, $sql); |
|
315 | + $this->_table_is_new_in_this_version($table_name, $sql); |
|
316 | 316 | |
317 | - $table_name = "esp_ticket_price"; |
|
318 | - $sql = "TKP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
317 | + $table_name = "esp_ticket_price"; |
|
318 | + $sql = "TKP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
319 | 319 | TKT_ID int(10) unsigned NOT NULL, |
320 | 320 | PRC_ID int(10) unsigned NOT NULL, |
321 | 321 | PRIMARY KEY (TKP_ID)"; |
322 | - $this->_table_should_exist_previously($table_name, $sql); |
|
322 | + $this->_table_should_exist_previously($table_name, $sql); |
|
323 | 323 | |
324 | - $table_name = "esp_datetime_ticket"; |
|
325 | - $sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
324 | + $table_name = "esp_datetime_ticket"; |
|
325 | + $sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
326 | 326 | DTT_ID int(10) unsigned NOT NULL, |
327 | 327 | TKT_ID int(10) unsigned NOT NULL, |
328 | 328 | PRIMARY KEY (DTK_ID)"; |
329 | - $this->_table_should_exist_previously($table_name, $sql); |
|
329 | + $this->_table_should_exist_previously($table_name, $sql); |
|
330 | 330 | |
331 | - $table_name = "esp_ticket_template"; |
|
332 | - $sql = "TTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
331 | + $table_name = "esp_ticket_template"; |
|
332 | + $sql = "TTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
333 | 333 | TTM_name varchar(45) NOT NULL, |
334 | 334 | TTM_description text, |
335 | 335 | TTM_file varchar(45), |
336 | 336 | PRIMARY KEY (TTM_ID)"; |
337 | - $this->_table_should_exist_previously($table_name, $sql); |
|
337 | + $this->_table_should_exist_previously($table_name, $sql); |
|
338 | 338 | |
339 | - $table_name = 'esp_question'; |
|
340 | - $sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
339 | + $table_name = 'esp_question'; |
|
340 | + $sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
341 | 341 | QST_display_text text NOT NULL, |
342 | 342 | QST_admin_label varchar(255) NOT NULL, |
343 | 343 | QST_system varchar(25) DEFAULT NULL, |
@@ -349,28 +349,28 @@ discard block |
||
349 | 349 | QST_wp_user bigint(20) unsigned NULL, |
350 | 350 | QST_deleted tinyint(1) unsigned NOT NULL DEFAULT 0, |
351 | 351 | PRIMARY KEY (QST_ID)'; |
352 | - $this->_table_should_exist_previously($table_name, $sql); |
|
352 | + $this->_table_should_exist_previously($table_name, $sql); |
|
353 | 353 | |
354 | - $table_name = 'esp_question_group_question'; |
|
355 | - $sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
354 | + $table_name = 'esp_question_group_question'; |
|
355 | + $sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
356 | 356 | QSG_ID int(10) unsigned NOT NULL, |
357 | 357 | QST_ID int(10) unsigned NOT NULL, |
358 | 358 | QGQ_order int(10) unsigned NOT NULL DEFAULT 0, |
359 | 359 | PRIMARY KEY (QGQ_ID) "; |
360 | - $this->_table_should_exist_previously($table_name, $sql); |
|
360 | + $this->_table_should_exist_previously($table_name, $sql); |
|
361 | 361 | |
362 | - $table_name = 'esp_question_option'; |
|
363 | - $sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
362 | + $table_name = 'esp_question_option'; |
|
363 | + $sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
364 | 364 | QSO_value varchar(255) NOT NULL, |
365 | 365 | QSO_desc text NOT NULL, |
366 | 366 | QST_ID int(10) unsigned NOT NULL, |
367 | 367 | QSO_order int(10) unsigned NOT NULL DEFAULT 0, |
368 | 368 | QSO_deleted tinyint(1) unsigned NOT NULL DEFAULT 0, |
369 | 369 | PRIMARY KEY (QSO_ID)"; |
370 | - $this->_table_should_exist_previously($table_name, $sql); |
|
370 | + $this->_table_should_exist_previously($table_name, $sql); |
|
371 | 371 | |
372 | - $table_name = 'esp_registration'; |
|
373 | - $sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
372 | + $table_name = 'esp_registration'; |
|
373 | + $sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
374 | 374 | EVT_ID bigint(20) unsigned NOT NULL, |
375 | 375 | ATT_ID bigint(20) unsigned NOT NULL, |
376 | 376 | TXN_ID int(10) unsigned NOT NULL, |
@@ -393,28 +393,28 @@ discard block |
||
393 | 393 | KEY STS_ID (STS_ID), |
394 | 394 | KEY REG_url_link (REG_url_link), |
395 | 395 | KEY REG_code (REG_code)"; |
396 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
396 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
397 | 397 | |
398 | - $table_name = 'esp_checkin'; |
|
399 | - $sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
398 | + $table_name = 'esp_checkin'; |
|
399 | + $sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
400 | 400 | REG_ID int(10) unsigned NOT NULL, |
401 | 401 | DTT_ID int(10) unsigned NOT NULL, |
402 | 402 | CHK_in tinyint(1) unsigned NOT NULL DEFAULT 1, |
403 | 403 | CHK_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00', |
404 | 404 | PRIMARY KEY (CHK_ID)"; |
405 | - $this->_table_should_exist_previously($table_name, $sql); |
|
405 | + $this->_table_should_exist_previously($table_name, $sql); |
|
406 | 406 | |
407 | - $table_name = 'esp_state'; |
|
408 | - $sql = "STA_ID smallint(5) unsigned NOT NULL AUTO_INCREMENT, |
|
407 | + $table_name = 'esp_state'; |
|
408 | + $sql = "STA_ID smallint(5) unsigned NOT NULL AUTO_INCREMENT, |
|
409 | 409 | CNT_ISO varchar(2) COLLATE utf8_bin NOT NULL, |
410 | 410 | STA_abbrev varchar(24) COLLATE utf8_bin NOT NULL, |
411 | 411 | STA_name varchar(100) COLLATE utf8_bin NOT NULL, |
412 | 412 | STA_active tinyint(1) DEFAULT '1', |
413 | 413 | PRIMARY KEY (STA_ID)"; |
414 | - $this->_table_should_exist_previously($table_name, $sql); |
|
414 | + $this->_table_should_exist_previously($table_name, $sql); |
|
415 | 415 | |
416 | - $table_name = 'esp_status'; |
|
417 | - $sql = "STS_ID varchar(3) COLLATE utf8_bin NOT NULL, |
|
416 | + $table_name = 'esp_status'; |
|
417 | + $sql = "STS_ID varchar(3) COLLATE utf8_bin NOT NULL, |
|
418 | 418 | STS_code varchar(45) COLLATE utf8_bin NOT NULL, |
419 | 419 | STS_type set('event','registration','transaction','payment','email') COLLATE utf8_bin NOT NULL, |
420 | 420 | STS_can_edit tinyint(1) NOT NULL DEFAULT 0, |
@@ -422,10 +422,10 @@ discard block |
||
422 | 422 | STS_open tinyint(1) NOT NULL DEFAULT 1, |
423 | 423 | UNIQUE KEY STS_ID_UNIQUE (STS_ID), |
424 | 424 | KEY STS_type (STS_type)"; |
425 | - $this->_table_should_exist_previously($table_name, $sql); |
|
425 | + $this->_table_should_exist_previously($table_name, $sql); |
|
426 | 426 | |
427 | - $table_name = 'esp_transaction'; |
|
428 | - $sql = "TXN_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
427 | + $table_name = 'esp_transaction'; |
|
428 | + $sql = "TXN_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
429 | 429 | TXN_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00', |
430 | 430 | TXN_total decimal(10,3) DEFAULT '0.00', |
431 | 431 | TXN_paid decimal(10,3) NOT NULL DEFAULT '0.00', |
@@ -437,10 +437,10 @@ discard block |
||
437 | 437 | PRIMARY KEY (TXN_ID), |
438 | 438 | KEY TXN_timestamp (TXN_timestamp), |
439 | 439 | KEY STS_ID (STS_ID)"; |
440 | - $this->_table_should_exist_previously($table_name, $sql); |
|
440 | + $this->_table_should_exist_previously($table_name, $sql); |
|
441 | 441 | |
442 | - $table_name = 'esp_venue_meta'; |
|
443 | - $sql = "VNUM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
442 | + $table_name = 'esp_venue_meta'; |
|
443 | + $sql = "VNUM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
444 | 444 | VNU_ID bigint(20) unsigned NOT NULL DEFAULT 0, |
445 | 445 | VNU_address varchar(255) DEFAULT NULL, |
446 | 446 | VNU_address2 varchar(255) DEFAULT NULL, |
@@ -458,10 +458,10 @@ discard block |
||
458 | 458 | PRIMARY KEY (VNUM_ID), |
459 | 459 | KEY STA_ID (STA_ID), |
460 | 460 | KEY CNT_ISO (CNT_ISO)"; |
461 | - $this->_table_should_exist_previously($table_name, $sql); |
|
462 | - // modified tables |
|
463 | - $table_name = "esp_price"; |
|
464 | - $sql = "PRC_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
461 | + $this->_table_should_exist_previously($table_name, $sql); |
|
462 | + // modified tables |
|
463 | + $table_name = "esp_price"; |
|
464 | + $sql = "PRC_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
465 | 465 | PRT_ID tinyint(3) unsigned NOT NULL, |
466 | 466 | PRC_amount decimal(10,3) NOT NULL DEFAULT '0.00', |
467 | 467 | PRC_name varchar(245) NOT NULL, |
@@ -473,10 +473,10 @@ discard block |
||
473 | 473 | PRC_wp_user bigint(20) unsigned NULL, |
474 | 474 | PRC_parent int(10) unsigned DEFAULT 0, |
475 | 475 | PRIMARY KEY (PRC_ID)"; |
476 | - $this->_table_should_exist_previously($table_name, $sql); |
|
476 | + $this->_table_should_exist_previously($table_name, $sql); |
|
477 | 477 | |
478 | - $table_name = "esp_price_type"; |
|
479 | - $sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT, |
|
478 | + $table_name = "esp_price_type"; |
|
479 | + $sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT, |
|
480 | 480 | PRT_name varchar(45) NOT NULL, |
481 | 481 | PBT_ID tinyint(3) unsigned NOT NULL DEFAULT '1', |
482 | 482 | PRT_is_percent tinyint(1) NOT NULL DEFAULT '0', |
@@ -485,10 +485,10 @@ discard block |
||
485 | 485 | PRT_deleted tinyint(1) NOT NULL DEFAULT '0', |
486 | 486 | UNIQUE KEY PRT_name_UNIQUE (PRT_name), |
487 | 487 | PRIMARY KEY (PRT_ID)"; |
488 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
488 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
489 | 489 | |
490 | - $table_name = "esp_ticket"; |
|
491 | - $sql = "TKT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
490 | + $table_name = "esp_ticket"; |
|
491 | + $sql = "TKT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
492 | 492 | TTM_ID int(10) unsigned NOT NULL, |
493 | 493 | TKT_name varchar(245) NOT NULL DEFAULT '', |
494 | 494 | TKT_description text NOT NULL, |
@@ -509,11 +509,11 @@ discard block |
||
509 | 509 | TKT_parent int(10) unsigned DEFAULT '0', |
510 | 510 | TKT_deleted tinyint(1) NOT NULL DEFAULT '0', |
511 | 511 | PRIMARY KEY (TKT_ID)"; |
512 | - $this->_table_should_exist_previously($table_name, $sql); |
|
513 | - $this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE'); |
|
512 | + $this->_table_should_exist_previously($table_name, $sql); |
|
513 | + $this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE'); |
|
514 | 514 | |
515 | - $table_name = 'esp_question_group'; |
|
516 | - $sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
515 | + $table_name = 'esp_question_group'; |
|
516 | + $sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
517 | 517 | QSG_name varchar(255) NOT NULL, |
518 | 518 | QSG_identifier varchar(100) NOT NULL, |
519 | 519 | QSG_desc text NULL, |
@@ -525,145 +525,145 @@ discard block |
||
525 | 525 | QSG_wp_user bigint(20) unsigned NULL, |
526 | 526 | PRIMARY KEY (QSG_ID), |
527 | 527 | UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier ASC)'; |
528 | - $this->_table_should_exist_previously($table_name, $sql); |
|
529 | - /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */ |
|
530 | - $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
|
531 | - // (because many need to convert old string states to foreign keys into the states table) |
|
532 | - $script_4_1_defaults->insert_default_states(); |
|
533 | - $script_4_1_defaults->insert_default_countries(); |
|
534 | - /** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */ |
|
535 | - $script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0'); |
|
536 | - $script_4_5_defaults->insert_default_price_types(); |
|
537 | - $script_4_5_defaults->insert_default_prices(); |
|
538 | - $script_4_5_defaults->insert_default_tickets(); |
|
539 | - // setting up the config wp option pretty well counts as a 'schema change', or at least should happen here |
|
540 | - EE_Config::instance()->update_espresso_config(); |
|
541 | - $this->add_default_admin_only_payments(); |
|
542 | - $this->insert_default_currencies(); |
|
543 | - return true; |
|
544 | - } |
|
545 | - |
|
546 | - |
|
547 | - /** |
|
548 | - * @return boolean |
|
549 | - */ |
|
550 | - public function schema_changes_after_migration() |
|
551 | - { |
|
552 | - return true; |
|
553 | - } |
|
554 | - |
|
555 | - |
|
556 | - public function migration_page_hooks() |
|
557 | - { |
|
558 | - } |
|
559 | - |
|
560 | - |
|
561 | - /** |
|
562 | - * @throws ReflectionException |
|
563 | - * @throws EE_Error |
|
564 | - */ |
|
565 | - public function add_default_admin_only_payments() |
|
566 | - { |
|
567 | - global $wpdb; |
|
568 | - |
|
569 | - $table_name = $wpdb->prefix . "esp_payment_method"; |
|
570 | - $user_id = EEH_Activation::get_default_creator_id(); |
|
571 | - $user_id = $user_id ?: 0; |
|
572 | - if ($this->_get_table_analysis()->tableExists($table_name)) { |
|
573 | - $default_admin_only_payment_methods = apply_filters( |
|
574 | - 'FHEE__EEH_Activation__add_default_admin_only_payments__default_admin_only_payment_methods', |
|
575 | - [ |
|
576 | - esc_html__("Bank", 'event_espresso') => esc_html__("Bank Draft", 'event_espresso'), |
|
577 | - esc_html__("Cash", 'event_espresso') => esc_html__( |
|
578 | - "Cash Delivered Physically", |
|
579 | - 'event_espresso' |
|
580 | - ), |
|
581 | - esc_html__("Check", 'event_espresso') => esc_html__("Paper Check", 'event_espresso'), |
|
582 | - esc_html__("Credit Card", 'event_espresso') => esc_html__( |
|
583 | - "Offline Credit Card Payment", |
|
584 | - 'event_espresso' |
|
585 | - ), |
|
586 | - esc_html__("Debit Card", 'event_espresso') => esc_html__( |
|
587 | - "Offline Debit Payment", |
|
588 | - 'event_espresso' |
|
589 | - ), |
|
590 | - esc_html__("Invoice", 'event_espresso') => esc_html__( |
|
591 | - "Invoice received with monies included", |
|
592 | - 'event_espresso' |
|
593 | - ), |
|
594 | - esc_html__("Money Order", 'event_espresso') => '', |
|
595 | - esc_html__("Paypal", 'event_espresso') => esc_html__( |
|
596 | - "Paypal eCheck, Invoice, etc", |
|
597 | - 'event_espresso' |
|
598 | - ), |
|
599 | - esc_html__('Other', 'event_espresso') => esc_html__( |
|
600 | - 'Other method of payment', |
|
601 | - 'event_espresso' |
|
602 | - ), |
|
603 | - ] |
|
604 | - ); |
|
605 | - // make sure we hae payment method records for the following |
|
606 | - // so admins can record payments for them from the admin page |
|
607 | - foreach ($default_admin_only_payment_methods as $nicename => $description) { |
|
608 | - $slug = sanitize_key($nicename); |
|
609 | - // check that such a payment method exists |
|
610 | - $exists = $wpdb->get_var($wpdb->prepare("SELECT count(*) FROM $table_name WHERE PMD_slug = %s", $slug)); |
|
611 | - if (! $exists) { |
|
612 | - $values = [ |
|
613 | - 'PMD_type' => 'Admin_Only', |
|
614 | - 'PMD_name' => $nicename, |
|
615 | - 'PMD_admin_name' => $nicename, |
|
616 | - 'PMD_admin_desc' => $description, |
|
617 | - 'PMD_slug' => $slug, |
|
618 | - 'PMD_wp_user' => $user_id, |
|
619 | - 'PMD_scope' => serialize(['ADMIN']), |
|
620 | - ]; |
|
621 | - $success = $wpdb->insert( |
|
622 | - $table_name, |
|
623 | - $values, |
|
624 | - [ |
|
625 | - '%s',// PMD_type |
|
626 | - '%s',// PMD_name |
|
627 | - '%s',// PMD_admin_name |
|
628 | - '%s',// PMD_admin_desc |
|
629 | - '%s',// PMD_slug |
|
630 | - '%d',// PMD_wp_user |
|
631 | - '%s',// PMD_scope |
|
632 | - ] |
|
633 | - ); |
|
634 | - if (! $success) { |
|
635 | - $this->add_error( |
|
636 | - sprintf( |
|
637 | - esc_html__( |
|
638 | - "Could not insert new admin-only payment method with values %s during migration", |
|
639 | - "event_espresso" |
|
640 | - ), |
|
641 | - $this->_json_encode($values) |
|
642 | - ) |
|
643 | - ); |
|
644 | - } |
|
645 | - } |
|
646 | - } |
|
647 | - } |
|
648 | - } |
|
649 | - |
|
650 | - |
|
651 | - /** |
|
652 | - * insert_default_countries |
|
653 | - * |
|
654 | - * @static |
|
655 | - * @return void |
|
656 | - * @throws EE_Error |
|
657 | - */ |
|
658 | - public function insert_default_currencies() |
|
659 | - { |
|
660 | - global $wpdb; |
|
661 | - $currency_table = $wpdb->prefix . "esp_currency"; |
|
662 | - if ($this->_get_table_analysis()->tableExists($currency_table)) { |
|
663 | - $SQL = "SELECT COUNT('CUR_code') FROM $currency_table"; |
|
664 | - $countries = $wpdb->get_var($SQL); |
|
665 | - if (! $countries) { |
|
666 | - $SQL = "INSERT INTO $currency_table |
|
528 | + $this->_table_should_exist_previously($table_name, $sql); |
|
529 | + /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */ |
|
530 | + $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
|
531 | + // (because many need to convert old string states to foreign keys into the states table) |
|
532 | + $script_4_1_defaults->insert_default_states(); |
|
533 | + $script_4_1_defaults->insert_default_countries(); |
|
534 | + /** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */ |
|
535 | + $script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0'); |
|
536 | + $script_4_5_defaults->insert_default_price_types(); |
|
537 | + $script_4_5_defaults->insert_default_prices(); |
|
538 | + $script_4_5_defaults->insert_default_tickets(); |
|
539 | + // setting up the config wp option pretty well counts as a 'schema change', or at least should happen here |
|
540 | + EE_Config::instance()->update_espresso_config(); |
|
541 | + $this->add_default_admin_only_payments(); |
|
542 | + $this->insert_default_currencies(); |
|
543 | + return true; |
|
544 | + } |
|
545 | + |
|
546 | + |
|
547 | + /** |
|
548 | + * @return boolean |
|
549 | + */ |
|
550 | + public function schema_changes_after_migration() |
|
551 | + { |
|
552 | + return true; |
|
553 | + } |
|
554 | + |
|
555 | + |
|
556 | + public function migration_page_hooks() |
|
557 | + { |
|
558 | + } |
|
559 | + |
|
560 | + |
|
561 | + /** |
|
562 | + * @throws ReflectionException |
|
563 | + * @throws EE_Error |
|
564 | + */ |
|
565 | + public function add_default_admin_only_payments() |
|
566 | + { |
|
567 | + global $wpdb; |
|
568 | + |
|
569 | + $table_name = $wpdb->prefix . "esp_payment_method"; |
|
570 | + $user_id = EEH_Activation::get_default_creator_id(); |
|
571 | + $user_id = $user_id ?: 0; |
|
572 | + if ($this->_get_table_analysis()->tableExists($table_name)) { |
|
573 | + $default_admin_only_payment_methods = apply_filters( |
|
574 | + 'FHEE__EEH_Activation__add_default_admin_only_payments__default_admin_only_payment_methods', |
|
575 | + [ |
|
576 | + esc_html__("Bank", 'event_espresso') => esc_html__("Bank Draft", 'event_espresso'), |
|
577 | + esc_html__("Cash", 'event_espresso') => esc_html__( |
|
578 | + "Cash Delivered Physically", |
|
579 | + 'event_espresso' |
|
580 | + ), |
|
581 | + esc_html__("Check", 'event_espresso') => esc_html__("Paper Check", 'event_espresso'), |
|
582 | + esc_html__("Credit Card", 'event_espresso') => esc_html__( |
|
583 | + "Offline Credit Card Payment", |
|
584 | + 'event_espresso' |
|
585 | + ), |
|
586 | + esc_html__("Debit Card", 'event_espresso') => esc_html__( |
|
587 | + "Offline Debit Payment", |
|
588 | + 'event_espresso' |
|
589 | + ), |
|
590 | + esc_html__("Invoice", 'event_espresso') => esc_html__( |
|
591 | + "Invoice received with monies included", |
|
592 | + 'event_espresso' |
|
593 | + ), |
|
594 | + esc_html__("Money Order", 'event_espresso') => '', |
|
595 | + esc_html__("Paypal", 'event_espresso') => esc_html__( |
|
596 | + "Paypal eCheck, Invoice, etc", |
|
597 | + 'event_espresso' |
|
598 | + ), |
|
599 | + esc_html__('Other', 'event_espresso') => esc_html__( |
|
600 | + 'Other method of payment', |
|
601 | + 'event_espresso' |
|
602 | + ), |
|
603 | + ] |
|
604 | + ); |
|
605 | + // make sure we hae payment method records for the following |
|
606 | + // so admins can record payments for them from the admin page |
|
607 | + foreach ($default_admin_only_payment_methods as $nicename => $description) { |
|
608 | + $slug = sanitize_key($nicename); |
|
609 | + // check that such a payment method exists |
|
610 | + $exists = $wpdb->get_var($wpdb->prepare("SELECT count(*) FROM $table_name WHERE PMD_slug = %s", $slug)); |
|
611 | + if (! $exists) { |
|
612 | + $values = [ |
|
613 | + 'PMD_type' => 'Admin_Only', |
|
614 | + 'PMD_name' => $nicename, |
|
615 | + 'PMD_admin_name' => $nicename, |
|
616 | + 'PMD_admin_desc' => $description, |
|
617 | + 'PMD_slug' => $slug, |
|
618 | + 'PMD_wp_user' => $user_id, |
|
619 | + 'PMD_scope' => serialize(['ADMIN']), |
|
620 | + ]; |
|
621 | + $success = $wpdb->insert( |
|
622 | + $table_name, |
|
623 | + $values, |
|
624 | + [ |
|
625 | + '%s',// PMD_type |
|
626 | + '%s',// PMD_name |
|
627 | + '%s',// PMD_admin_name |
|
628 | + '%s',// PMD_admin_desc |
|
629 | + '%s',// PMD_slug |
|
630 | + '%d',// PMD_wp_user |
|
631 | + '%s',// PMD_scope |
|
632 | + ] |
|
633 | + ); |
|
634 | + if (! $success) { |
|
635 | + $this->add_error( |
|
636 | + sprintf( |
|
637 | + esc_html__( |
|
638 | + "Could not insert new admin-only payment method with values %s during migration", |
|
639 | + "event_espresso" |
|
640 | + ), |
|
641 | + $this->_json_encode($values) |
|
642 | + ) |
|
643 | + ); |
|
644 | + } |
|
645 | + } |
|
646 | + } |
|
647 | + } |
|
648 | + } |
|
649 | + |
|
650 | + |
|
651 | + /** |
|
652 | + * insert_default_countries |
|
653 | + * |
|
654 | + * @static |
|
655 | + * @return void |
|
656 | + * @throws EE_Error |
|
657 | + */ |
|
658 | + public function insert_default_currencies() |
|
659 | + { |
|
660 | + global $wpdb; |
|
661 | + $currency_table = $wpdb->prefix . "esp_currency"; |
|
662 | + if ($this->_get_table_analysis()->tableExists($currency_table)) { |
|
663 | + $SQL = "SELECT COUNT('CUR_code') FROM $currency_table"; |
|
664 | + $countries = $wpdb->get_var($SQL); |
|
665 | + if (! $countries) { |
|
666 | + $SQL = "INSERT INTO $currency_table |
|
667 | 667 | ( CUR_code, CUR_single, CUR_plural, CUR_sign, CUR_dec_plc, CUR_active) VALUES |
668 | 668 | ( 'EUR', 'Euro', 'Euros', '€', 2,1), |
669 | 669 | ( 'AED', 'Dirham', 'Dirhams', 'د.إ',2,1), |
@@ -817,8 +817,8 @@ discard block |
||
817 | 817 | ( 'ZAR', 'Rand', 'Rands', 'R', 2,1), |
818 | 818 | ( 'ZMK', 'Kwacha', 'Kwachas', '', 2,1), |
819 | 819 | ( 'ZWD', 'Dollar', 'Dollars', 'Z$', 2,1);"; |
820 | - $wpdb->query($SQL); |
|
821 | - } |
|
822 | - } |
|
823 | - } |
|
820 | + $wpdb->query($SQL); |
|
821 | + } |
|
822 | + } |
|
823 | + } |
|
824 | 824 | } |
@@ -7,12 +7,12 @@ discard block |
||
7 | 7 | // unfortunately, this needs to be done upon INCLUSION of this file, |
8 | 8 | // instead of construction, because it only gets constructed on first page load |
9 | 9 | // (all other times it gets resurrected from a wordpress option) |
10 | -$stages = glob(EE_CORE . 'data_migration_scripts/4_6_0_stages/*'); |
|
10 | +$stages = glob(EE_CORE.'data_migration_scripts/4_6_0_stages/*'); |
|
11 | 11 | $class_to_filepath = []; |
12 | 12 | foreach ($stages as $filepath) { |
13 | 13 | $matches = []; |
14 | 14 | preg_match('~4_6_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
15 | - $class_to_filepath[ $matches[1] ] = $filepath; |
|
15 | + $class_to_filepath[$matches[1]] = $filepath; |
|
16 | 16 | } |
17 | 17 | // give addons a chance to autoload their stages too |
18 | 18 | $class_to_filepath = apply_filters('FHEE__EE_DMS_4_6_0__autoloaded_stages', $class_to_filepath); |
@@ -73,10 +73,10 @@ discard block |
||
73 | 73 | ) { |
74 | 74 | // echo "$version_string can be migrated from"; |
75 | 75 | return true; |
76 | - } elseif (! $version_string) { |
|
76 | + } elseif ( ! $version_string) { |
|
77 | 77 | // echo "no version string provided: $version_string"; |
78 | 78 | // no version string provided... this must be pre 4.3 |
79 | - return false;// changed mind. dont want people thinking they should migrate yet because they cant |
|
79 | + return false; // changed mind. dont want people thinking they should migrate yet because they cant |
|
80 | 80 | } else { |
81 | 81 | // echo "$version_string doesnt apply"; |
82 | 82 | return false; |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | public function schema_changes_before_migration() |
93 | 93 | { |
94 | 94 | // relies on 4.1's EEH_Activation::create_table |
95 | - require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
95 | + require_once(EE_HELPERS.'EEH_Activation.helper.php'); |
|
96 | 96 | |
97 | 97 | $table_name = 'esp_answer'; |
98 | 98 | $sql = "ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
@@ -566,7 +566,7 @@ discard block |
||
566 | 566 | { |
567 | 567 | global $wpdb; |
568 | 568 | |
569 | - $table_name = $wpdb->prefix . "esp_payment_method"; |
|
569 | + $table_name = $wpdb->prefix."esp_payment_method"; |
|
570 | 570 | $user_id = EEH_Activation::get_default_creator_id(); |
571 | 571 | $user_id = $user_id ?: 0; |
572 | 572 | if ($this->_get_table_analysis()->tableExists($table_name)) { |
@@ -608,8 +608,8 @@ discard block |
||
608 | 608 | $slug = sanitize_key($nicename); |
609 | 609 | // check that such a payment method exists |
610 | 610 | $exists = $wpdb->get_var($wpdb->prepare("SELECT count(*) FROM $table_name WHERE PMD_slug = %s", $slug)); |
611 | - if (! $exists) { |
|
612 | - $values = [ |
|
611 | + if ( ! $exists) { |
|
612 | + $values = [ |
|
613 | 613 | 'PMD_type' => 'Admin_Only', |
614 | 614 | 'PMD_name' => $nicename, |
615 | 615 | 'PMD_admin_name' => $nicename, |
@@ -622,16 +622,16 @@ discard block |
||
622 | 622 | $table_name, |
623 | 623 | $values, |
624 | 624 | [ |
625 | - '%s',// PMD_type |
|
626 | - '%s',// PMD_name |
|
627 | - '%s',// PMD_admin_name |
|
628 | - '%s',// PMD_admin_desc |
|
629 | - '%s',// PMD_slug |
|
630 | - '%d',// PMD_wp_user |
|
631 | - '%s',// PMD_scope |
|
625 | + '%s', // PMD_type |
|
626 | + '%s', // PMD_name |
|
627 | + '%s', // PMD_admin_name |
|
628 | + '%s', // PMD_admin_desc |
|
629 | + '%s', // PMD_slug |
|
630 | + '%d', // PMD_wp_user |
|
631 | + '%s', // PMD_scope |
|
632 | 632 | ] |
633 | 633 | ); |
634 | - if (! $success) { |
|
634 | + if ( ! $success) { |
|
635 | 635 | $this->add_error( |
636 | 636 | sprintf( |
637 | 637 | esc_html__( |
@@ -658,11 +658,11 @@ discard block |
||
658 | 658 | public function insert_default_currencies() |
659 | 659 | { |
660 | 660 | global $wpdb; |
661 | - $currency_table = $wpdb->prefix . "esp_currency"; |
|
661 | + $currency_table = $wpdb->prefix."esp_currency"; |
|
662 | 662 | if ($this->_get_table_analysis()->tableExists($currency_table)) { |
663 | 663 | $SQL = "SELECT COUNT('CUR_code') FROM $currency_table"; |
664 | 664 | $countries = $wpdb->get_var($SQL); |
665 | - if (! $countries) { |
|
665 | + if ( ! $countries) { |
|
666 | 666 | $SQL = "INSERT INTO $currency_table |
667 | 667 | ( CUR_code, CUR_single, CUR_plural, CUR_sign, CUR_dec_plc, CUR_active) VALUES |
668 | 668 | ( 'EUR', 'Euro', 'Euros', '€', 2,1), |
@@ -13,80 +13,80 @@ |
||
13 | 13 | class EE_DMS_4_3_0_event_message_templates extends EE_Data_Migration_Script_Stage_Table |
14 | 14 | { |
15 | 15 | |
16 | - /** |
|
17 | - * This property will hold the table name for event_message_templates |
|
18 | - * |
|
19 | - * @var string |
|
20 | - */ |
|
21 | - private string $_emt_table; |
|
16 | + /** |
|
17 | + * This property will hold the table name for event_message_templates |
|
18 | + * |
|
19 | + * @var string |
|
20 | + */ |
|
21 | + private string $_emt_table; |
|
22 | 22 | |
23 | 23 | |
24 | - public function __construct() |
|
25 | - { |
|
26 | - global $wpdb; |
|
27 | - $this->_pretty_name = esc_html__('Event Message Templates', 'event_espresso'); |
|
28 | - $this->_old_table = $wpdb->prefix . "esp_message_template_group"; |
|
29 | - $this->_emt_table = $wpdb->prefix . "esp_event_message_template"; |
|
30 | - parent::__construct(); |
|
31 | - } |
|
24 | + public function __construct() |
|
25 | + { |
|
26 | + global $wpdb; |
|
27 | + $this->_pretty_name = esc_html__('Event Message Templates', 'event_espresso'); |
|
28 | + $this->_old_table = $wpdb->prefix . "esp_message_template_group"; |
|
29 | + $this->_emt_table = $wpdb->prefix . "esp_event_message_template"; |
|
30 | + parent::__construct(); |
|
31 | + } |
|
32 | 32 | |
33 | 33 | |
34 | - protected function _migrate_old_row($old_row) |
|
35 | - { |
|
36 | - // foreach row that has an evt_id ..let's create an equivalent entry in the new event_messages_template table to link the message template to the event (since EVT_ID is no longer referenced in esp_message_template_groups ) |
|
37 | - global $wpdb; |
|
38 | - if ($old_row['EVT_ID'] > 0) { |
|
39 | - // let's get the EVT for this id so we can update the custom name on the old row. |
|
40 | - $event_name = 'Custom Template for ' . $wpdb->get_var( |
|
41 | - $wpdb->prepare( |
|
42 | - "SELECT post_title from $wpdb->posts WHERE ID = %d", |
|
43 | - absint( |
|
44 | - $old_row['EVT_ID'] |
|
45 | - ) |
|
46 | - ) |
|
47 | - ); |
|
34 | + protected function _migrate_old_row($old_row) |
|
35 | + { |
|
36 | + // foreach row that has an evt_id ..let's create an equivalent entry in the new event_messages_template table to link the message template to the event (since EVT_ID is no longer referenced in esp_message_template_groups ) |
|
37 | + global $wpdb; |
|
38 | + if ($old_row['EVT_ID'] > 0) { |
|
39 | + // let's get the EVT for this id so we can update the custom name on the old row. |
|
40 | + $event_name = 'Custom Template for ' . $wpdb->get_var( |
|
41 | + $wpdb->prepare( |
|
42 | + "SELECT post_title from $wpdb->posts WHERE ID = %d", |
|
43 | + absint( |
|
44 | + $old_row['EVT_ID'] |
|
45 | + ) |
|
46 | + ) |
|
47 | + ); |
|
48 | 48 | |
49 | - // update name |
|
50 | - $updated = $wpdb->update( |
|
51 | - $this->_old_table, |
|
52 | - ['MTP_name' => $event_name], |
|
53 | - ['GRP_ID' => (int) $old_row['GRP_ID']], |
|
54 | - ['%s'], |
|
55 | - ['%d'] |
|
56 | - ); |
|
49 | + // update name |
|
50 | + $updated = $wpdb->update( |
|
51 | + $this->_old_table, |
|
52 | + ['MTP_name' => $event_name], |
|
53 | + ['GRP_ID' => (int) $old_row['GRP_ID']], |
|
54 | + ['%s'], |
|
55 | + ['%d'] |
|
56 | + ); |
|
57 | 57 | |
58 | - $inserted = $wpdb->insert( |
|
59 | - $this->_emt_table, |
|
60 | - [ |
|
61 | - 'EVT_ID' => (int) $old_row['EVT_ID'], |
|
62 | - 'GRP_ID' => (int) $old_row['GRP_ID'], |
|
63 | - ], |
|
64 | - ['%d', '%d'] |
|
65 | - ); |
|
58 | + $inserted = $wpdb->insert( |
|
59 | + $this->_emt_table, |
|
60 | + [ |
|
61 | + 'EVT_ID' => (int) $old_row['EVT_ID'], |
|
62 | + 'GRP_ID' => (int) $old_row['GRP_ID'], |
|
63 | + ], |
|
64 | + ['%d', '%d'] |
|
65 | + ); |
|
66 | 66 | |
67 | - if (false === $updated) { |
|
68 | - $this->add_error( |
|
69 | - sprintf( |
|
70 | - esc_html__("Error in updating the row in %s setting 'MTP_name = %s", 'event_espresso'), |
|
71 | - $this->_old_table, |
|
72 | - $event_name |
|
73 | - ) |
|
74 | - ); |
|
75 | - } |
|
67 | + if (false === $updated) { |
|
68 | + $this->add_error( |
|
69 | + sprintf( |
|
70 | + esc_html__("Error in updating the row in %s setting 'MTP_name = %s", 'event_espresso'), |
|
71 | + $this->_old_table, |
|
72 | + $event_name |
|
73 | + ) |
|
74 | + ); |
|
75 | + } |
|
76 | 76 | |
77 | - if (false === $inserted) { |
|
78 | - $this->add_error( |
|
79 | - sprintf( |
|
80 | - esc_html__( |
|
81 | - "Error in inserting a row into setting EVT_ID = %d and GRP_ID = %d", |
|
82 | - "event_espresso" |
|
83 | - ), |
|
84 | - $this->_emt_table, |
|
85 | - $old_row['EVT_ID'], |
|
86 | - $old_row['GRP_ID'] |
|
87 | - ) |
|
88 | - ); |
|
89 | - } |
|
90 | - } |
|
91 | - } |
|
77 | + if (false === $inserted) { |
|
78 | + $this->add_error( |
|
79 | + sprintf( |
|
80 | + esc_html__( |
|
81 | + "Error in inserting a row into setting EVT_ID = %d and GRP_ID = %d", |
|
82 | + "event_espresso" |
|
83 | + ), |
|
84 | + $this->_emt_table, |
|
85 | + $old_row['EVT_ID'], |
|
86 | + $old_row['GRP_ID'] |
|
87 | + ) |
|
88 | + ); |
|
89 | + } |
|
90 | + } |
|
91 | + } |
|
92 | 92 | } |
@@ -25,8 +25,8 @@ discard block |
||
25 | 25 | { |
26 | 26 | global $wpdb; |
27 | 27 | $this->_pretty_name = esc_html__('Event Message Templates', 'event_espresso'); |
28 | - $this->_old_table = $wpdb->prefix . "esp_message_template_group"; |
|
29 | - $this->_emt_table = $wpdb->prefix . "esp_event_message_template"; |
|
28 | + $this->_old_table = $wpdb->prefix."esp_message_template_group"; |
|
29 | + $this->_emt_table = $wpdb->prefix."esp_event_message_template"; |
|
30 | 30 | parent::__construct(); |
31 | 31 | } |
32 | 32 | |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | global $wpdb; |
38 | 38 | if ($old_row['EVT_ID'] > 0) { |
39 | 39 | // let's get the EVT for this id so we can update the custom name on the old row. |
40 | - $event_name = 'Custom Template for ' . $wpdb->get_var( |
|
40 | + $event_name = 'Custom Template for '.$wpdb->get_var( |
|
41 | 41 | $wpdb->prepare( |
42 | 42 | "SELECT post_title from $wpdb->posts WHERE ID = %d", |
43 | 43 | absint( |
@@ -8,39 +8,39 @@ |
||
8 | 8 | class EE_DMS_4_3_0_question_option_order extends EE_Data_Migration_Script_Stage_Table |
9 | 9 | { |
10 | 10 | |
11 | - public function __construct() |
|
12 | - { |
|
13 | - global $wpdb; |
|
14 | - $this->_pretty_name = esc_html__("Question Options", "event_espresso"); |
|
15 | - $this->_old_table = $wpdb->prefix . "esp_question_option"; |
|
16 | - parent::__construct(); |
|
17 | - } |
|
11 | + public function __construct() |
|
12 | + { |
|
13 | + global $wpdb; |
|
14 | + $this->_pretty_name = esc_html__("Question Options", "event_espresso"); |
|
15 | + $this->_old_table = $wpdb->prefix . "esp_question_option"; |
|
16 | + parent::__construct(); |
|
17 | + } |
|
18 | 18 | |
19 | 19 | |
20 | - protected function _migrate_old_row($old_row) |
|
21 | - { |
|
22 | - // foreach question_group_question entry with this QST_ID, we want to set its |
|
23 | - // QSG_order equal to this question's QST_order |
|
24 | - global $wpdb; |
|
25 | - $updated = $wpdb->update( |
|
26 | - $this->_old_table, |
|
27 | - ['QSO_order' => $old_row['QSO_ID']], |
|
28 | - ['QSO_ID' => $old_row['QSO_ID']], |
|
29 | - ['%d'], // QSO_order |
|
30 | - ['%d'] // QSO_ID |
|
31 | - ); |
|
32 | - if (false === $updated) { |
|
33 | - $this->add_error( |
|
34 | - sprintf( |
|
35 | - esc_html__( |
|
36 | - "Error in updating table %s setting QSO_order = %d where QSO_ID = %d", |
|
37 | - 'event_espresso' |
|
38 | - ), |
|
39 | - $this->_old_table, |
|
40 | - $old_row['QSO_ID'], |
|
41 | - $old_row['QSO_ID'] |
|
42 | - ) |
|
43 | - ); |
|
44 | - } |
|
45 | - } |
|
20 | + protected function _migrate_old_row($old_row) |
|
21 | + { |
|
22 | + // foreach question_group_question entry with this QST_ID, we want to set its |
|
23 | + // QSG_order equal to this question's QST_order |
|
24 | + global $wpdb; |
|
25 | + $updated = $wpdb->update( |
|
26 | + $this->_old_table, |
|
27 | + ['QSO_order' => $old_row['QSO_ID']], |
|
28 | + ['QSO_ID' => $old_row['QSO_ID']], |
|
29 | + ['%d'], // QSO_order |
|
30 | + ['%d'] // QSO_ID |
|
31 | + ); |
|
32 | + if (false === $updated) { |
|
33 | + $this->add_error( |
|
34 | + sprintf( |
|
35 | + esc_html__( |
|
36 | + "Error in updating table %s setting QSO_order = %d where QSO_ID = %d", |
|
37 | + 'event_espresso' |
|
38 | + ), |
|
39 | + $this->_old_table, |
|
40 | + $old_row['QSO_ID'], |
|
41 | + $old_row['QSO_ID'] |
|
42 | + ) |
|
43 | + ); |
|
44 | + } |
|
45 | + } |
|
46 | 46 | } |
@@ -12,7 +12,7 @@ |
||
12 | 12 | { |
13 | 13 | global $wpdb; |
14 | 14 | $this->_pretty_name = esc_html__("Question Options", "event_espresso"); |
15 | - $this->_old_table = $wpdb->prefix . "esp_question_option"; |
|
15 | + $this->_old_table = $wpdb->prefix."esp_question_option"; |
|
16 | 16 | parent::__construct(); |
17 | 17 | } |
18 | 18 |