Closed ghost closed 10 months ago
Thanks for the suggestion, @widepath !
wp search-replace
focuses on search/replace within the database. The file system is out of scope.
If someone comes up with a novel solution for filesystem search/replace, we could consider making it available as a different WP-CLI package.
Feature Request
Is your feature request directly related to a specific, existing command? Yes Is your feature request about a new command, or a more general idea? No --- ✅ If you are in the correct location now... --->
Describe your use case and the problem you are facing
A clear and concise description of what you are actually trying to do, and in what way the current version of WP-CLI is not up to the task.
I do believe it would be helpful if wpcli operated on files, as well as the database. There is a very specific and practical use-case for this: plugins that do some kind of caching or code-generation, eg. formidable.
Formidable generates css files and writes them to the file system. This might include urls that reference the current
siteurl
orhome
option. Then later when you update thesiteurl
orhome
, because the host name of the site changed, that css file still references the old hostname.Some plugins have a purge-like feature for caching, but it would be nice if search-replace could dip into the files and fix that problem directly.
Totally open to discussion about this, maybe there's already a solution I don't know about. Would be happy to write this feature if deemed useful to the community.
Describe the solution you'd like
A clear and concise description of what you want to happen. Add any considered drawbacks if you can think of any.
--files
that, when added, also performs a search-replace on all the files underwp-content
wp-content
and for each file with a match, replace all the old with the new then write those changes to the same file.--dry-run
should still apply to this as well.--verbose
will show what was replaced in each file.Problems or weirdness:
[<table>...]
could also be files - if one in the list is a file that exists, then the files search-replace will do that one, instead of the database search-replace