fix lint issues

This commit is contained in:
Michael Pretty 2023-03-17 15:27:28 -04:00
parent 00bf0760be
commit 2e3057052f
1 changed files with 1 additions and 2 deletions

View File

@ -1846,7 +1846,7 @@ function wc_update_343_cleanup_foreign_keys() {
$create_table_sql = $wpdb->get_var( "SHOW CREATE TABLE {$wpdb->prefix}wc_download_log", 1 ); $create_table_sql = $wpdb->get_var( "SHOW CREATE TABLE {$wpdb->prefix}wc_download_log", 1 );
if ( ! empty( $create_table_sql ) ) { if ( ! empty( $create_table_sql ) ) {
// Extract and remove the foreign key constraints matching %wc_download_log_ib% // Extract and remove the foreign key constraints matching %wc_download_log_ib%.
if ( preg_match_all( '/CONSTRAINT `([^`]*wc_download_log_ib[^`]*)` FOREIGN KEY/', $create_table_sql, $matches ) && ! empty( $matches[1] ) ) { if ( preg_match_all( '/CONSTRAINT `([^`]*wc_download_log_ib[^`]*)` FOREIGN KEY/', $create_table_sql, $matches ) && ! empty( $matches[1] ) ) {
foreach ( $matches[1] as $foreign_key_name ) { foreach ( $matches[1] as $foreign_key_name ) {
$wpdb->query( "ALTER TABLE {$wpdb->prefix}wc_download_log DROP FOREIGN KEY `{$foreign_key_name}`" ); // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared $wpdb->query( "ALTER TABLE {$wpdb->prefix}wc_download_log DROP FOREIGN KEY `{$foreign_key_name}`" ); // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared
@ -2445,7 +2445,6 @@ function wc_update_700_remove_download_log_fk() {
$create_table_sql = $wpdb->get_var( "SHOW CREATE TABLE {$wpdb->prefix}wc_download_log", 1 ); $create_table_sql = $wpdb->get_var( "SHOW CREATE TABLE {$wpdb->prefix}wc_download_log", 1 );
if ( ! empty( $create_table_sql ) ) { if ( ! empty( $create_table_sql ) ) {
// Extract the foreign key constraints
if ( preg_match_all( '/CONSTRAINT `([^`]*)` FOREIGN KEY/', $create_table_sql, $matches ) && ! empty( $matches[1] ) ) { if ( preg_match_all( '/CONSTRAINT `([^`]*)` FOREIGN KEY/', $create_table_sql, $matches ) && ! empty( $matches[1] ) ) {
foreach ( $matches[1] as $foreign_key_name ) { foreach ( $matches[1] as $foreign_key_name ) {
$wpdb->query( "ALTER TABLE {$wpdb->prefix}wc_download_log DROP FOREIGN KEY `{$foreign_key_name}`" ); // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared $wpdb->query( "ALTER TABLE {$wpdb->prefix}wc_download_log DROP FOREIGN KEY `{$foreign_key_name}`" ); // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared