Skip to content

Commit 2ac4568

Browse files
Make is_text_col's search case-insensitive for sqlite support (#177)
When using wp-sqlite-db as the back end for WordPress, wpcli's `search-replace` command fails because wp-sqlite-db returns text column types as `TEXT`, and wpcli search-replace checks whether a column is textual in `is_text_col` with `strpos` for "text" or "varchar". If this were `stripos` instead of `strpos` then this problem would be resolved, which would be nice, and I don't believe there would be any backward compatibility implications. So, here's a one-character PR :-) (Of course, sqlite as backend isn't actually supported, but this is a fairly small change which should make things better for that without affecting the mainline code. I've also proposed aaemnnosttv/wp-sqlite-db#56 to wp-sqlite-db to have that return lowercase "text" for column types as well, thus hopefully fixing the problem at both ends.)
1 parent 819c028 commit 2ac4568

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Search_Replace_Command.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,7 @@ private static function get_columns( $table ) {
712712

713713
private static function is_text_col( $type ) {
714714
foreach ( array( 'text', 'varchar' ) as $token ) {
715-
if ( false !== strpos( $type, $token ) ) {
715+
if ( false !== stripos( $type, $token ) ) {
716716
return true;
717717
}
718718
}

0 commit comments

Comments
 (0)