Completed
Branch BUG/4.10-migrations-fails (beba67)
by
unknown
16:56 queued 08:55
created
services/admin/registrations/list_table/page_header/DateFilterHeader.php 1 patch
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -23,58 +23,58 @@
 block discarded – undo
23 23
 class DateFilterHeader extends AdminPageHeaderDecorator
24 24
 {
25 25
 
26
-    /**
27
-     * @var EEM_Datetime $datetime_model
28
-     */
29
-    private $datetime_model;
26
+	/**
27
+	 * @var EEM_Datetime $datetime_model
28
+	 */
29
+	private $datetime_model;
30 30
 
31 31
 
32
-    /**
33
-     * DateFilterHeader constructor.
34
-     *
35
-     * @param RequestInterface $request
36
-     * @param EEM_Datetime     $datetime_model
37
-     */
38
-    public function __construct(RequestInterface $request, EEM_Datetime $datetime_model)
39
-    {
40
-        parent::__construct($request);
41
-        $this->datetime_model = $datetime_model;
42
-    }
32
+	/**
33
+	 * DateFilterHeader constructor.
34
+	 *
35
+	 * @param RequestInterface $request
36
+	 * @param EEM_Datetime     $datetime_model
37
+	 */
38
+	public function __construct(RequestInterface $request, EEM_Datetime $datetime_model)
39
+	{
40
+		parent::__construct($request);
41
+		$this->datetime_model = $datetime_model;
42
+	}
43 43
 
44 44
 
45
-    /**
46
-     * @param string $text
47
-     * @return string
48
-     * @throws EE_Error
49
-     * @throws InvalidDataTypeException
50
-     * @throws InvalidInterfaceException
51
-     * @throws InvalidArgumentException
52
-     * @throws ReflectionException
53
-     * @since 4.10.2.p
54
-     */
55
-    public function getHeaderText($text = '')
56
-    {
57
-        $DTT_ID = $this->request->getRequestParam('DTT_ID');
58
-        $DTT_ID = $this->request->getRequestParam('datetime_id', $DTT_ID);
59
-        $DTT_ID = absint($DTT_ID);
60
-        if ($DTT_ID) {
61
-            $datetime = $this->datetime_model->get_one_by_ID($DTT_ID);
62
-            if ($datetime instanceof EE_Datetime && $text !== '') {
63
-                // remove the closing h3 heading tag if it exists
64
-                $text = str_replace(
65
-                    '</h3>',
66
-                    '',
67
-                    $text
68
-                );
69
-                $text .= '&nbsp; &nbsp; ';
70
-                $text .= '<span class="drk-grey-text">';
71
-                $text .= '<span class="dashicons dashicons-calendar"></span>';
72
-                $text .= $datetime->name();
73
-                $text .= ' ( ' . $datetime->start_date() . ' )';
74
-                $text .= '</span></h3>';
75
-            }
76
-        }
45
+	/**
46
+	 * @param string $text
47
+	 * @return string
48
+	 * @throws EE_Error
49
+	 * @throws InvalidDataTypeException
50
+	 * @throws InvalidInterfaceException
51
+	 * @throws InvalidArgumentException
52
+	 * @throws ReflectionException
53
+	 * @since 4.10.2.p
54
+	 */
55
+	public function getHeaderText($text = '')
56
+	{
57
+		$DTT_ID = $this->request->getRequestParam('DTT_ID');
58
+		$DTT_ID = $this->request->getRequestParam('datetime_id', $DTT_ID);
59
+		$DTT_ID = absint($DTT_ID);
60
+		if ($DTT_ID) {
61
+			$datetime = $this->datetime_model->get_one_by_ID($DTT_ID);
62
+			if ($datetime instanceof EE_Datetime && $text !== '') {
63
+				// remove the closing h3 heading tag if it exists
64
+				$text = str_replace(
65
+					'</h3>',
66
+					'',
67
+					$text
68
+				);
69
+				$text .= '&nbsp; &nbsp; ';
70
+				$text .= '<span class="drk-grey-text">';
71
+				$text .= '<span class="dashicons dashicons-calendar"></span>';
72
+				$text .= $datetime->name();
73
+				$text .= ' ( ' . $datetime->start_date() . ' )';
74
+				$text .= '</span></h3>';
75
+			}
76
+		}
77 77
 
78
-        return $text;
79
-    }
78
+		return $text;
79
+	}
80 80
 }
