wp-cli / search-replace-command

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

operate on files too - important for plugins that cache or generate code #140

Closed ghost closed 10 months ago

ghost commented 4 years ago

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 or home option. Then later when you update the siteurl or home, 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.

Problems or weirdness:

danielbachhuber commented 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.