wp-cli / search-replace-command

Searches/replaces strings in the database.
MIT License
57 stars 45 forks source link

Make is_text_col's search case-insensitive for sqlite support #177

Closed stuartlangridge closed 1 year ago

stuartlangridge commented 1 year ago

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 https://github.com/aaemnnosttv/wp-sqlite-db/pull/56 to wp-sqlite-db to have that return lowercase "text" for column types as well, thus hopefully fixing the problem at both ends.)