Please login to merge, or discard this patch.
services/admin/registrations/list_table/page_header/EventFilterHeader.php 1 patch
Indentation   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -24,63 +24,63 @@
 block discarded – undo
24 24
 class EventFilterHeader extends AdminPageHeaderDecorator
25 25
 {
26 26
 
27
-    /**
28
-     * @var EEM_Event $event_model
29
-     */
30
-    private $event_model;
27
+	/**
28
+	 * @var EEM_Event $event_model
29
+	 */
30
+	private $event_model;
31 31
 
32 32
 
33
-    /**
34
-     * EventFilterHeader constructor.
35
-     *
36
-     * @param RequestInterface $request
37
-     * @param EEM_Event        $event_model
38
-     */
39
-    public function __construct(RequestInterface $request, EEM_Event $event_model)
40
-    {
41
-        parent::__construct($request);
42
-        $this->event_model = $event_model;
43
-    }
33
+	/**
34
+	 * EventFilterHeader constructor.
35
+	 *
36
+	 * @param RequestInterface $request
37
+	 * @param EEM_Event        $event_model
38
+	 */
39
+	public function __construct(RequestInterface $request, EEM_Event $event_model)
40
+	{
41
+		parent::__construct($request);
42
+		$this->event_model = $event_model;
43
+	}
44 44
 
45 45
 
46
-    /**
47
-     * @param string $text
48
-     * @return string
49
-     * @throws EE_Error
50
-     * @throws InvalidDataTypeException
51
-     * @throws InvalidInterfaceException
52
-     * @throws InvalidArgumentException
53
-     * @throws ReflectionException
54
-     * @since 4.10.2.p
55
-     */
56
-    public function getHeaderText($text = '')
57
-    {
58
-        $EVT_ID = $this->request->getRequestParam('EVT_ID');
59
-        $EVT_ID = $this->request->getRequestParam('event_id', $EVT_ID);
60
-        $EVT_ID = absint($EVT_ID);
61
-        if ($EVT_ID) {
62
-            $event = $this->event_model->get_one_by_ID($EVT_ID);
63
-            if ($event instanceof EE_Event) {
64
-                $text .= sprintf(
65
-                    /* translators: %s: <h3>  %s: <a href>Event Name</a>  %s: </h3> */
66
-                    // phpcs:ignore WordPress.WP.I18n.UnorderedPlaceholdersText
67
-                    esc_html__('%s Viewing registrations for the event: %s%s', 'event_espresso'),
68
-                    '<h3 style="line-height:1.5em;">',
69
-                    '&nbsp;<a href="'
70
-                    . EE_Admin_Page::add_query_args_and_nonce(
71
-                        array(
72
-                            'action' => 'edit',
73
-                            'post'   => $event->ID(),
74
-                        ),
75
-                        EVENTS_ADMIN_URL
76
-                    )
77
-                    . '">'
78
-                    . $event->get('EVT_name')
79
-                    . '</a>&nbsp;',
80
-                    '</h3>'
81
-                );
82
-            }
83
-        }
84
-        return $text;
85
-    }
46
+	/**
47
+	 * @param string $text
48
+	 * @return string
49
+	 * @throws EE_Error
50
+	 * @throws InvalidDataTypeException
51
+	 * @throws InvalidInterfaceException
52
+	 * @throws InvalidArgumentException
53
+	 * @throws ReflectionException
54
+	 * @since 4.10.2.p
55
+	 */
56
+	public function getHeaderText($text = '')
57
+	{
58
+		$EVT_ID = $this->request->getRequestParam('EVT_ID');
59
+		$EVT_ID = $this->request->getRequestParam('event_id', $EVT_ID);
60
+		$EVT_ID = absint($EVT_ID);
61
+		if ($EVT_ID) {
62
+			$event = $this->event_model->get_one_by_ID($EVT_ID);
63
+			if ($event instanceof EE_Event) {
64
+				$text .= sprintf(
65
+					/* translators: %s: <h3>  %s: <a href>Event Name</a>  %s: </h3> */
66
+					// phpcs:ignore WordPress.WP.I18n.UnorderedPlaceholdersText
67
+					esc_html__('%s Viewing registrations for the event: %s%s', 'event_espresso'),
68
+					'<h3 style="line-height:1.5em;">',
69
+					'&nbsp;<a href="'
70
+					. EE_Admin_Page::add_query_args_and_nonce(
71
+						array(
72
+							'action' => 'edit',
73
+							'post'   => $event->ID(),
74
+						),
75
+						EVENTS_ADMIN_URL
76
+					)
77
+					. '">'
78
+					. $event->get('EVT_name')
79
+					. '</a>&nbsp;',
80
+					'</h3>'
81
+				);
82
+			}
83
+		}
84
+		return $text;
85
+	}
86 86
 }
