wp-cli / ideas

💡 Ideas and feature requests are collected here
40 stars 1 forks source link

Add command to clean and reinstall WordPress, plugins and themes in WP-CLI #182

Open emerson-oliveira opened 11 months ago

emerson-oliveira commented 11 months ago

Feature Request

Use Case and Problem Faced

I'm currently using a series of commands to clean and reinstall WordPress, plugins and themes when necessary. However, this process is manual and can be error-prone. Furthermore, there is no easy way to automate this process using WP-CLI.

Proposed solution

I wish WP-CLI included a command to clean and reinstall WordPress, plugins and themes. This command could be something like wp --allow-root core clean --force, which would remove the wp-admin and wp-includes directories, download the latest version of WordPress, reinstall all plugins and themes, and check the integrity of all the files.

This command would help simplify and automate the cleaning and reinstallation process, making it more efficient and less prone to errors.

Possible Disadvantages

A potential disadvantage of this functionality is that it can be dangerous if used incorrectly, as it could result in data loss. Therefore, it would be important to include appropriate safeguards such as clear warnings and the need for user confirmation before proceeding.

Current Usage Example

Here's an example of how I'm currently doing the cleanup and reinstallation:

rm -rf wp-admin
rm -rf wp-includes
wp --allow-root core download --force --skip-content --locale=pt_BR 
wp --allow-root plugin install $(wp --allow-root plugin list --field=name) --force
wp --allow-root theme install $(wp --allow-root theme list --field=name) --force
wp --allow-root plugin verify-checksums --all
danielbachhuber commented 11 months ago

Thanks for the suggestion, @emerson-oliveira

I moved this idea to our wp-cli/ideas repo. I think it would be best implemented as a community command first.

If you'd like to try your hand at writing such a command, here's a guide to get started: https://make.wordpress.org/cli/handbook/guides/commands-cookbook/