We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f33ff07 commit 0d31bd4Copy full SHA for 0d31bd4
1 file changed
includes/Services/TicketSnoozeService.php
@@ -167,17 +167,16 @@ public static function get_snoozed_ticket_ids(): array
167
global $wpdb;
168
$table = Escalated::table('ticket_meta');
169
170
- // Check if table exists first.
171
- $table_exists = $wpdb->get_var(
172
- $wpdb->prepare('SHOW TABLES LIKE %s', $wpdb->esc_like($table))
173
- );
174
- if (! $table_exists) {
175
- return [];
176
- }
177
-
+ // Suppress errors for the query in case table doesn't exist yet.
+ $suppress = $wpdb->suppress_errors();
178
$rows = $wpdb->get_results(
179
"SELECT ticket_id FROM {$table} WHERE meta_key = 'snoozed_until'"
180
);
+ $wpdb->suppress_errors($suppress);
+
+ if ($wpdb->last_error) {
+ return [];
+ }
181
182
return array_map(fn ($row) => (int) $row->ticket_id, $rows ?: []);
183
}
0 commit comments