Please login to merge, or discard this patch.
admin/registrations/list_table/page_header/AttendeeFilterHeader.php 1 patch
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -20,56 +20,56 @@
 block discarded – undo
20 20
 class AttendeeFilterHeader extends AdminPageHeaderDecorator
21 21
 {
22 22
 
23
-    /**
24
-     * @var EEM_Attendee $attendee_model
25
-     */
26
-    private $attendee_model;
23
+	/**
24
+	 * @var EEM_Attendee $attendee_model
25
+	 */
26
+	private $attendee_model;
27 27
 
28 28
 
29
-    /**
30
-     * AttendeeFilterHeader constructor.
31
-     *
32
-     * @param RequestInterface $request
33
-     * @param EEM_Attendee     $attendee_model
34
-     */
35
-    public function __construct(RequestInterface $request, EEM_Attendee $attendee_model)
36
-    {
37
-        parent::__construct($request);
38
-        $this->attendee_model = $attendee_model;
39
-    }
29
+	/**
30
+	 * AttendeeFilterHeader constructor.
31
+	 *
32
+	 * @param RequestInterface $request
33
+	 * @param EEM_Attendee     $attendee_model
34
+	 */
35
+	public function __construct(RequestInterface $request, EEM_Attendee $attendee_model)
36
+	{
37
+		parent::__construct($request);
38
+		$this->attendee_model = $attendee_model;
39
+	}
40 40
 
41 41
 
42
-    /**
43
-     * @param string $text
44
-     * @return string
45
-     * @throws EE_Error
46
-     * @since 4.10.2.p
47
-     */
48
-    public function getHeaderText($text = '')
49
-    {
50
-        $ATT_ID = $this->request->getRequestParam('ATT_ID');
51
-        $ATT_ID = $this->request->getRequestParam('attendee_id', $ATT_ID);
52
-        $ATT_ID = absint($ATT_ID);
53
-        if ($ATT_ID) {
54
-            $attendee = $this->attendee_model->get_one_by_ID($ATT_ID);
55
-            if ($attendee instanceof EE_Attendee) {
56
-                $text .= sprintf(
57
-                    esc_html__(
58
-                        '%1$s Viewing registrations for %2$s%3$s',
59
-                        'event_espresso'
60
-                    ),
61
-                    '<h3 style="line-height:1.5em;">',
62
-                    '<a href="' . EE_Admin_Page::add_query_args_and_nonce(
63
-                        array(
64
-                            'action' => 'edit_attendee',
65
-                            'post'   => $ATT_ID,
66
-                        ),
67
-                        REG_ADMIN_URL
68
-                    ) . '">' . $attendee->full_name() . '</a>',
69
-                    '</h3>'
70
-                );
71
-            }
72
-        }
73
-        return $text;
74
-    }
42
+	/**
43
+	 * @param string $text
44
+	 * @return string
45
+	 * @throws EE_Error
46
+	 * @since 4.10.2.p
47
+	 */
48
+	public function getHeaderText($text = '')
49
+	{
50
+		$ATT_ID = $this->request->getRequestParam('ATT_ID');
51
+		$ATT_ID = $this->request->getRequestParam('attendee_id', $ATT_ID);
52
+		$ATT_ID = absint($ATT_ID);
53
+		if ($ATT_ID) {
54
+			$attendee = $this->attendee_model->get_one_by_ID($ATT_ID);
55
+			if ($attendee instanceof EE_Attendee) {
56
+				$text .= sprintf(
57
+					esc_html__(
58
+						'%1$s Viewing registrations for %2$s%3$s',
59
+						'event_espresso'
60
+					),
61
+					'<h3 style="line-height:1.5em;">',
62
+					'<a href="' . EE_Admin_Page::add_query_args_and_nonce(
63
+						array(
64
+							'action' => 'edit_attendee',
65
+							'post'   => $ATT_ID,
66
+						),
67
+						REG_ADMIN_URL
68
+					) . '">' . $attendee->full_name() . '</a>',
69
+					'</h3>'
70
+				);
71
+			}
72
+		}
73
+		return $text;
74
+	}
75 75
 }
Please login to merge, or discard this patch.
4_10_0_stages/EE_DMS_4_10_0_Event_Question_Group.dmsstage.php 2 patches
Indentation   +126 added lines, -126 removed lines patch added patch discarded remove patch
@@ -14,134 +14,134 @@
 block discarded – undo
14 14
 
15 15
 
16 16
 
17
-    /**
18
-     * Just initializes the status of the migration
19
-     */
20
-    public function __construct()
21
-    {
22
-        global $wpdb;
23
-        $this->_pretty_name = __('Event-Question Group Relations', 'event_espresso');
24
-        $this->_old_table = $wpdb->prefix.'esp_event_question_group';
25
-        $this->_extra_where_sql = "WHERE EQG_primary = 0 AND EQG_additional=0";
26
-        parent::__construct();
27
-    }
17
+	/**
18
+	 * Just initializes the status of the migration
19
+	 */
20
+	public function __construct()
21
+	{
22
+		global $wpdb;
23
+		$this->_pretty_name = __('Event-Question Group Relations', 'event_espresso');
24
+		$this->_old_table = $wpdb->prefix.'esp_event_question_group';
25
+		$this->_extra_where_sql = "WHERE EQG_primary = 0 AND EQG_additional=0";
26
+		parent::__construct();
27
+	}
28 28
 
29 29
 
