Skip to content

Commit 8883518

Browse files
committed
Use Utils\esc_like() and remove internal esc_like().
1 parent 2d39548 commit 8883518

File tree

2 files changed

+2
-23
lines changed

2 files changed

+2
-23
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"files": [ "db-command.php" ]
2222
},
2323
"require": {
24-
"wp-cli/wp-cli": "*"
24+
"wp-cli/wp-cli": ">=1.5.0"
2525
},
2626
"require-dev": {
2727
"behat/behat": "~2.5"

src/DB_Command.php

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -947,7 +947,7 @@ public function search( $args, $assoc_args ) {
947947
}
948948
} else {
949949
$search_regex = '#' . preg_quote( $search, '#' ) . '#i';
950-
$esc_like_search = '%' . self::esc_like( $search ) . '%';
950+
$esc_like_search = '%' . Utils\esc_like( $search ) . '%';
951951
}
952952

953953
$encoding = null;
@@ -1176,27 +1176,6 @@ private static function is_text_col( $type ) {
11761176
return false;
11771177
}
11781178

1179-
/**
1180-
* Escapes a MySQL string for inclusion in a `LIKE` clause. BC wrapper around different WP versions of this.
1181-
*
1182-
* @param string $old String to escape.
1183-
* @param string Escaped string.
1184-
*/
1185-
private static function esc_like( $old ) {
1186-
global $wpdb;
1187-
1188-
// Remove notices in 4.0 and support backwards compatibility
1189-
if ( method_exists( $wpdb, 'esc_like' ) ) {
1190-
// 4.0
1191-
$old = $wpdb->esc_like( $old );
1192-
} else {
1193-
// 3.9 or less
1194-
$old = like_escape( esc_sql( $old ) );
1195-
}
1196-
1197-
return $old;
1198-
}
1199-
12001179
/**
12011180
* Escapes (backticks) MySQL identifiers (aka schema object names) - i.e. column names, table names, and database/index/alias/view etc names.
12021181
* See https://dev.mysql.com/doc/refman/5.5/en/identifiers.html

0 commit comments

Comments
 (0)