| @@ -11,10 +11,8 @@ | ||
| 11 | 11 | if ( ! defined( 'ABSPATH' ) ) { |
| 12 | 12 | exit; |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | -// phpcs:disable WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching | |
| 16 | - | |
| 17 | 15 | /** |
| 18 | 16 | * Class Vigilante_Database_Backup |
| 19 | 17 | * |
| 20 | 18 | * Creates downloadable database backups |
| @@ -73,8 +71,9 @@ | ||
| 73 | 71 | 'other' => array(), |
| 74 | 72 | ); |
| 75 | 73 | |
| 76 | 74 | // Get all tables that match the current prefix |
| 75 | + // phpcs:disable WordPress.DB.PreparedSQL.NotPrepared -- %i placeholder requires WP 6.2+, and the sniff reports inside the multiline prepare(). | |
| 77 | 76 | // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching |
| 78 | 77 | $all_tables = $this->wpdb->get_results( |
| 79 | 78 | $this->wpdb->prepare( |
| 80 | 79 | 'SHOW TABLE STATUS LIKE %s', |
| @@ -80,8 +79,9 @@ | ||
| 80 | 79 | 'SHOW TABLE STATUS LIKE %s', |
| 81 | 80 | $this->wpdb->esc_like( $prefix ) . '%' |
| 82 | 81 | ) |
| 83 | 82 | ); |
| 83 | + // phpcs:enable WordPress.DB.PreparedSQL.NotPrepared | |
| 84 | 84 | |
| 85 | 85 | if ( ! $all_tables ) { |
| 86 | 86 | return $tables; |
| 87 | 87 | } |
| @@ -290,8 +290,9 @@ | ||
| 290 | 290 | * @param string $table_name Full table name. |
| 291 | 291 | * @return string|WP_Error SQL for the table. |
| 292 | 292 | */ |
| 293 | 293 | private function dump_table( $table_name ) { |
| 294 | + // phpcs:disable WordPress.DB.PreparedSQL.NotPrepared -- %i placeholder requires WP 6.2+, and the sniff reports inside the multiline prepare(). | |
| 294 | 295 | $sql = ''; |
| 295 | 296 | $sql .= "-- ----------------------------------------------------------\n"; |
| 296 | 297 | $sql .= '-- Table: ' . $table_name . "\n"; |
| 297 | 298 | $sql .= "-- ----------------------------------------------------------\n\n"; |
| @@ -374,8 +375,9 @@ | ||
| 374 | 375 | } |
| 375 | 376 | |
| 376 | 377 | $sql .= "UNLOCK TABLES;\n"; |
| 377 | 378 | } |
| 379 | + // phpcs:enable WordPress.DB.PreparedSQL.NotPrepared | |
| 378 | 380 | |
| 379 | 381 | $sql .= "\n"; |
| 380 | 382 | |
| 381 | 383 | return $sql; |
| @@ -388,8 +390,9 @@ | ||
| 388 | 390 | */ |
| 389 | 391 | private function get_valid_table_names() { |
| 390 | 392 | $prefix = $this->wpdb->prefix; |
| 391 | 393 | |
| 394 | + // phpcs:disable WordPress.DB.PreparedSQL.NotPrepared -- %i placeholder requires WP 6.2+, and the sniff reports inside the multiline prepare(). | |
| 392 | 395 | // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching |
| 393 | 396 | $results = $this->wpdb->get_col( |
| 394 | 397 | $this->wpdb->prepare( |
| 395 | 398 | 'SHOW TABLES LIKE %s', |
| @@ -395,8 +398,9 @@ | ||
| 395 | 398 | 'SHOW TABLES LIKE %s', |
| 396 | 399 | $this->wpdb->esc_like( $prefix ) . '%' |
| 397 | 400 | ) |
| 398 | 401 | ); |
| 402 | + // phpcs:enable WordPress.DB.PreparedSQL.NotPrepared | |
| 399 | 403 | |
| 400 | 404 | return $results ? $results : array(); |
| 401 | 405 | } |
| 402 | 406 | |