Skip to content

Commit bea87da

Browse files
committed
Add whitespace and adapt alignment
1 parent c291c6b commit bea87da

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/Search_Replace_Command.php

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -321,8 +321,10 @@ public function __invoke( $args, $assoc_args ) {
321321

322322
if ( $this->export_handle ) {
323323
fwrite( $this->export_handle, "\nDROP TABLE IF EXISTS $table_sql;\n" );
324+
324325
// phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- escaped through self::esc_sql_ident
325326
$row = $wpdb->get_row( "SHOW CREATE TABLE $table_sql", ARRAY_N );
327+
326328
fwrite( $this->export_handle, $row[1] . ";\n" );
327329
list( $table_report, $total_rows ) = $this->php_export_table( $table, $old, $new );
328330
if ( $this->report ) {
@@ -368,8 +370,10 @@ public function __invoke( $args, $assoc_args ) {
368370
if ( ! $php_only && ! $this->regex ) {
369371
$col_sql = self::esc_sql_ident( $col );
370372
$wpdb->last_error = '';
373+
371374
// phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- escaped through self::esc_sql_ident
372-
$serial_row = $wpdb->get_row( "SELECT * FROM $table_sql WHERE $col_sql REGEXP '^[aiO]:[1-9]' LIMIT 1" );
375+
$serial_row = $wpdb->get_row( "SELECT * FROM $table_sql WHERE $col_sql REGEXP '^[aiO]:[1-9]' LIMIT 1" );
376+
373377
// When the regex triggers an error, we should fall back to PHP
374378
if ( false !== strpos( $wpdb->last_error, 'ERROR 1139' ) ) {
375379
$serial_row = true;
@@ -522,8 +526,10 @@ private function php_handle_col( $col, $primary_keys, $table, $old, $new ) {
522526
$col_sql = self::esc_sql_ident( $col );
523527
$where = $this->regex ? '' : " WHERE $col_sql" . $wpdb->prepare( ' LIKE BINARY %s', '%' . self::esc_like( $old ) . '%' );
524528
$primary_keys_sql = implode( ',', self::esc_sql_ident( $primary_keys ) );
529+
525530
// phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- escaped through self::esc_sql_ident
526-
$rows = $wpdb->get_results( "SELECT {$primary_keys_sql} FROM {$table_sql} {$where}" );
531+
$rows = $wpdb->get_results( "SELECT {$primary_keys_sql} FROM {$table_sql} {$where}" );
532+
527533
foreach ( $rows as $keys ) {
528534
$where_sql = '';
529535
foreach ( (array) $keys as $k => $v ) {
@@ -532,8 +538,10 @@ private function php_handle_col( $col, $primary_keys, $table, $old, $new ) {
532538
}
533539
$where_sql .= self::esc_sql_ident( $k ) . ' = ' . self::esc_sql_value( $v );
534540
}
541+
535542
// phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- escaped through self::esc_sql_ident
536543
$col_value = $wpdb->get_var( "SELECT {$col_sql} FROM {$table_sql} WHERE {$where_sql}" );
544+
537545
if ( '' === $col_value ) {
538546
continue;
539547
}
@@ -648,8 +656,10 @@ private static function get_columns( $table ) {
648656
$text_columns = array();
649657
$all_columns = array();
650658
$suppress_errors = $wpdb->suppress_errors();
659+
651660
// phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- escaped through self::esc_sql_ident
652-
$results = $wpdb->get_results( "DESCRIBE $table_sql" );
661+
$results = $wpdb->get_results( "DESCRIBE $table_sql" );
662+
653663
if ( ! empty( $results ) ) {
654664
foreach ( $results as $col ) {
655665
if ( 'PRI' === $col->Key ) {
@@ -791,6 +801,7 @@ private function log_sql_diff( $col, $primary_keys, $table, $old, $new ) {
791801

792802
// phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- escaped through self::esc_sql_ident
793803
$results = $wpdb->get_results( $wpdb->prepare( "SELECT {$primary_keys_sql}{$col_sql} FROM {$table_sql} WHERE {$col_sql} LIKE BINARY %s", '%' . self::esc_like( $old ) . '%' ), ARRAY_N );
804+
794805
if ( empty( $results ) ) {
795806
return 0;
796807
}

0 commit comments

Comments
 (0)