Open mikkohopia opened 7 years ago
We don't have a "template" site or stage of the sites where they could "reset to". Databases or files cannot be deleted and reinstalled automatically because the original admin passwords or site admin emails are not stored anywhere.
This issue needs more implementation design.
Is this issue still relevant today amongst our customers? We do provide wp-shadow-reset
(and most likely wp-shadow-pull
in the future) so do we actually need a "factory reset" button for production?
I have not missed this feature recently. So I think this is not that important feature anymore.
This set of commands resets the site pretty close to the right-after-install state.
TAKE BACKUP!
wp-backup
Run the following commands to empty content from DB, delete plugins, themes and uploads and to reinstall default theme and plugins:
echo "truncate table wp_posts; truncate table wp_comments; truncate table wp_commentmeta; truncate table wp_links; truncate table wp_terms; truncate table wp_termmeta;" | mysql
cd ~/htdocs/wp-content
rm -rf themes/*
wp theme install --activate twentyseventeen
rm -rf plugins/*
wp plugin install auto-post-thumbnail google-analytics-dashboard-for-wp
rm -rf uploads/*
wp-purge-cache
The users are not removed and WordPress widgets are stored in wp_options table which we probably don't want to delete.
This became now possible for new sites thanks to the saving of the /data/db/*.sql.orig files then deploying new sites (thanks to @l3ku).
Note that if relying on /data/db/*.sql.orig
files, this feature will never work for old sites. The functionality should probably first check the existence of those types of files, and only load the site reset UI if such original database file exists.
Seravo's Customer Success team reported that there are cases, where this would be helpful.
More information about the reset process: https://help.seravo.com/article/63-resetting-your-site-to-an-empty-wordpress-installation
The page linked above in English is outdated. A easier method is documented at https://help.seravo.fi/article/194-wordpress-sivuston-tyhjentaminen-kokonaan and the Seravo Plugin could maybe trigger it, but I am not sure how the execution would complete as importing the old database would delete sessions and throw user out from wp-admin anyway and so on.
Button to reset the site to the default install. The button should be in "safe" place and maybe ask password confirmation before reseting the site. I use my mikkohopia.fi site as a demo environment for new projects so this feature would be handy.