@@ -12,54 +12,54 @@ |
||
12 | 12 | */ |
13 | 13 | class EE_DMS_5_0_0_Event_Venues extends EE_Data_Migration_Script_Stage_Table |
14 | 14 | { |
15 | - /** |
|
16 | - * @var string |
|
17 | - */ |
|
18 | - private $_event_meta; |
|
15 | + /** |
|
16 | + * @var string |
|
17 | + */ |
|
18 | + private $_event_meta; |
|
19 | 19 | |
20 | 20 | |
21 | - /** |
|
22 | - * Just initializes the status of the migration |
|
23 | - */ |
|
24 | - public function __construct() |
|
25 | - { |
|
26 | - global $wpdb; |
|
27 | - $this->_pretty_name = esc_html__('Event Venue Relations', 'event_espresso'); |
|
28 | - $this->_old_table = $wpdb->prefix . 'esp_event_venue'; |
|
29 | - $this->_event_meta = $wpdb->prefix . 'esp_event_meta'; |
|
30 | - parent::__construct(); |
|
31 | - } |
|
21 | + /** |
|
22 | + * Just initializes the status of the migration |
|
23 | + */ |
|
24 | + public function __construct() |
|
25 | + { |
|
26 | + global $wpdb; |
|
27 | + $this->_pretty_name = esc_html__('Event Venue Relations', 'event_espresso'); |
|
28 | + $this->_old_table = $wpdb->prefix . 'esp_event_venue'; |
|
29 | + $this->_event_meta = $wpdb->prefix . 'esp_event_meta'; |
|
30 | + parent::__construct(); |
|
31 | + } |
|
32 | 32 | |
33 | 33 | |
34 | - /** |
|
35 | - * Copies Venue IDs from `wp_esp_event_venue` to `wp_esp_event_meta` for each Event |
|
36 | - * |
|
37 | - * @param array $old_row an associative array where keys are column names and values are their values. |
|
38 | - * @return null |
|
39 | - */ |
|
40 | - protected function _migrate_old_row($old_row): ?bool |
|
41 | - { |
|
42 | - $EVT_ID = |
|
43 | - isset($old_row['EVT_ID']) |
|
44 | - ? absint($old_row['EVT_ID']) |
|
45 | - : 0; |
|
46 | - $VNU_ID = |
|
47 | - isset($old_row['VNU_ID']) |
|
48 | - ? absint($old_row['VNU_ID']) |
|
49 | - : 0; |
|
50 | - if ($EVT_ID && $VNU_ID) { |
|
51 | - global $wpdb; |
|
52 | - // If the question group was also for primary attendees, we should just update that row. |
|
53 | - // And we delete this row. |
|
54 | - $result = $wpdb->update( |
|
55 | - $this->_event_meta, |
|
56 | - ['VNU_ID' => $VNU_ID], // data |
|
57 | - ['EVT_ID' => $EVT_ID], // where |
|
58 | - ['%d'], // data format |
|
59 | - ['%d'] // where format |
|
60 | - ); |
|
61 | - return filter_var($result, FILTER_VALIDATE_BOOLEAN); |
|
62 | - } |
|
63 | - return false; |
|
64 | - } |
|
34 | + /** |
|
35 | + * Copies Venue IDs from `wp_esp_event_venue` to `wp_esp_event_meta` for each Event |
|
36 | + * |
|
37 | + * @param array $old_row an associative array where keys are column names and values are their values. |
|
38 | + * @return null |
|
39 | + */ |
|
40 | + protected function _migrate_old_row($old_row): ?bool |
|
41 | + { |
|
42 | + $EVT_ID = |
|
43 | + isset($old_row['EVT_ID']) |
|
44 | + ? absint($old_row['EVT_ID']) |
|
45 | + : 0; |
|
46 | + $VNU_ID = |
|
47 | + isset($old_row['VNU_ID']) |
|
48 | + ? absint($old_row['VNU_ID']) |
|
49 | + : 0; |
|
50 | + if ($EVT_ID && $VNU_ID) { |
|
51 | + global $wpdb; |
|
52 | + // If the question group was also for primary attendees, we should just update that row. |
|
53 | + // And we delete this row. |
|
54 | + $result = $wpdb->update( |
|
55 | + $this->_event_meta, |
|
56 | + ['VNU_ID' => $VNU_ID], // data |
|
57 | + ['EVT_ID' => $EVT_ID], // where |
|
58 | + ['%d'], // data format |
|
59 | + ['%d'] // where format |
|
60 | + ); |
|
61 | + return filter_var($result, FILTER_VALIDATE_BOOLEAN); |
|
62 | + } |
|
63 | + return false; |
|
64 | + } |
|
65 | 65 | } |