30
-    /**
31
-     * Removes the duplicate event_question_group rows that only had EQG_primary=0. Now we just have one row
32
-     * joining event-to-question-groups with two columns: EQG_primary and EQG_additional, indicating which question
33
-     * groups apply to which category of registrant.
34
-     * @param array $event_question_group an associative array where keys are column names and values are their values.
35
-     * @return null
36
-     */
37
-    protected function _migrate_old_row($event_question_group)
38
-    {
39
-        if (isset($event_question_group['EVT_ID'], $event_question_group['QSG_ID'])) {
40
-            global $wpdb;
41
-            // If the question group was also for primary attendees, we should just update that row.
42
-            // And we delete this row.
43
-            // Updating all the rows could be slow on massive DBs, so do the slow selection first, then a quick delete
44
-            // in order to avoid locking the table for too long.
45
-            $ids_to_update = $wpdb->get_col(
46
-                $wpdb->prepare(
47
-                    'SELECT EQG_ID FROM ' . $this->_old_table . ' WHERE EQG_primary=1 AND EVT_ID=%d AND QSG_ID=%d',
48
-                    $event_question_group['EQG_ID'],
49
-                    $event_question_group['QSG_ID']
50
-                )
51
-            );
52
-            if ($ids_to_update) {
53
-                $success = $wpdb->query(
54
-                    'UPDATE '
55
-                    . $this->_old_table
56
-                    . ' SET EQG_additional=1 WHERE EQG_IN IN ('
57
-                    . implode(',', array_map('intval', $ids_to_update))
58
-                    . ') LIMIT ' . count($ids_to_update)
59
-                );
60
-            }
61
-            if ($success) {
62
-                // Ok it's confirmed: the question group WAS for the primary attendee group too. So
63
-                // now we just need to delete this row.
64
-                $successful_delete = $wpdb->delete(
65
-                    $this->_old_table,
66
-                    [
67
-                        'EQG_ID' => $event_question_group['EQG_ID']
68
-                    ],
69
-                    ['%d']
70
-                );
71
-                if (! $successful_delete) {
72
-                    $this->add_error(
73
-                        sprintf(
74
-                            __('Could not delete old event-question group relation row "%1$s" because "%2$s"', 'event_espresso'),
75
-                            wp_json_encode($event_question_group),
76
-                            $wpdb->last_error
77
-                        )
78
-                    );
79
-                }
80
-            } else {
81
-                // Oh, the question group actually was NOT for the primary attendee. So we just need to update this row
82
-                // Let's do the selection separately from the deletion, this way we don't lock big tables for too long.
83
-                $ids_to_update2 = $wpdb->get_col(
84
-                    $wpdb->prepare(
85
-                        'SELECT EQG_ID FROM '
86
-                        . $this->_old_table
87
-                        . ' WHERE EVT_ID=%d AND QSG_ID=%d',
88
-                        $event_question_group['EQG_ID'],
89
-                        $event_question_group['QSG_ID']
90
-                    )
91
-                );
92
-                if ($ids_to_update2) {
93
-                    $wpdb->query(
94
-                        'UPDATE '
95
-                        . $this->_old_table
96
-                        . ' SET EQG_additional=1 WHERE EQG_ID IN ('
97
-                        . $ids_to_update2
98
-                        . ') LIMIT ' . count($ids_to_update2)
99
-                    );
100
-                }
101
-            }
102
-        }
103
-    }
30
+	/**
31
+	 * Removes the duplicate event_question_group rows that only had EQG_primary=0. Now we just have one row
32
+	 * joining event-to-question-groups with two columns: EQG_primary and EQG_additional, indicating which question
33
+	 * groups apply to which category of registrant.
34
+	 * @param array $event_question_group an associative array where keys are column names and values are their values.
35
+	 * @return null
36
+	 */
37
+	protected function _migrate_old_row($event_question_group)
38
+	{
39
+		if (isset($event_question_group['EVT_ID'], $event_question_group['QSG_ID'])) {
40
+			global $wpdb;
41
+			// If the question group was also for primary attendees, we should just update that row.
42
+			// And we delete this row.
43
+			// Updating all the rows could be slow on massive DBs, so do the slow selection first, then a quick delete
44
+			// in order to avoid locking the table for too long.
45
+			$ids_to_update = $wpdb->get_col(
46
+				$wpdb->prepare(
47
+					'SELECT EQG_ID FROM ' . $this->_old_table . ' WHERE EQG_primary=1 AND EVT_ID=%d AND QSG_ID=%d',
48
+					$event_question_group['EQG_ID'],
49
+					$event_question_group['QSG_ID']
50
+				)
51
+			);
52
+			if ($ids_to_update) {
53
+				$success = $wpdb->query(
54
+					'UPDATE '
55
+					. $this->_old_table
56
+					. ' SET EQG_additional=1 WHERE EQG_IN IN ('
57
+					. implode(',', array_map('intval', $ids_to_update))
58
+					. ') LIMIT ' . count($ids_to_update)
59
+				);
60
+			}
61
+			if ($success) {
62
+				// Ok it's confirmed: the question group WAS for the primary attendee group too. So
63
+				// now we just need to delete this row.
64
+				$successful_delete = $wpdb->delete(
65
+					$this->_old_table,
66
+					[
67
+						'EQG_ID' => $event_question_group['EQG_ID']
68
+					],
69
+					['%d']
70
+				);
71
+				if (! $successful_delete) {
72
+					$this->add_error(
73
+						sprintf(
74
+							__('Could not delete old event-question group relation row "%1$s" because "%2$s"', 'event_espresso'),
75
+							wp_json_encode($event_question_group),
76
+							$wpdb->last_error
77
+						)
78
+					);
79
+				}
80
+			} else {
81
+				// Oh, the question group actually was NOT for the primary attendee. So we just need to update this row
82
+				// Let's do the selection separately from the deletion, this way we don't lock big tables for too long.
83
+				$ids_to_update2 = $wpdb->get_col(
84
+					$wpdb->prepare(
85
+						'SELECT EQG_ID FROM '
86
+						. $this->_old_table
87
+						. ' WHERE EVT_ID=%d AND QSG_ID=%d',
88
+						$event_question_group['EQG_ID'],
89
+						$event_question_group['QSG_ID']
90
+					)
91
+				);
92
+				if ($ids_to_update2) {
93
+					$wpdb->query(
94
+						'UPDATE '
95
+						. $this->_old_table
96
+						. ' SET EQG_additional=1 WHERE EQG_ID IN ('
97
+						. $ids_to_update2
98
+						. ') LIMIT ' . count($ids_to_update2)
99
+					);
100
+				}
101
+			}
102
+		}
103
+	}
104 104
 
105
-    /**
106
-     * Gets the rows for the existing table that shouldn't exist in 4.10.
107
-     * Specifically the rows where EQG_primary=false and EQG_additional=false.
108
-     * Gotcha: because the migration is REMOVING rows as it goes, we shouldn't use the offset.
109
-     *
110
-     * @global wpdb $wpdb
111
-     * @param int   $limit
112
-     * @return array of arrays like $wpdb->get_results($sql, ARRAY_A)
113
-     */
114
-    protected function _get_rows($limit)
115
-    {
116
-        global $wpdb;
117
-        $query = "SELECT * FROM {$this->_old_table} {$this->_extra_where_sql} " . $wpdb->prepare(
118
-            "LIMIT %d",
119
-            $limit
120
-        );
121
-        return $wpdb->get_results($query, ARRAY_A);
122
-    }
105
+	/**
106
+	 * Gets the rows for the existing table that shouldn't exist in 4.10.
107
+	 * Specifically the rows where EQG_primary=false and EQG_additional=false.
108
+	 * Gotcha: because the migration is REMOVING rows as it goes, we shouldn't use the offset.
109
+	 *
110
+	 * @global wpdb $wpdb
111
+	 * @param int   $limit
112
+	 * @return array of arrays like $wpdb->get_results($sql, ARRAY_A)
113
+	 */
114
+	protected function _get_rows($limit)
115
+	{
116
+		global $wpdb;
117
+		$query = "SELECT * FROM {$this->_old_table} {$this->_extra_where_sql} " . $wpdb->prepare(
118
+			"LIMIT %d",
119
+			$limit
120
+		);
121
+		return $wpdb->get_results($query, ARRAY_A);
122
+	}
123 123
 
