I have a demo WordPress site that showcases a plugin I created. The plugin lets users interact with content from the front-end and could potentially result in a nightmare of content bloat over time. I'd like to periodically roll back the entire WordPress database to a specific date or backup on a weekly basis. I have looked for plugins that do this - there are auto backup plugins, but I couldn't find any auto restore plugins. I know this is possible because I've seen it done on various other WordPress demo sites in the past.
First take a SQL dump of the database in the state you want it. Then you'd write a script that accomplishes the following:
Put the WP install into maintenance mode by creating a file in wp-content with the filename
.maintenanceand contents "Briefly unavailable for scheduled maintenance. Check back in a minute." (or your preferred text)
Drop all the tables and recreate them from your SQL dump.
Finally hook your script to a cron job in the interval you're looking for. It's best if this script runs completely independently of WP using a system cron job, because there are fewer moving parts and things that could go wrong than if you're trying to do it from within a running WP environment.