From 527e9d02c9802d7e7f8fa9c5fd35871946f1a51f Mon Sep 17 00:00:00 2001 From: Alex Ciobica Date: Tue, 6 Aug 2013 14:33:04 +0300 Subject: [PATCH] Fix search replace reserved column name issues. --- php/commands/search-replace.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/php/commands/search-replace.php b/php/commands/search-replace.php index 41855981..c1e4b007 100644 --- a/php/commands/search-replace.php +++ b/php/commands/search-replace.php @@ -101,10 +101,12 @@ class Search_Replace_Command extends WP_CLI_Command { // We don't want to have to generate thousands of rows when running the test suite $chunk_size = getenv( 'BEHAT_RUN' ) ? 10 : 1000; + $fields = array( $primary_key, $col ); + $fields = array_map( function ($v) { return "`$v`"; }, $fields ); $args = array( 'table' => $table, - 'fields' => array( $primary_key, $col ), - 'where' => $col . ' LIKE "%' . like_escape( esc_sql( $old ) ) . '%"', + 'fields' => $fields, + 'where' => "`$col`" . ' LIKE "%' . like_escape( esc_sql( $old ) ) . '%"', 'chunk_size' => $chunk_size ); -- 2.11.0