124
-    /**
125
-     * Slight departure from the normal procedure here: because this removes rows from the DB, we need to ensure
126
-     * we count the records first, then do the migration.
127
-     *
128
-     * @param int $num_items
129
-     * @return int number of items ACTUALLY migrated
130
-     */
131
-    public function _migration_step($num_items = 50)
132
-    {
133
-        // Count the items right away. This migration step will be removing those rows, so we need to count them
134
-        // right away to get an accurate count.
135
-        $this->count_records_to_migrate();
136
-        $rows = $this->_get_rows($num_items);
137
-        $items_actually_migrated = 0;
138
-        foreach ($rows as $old_row) {
139
-            $this->_migrate_old_row($old_row);
140
-            $items_actually_migrated++;
141
-        }
142
-        if ($this->count_records_migrated() + $items_actually_migrated >= $this->count_records_to_migrate()) {
143
-            $this->set_completed();
144
-        }
145
-        return $items_actually_migrated;
146
-    }
124
+	/**
125
+	 * Slight departure from the normal procedure here: because this removes rows from the DB, we need to ensure
126
+	 * we count the records first, then do the migration.
127
+	 *
128
+	 * @param int $num_items
129
+	 * @return int number of items ACTUALLY migrated
130
+	 */
131
+	public function _migration_step($num_items = 50)
132
+	{
133
+		// Count the items right away. This migration step will be removing those rows, so we need to count them
134
+		// right away to get an accurate count.
135
+		$this->count_records_to_migrate();
136
+		$rows = $this->_get_rows($num_items);
137
+		$items_actually_migrated = 0;
138
+		foreach ($rows as $old_row) {
139
+			$this->_migrate_old_row($old_row);
140
+			$items_actually_migrated++;
141
+		}
142
+		if ($this->count_records_migrated() + $items_actually_migrated >= $this->count_records_to_migrate()) {
143
+			$this->set_completed();
144
+		}
145
+		return $items_actually_migrated;
146
+	}
147 147
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
             // in order to avoid locking the table for too long.
45 45
             $ids_to_update = $wpdb->get_col(
46 46
                 $wpdb->prepare(
47
-                    'SELECT EQG_ID FROM ' . $this->_old_table . ' WHERE EQG_primary=1 AND EVT_ID=%d AND QSG_ID=%d',
47
+                    'SELECT EQG_ID FROM '.$this->_old_table.' WHERE EQG_primary=1 AND EVT_ID=%d AND QSG_ID=%d',
48 48
                     $event_question_group['EQG_ID'],
49 49
                     $event_question_group['QSG_ID']
50 50
                 )
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
                     . $this->_old_table
56 56
                     . ' SET EQG_additional=1 WHERE EQG_IN IN ('
57 57
                     . implode(',', array_map('intval', $ids_to_update))
58
-                    . ') LIMIT ' . count($ids_to_update)
58
+                    . ') LIMIT '.count($ids_to_update)
59 59
                 );
60 60
             }
61 61
             if ($success) {
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
                     ],
69 69
                     ['%d']
70 70
                 );
71
-                if (! $successful_delete) {
71
+                if ( ! $successful_delete) {
72 72
                     $this->add_error(
73 73
                         sprintf(
74 74
                             __('Could not delete old event-question group relation row "%1$s" because "%2$s"', 'event_espresso'),
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
                         . $this->_old_table
96 96
                         . ' SET EQG_additional=1 WHERE EQG_ID IN ('
97 97
                         . $ids_to_update2
98
-                        . ') LIMIT ' . count($ids_to_update2)
98
+                        . ') LIMIT '.count($ids_to_update2)
99 99
                     );
100 100
                 }
101 101
             }
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
     protected function _get_rows($limit)
115 115
     {
116 116
         global $wpdb;
117
-        $query = "SELECT * FROM {$this->_old_table} {$this->_extra_where_sql} " . $wpdb->prepare(
117
+        $query = "SELECT * FROM {$this->_old_table} {$this->_extra_where_sql} ".$wpdb->prepare(
118 118
             "LIMIT %d",
119 119
             $limit
120 120
         );
Please login to merge, or discard this patch.