I have a WordPress demo site to let visitors try out some live plugins.
What I want is that the connected MySQL database refreshes every hour. Meaning: Going back to the clean starting state.
So every hour the demo site will be clean and fresh again without any data from demo users.
Is there a query via php that should be running or how can I manage this?
Hope you understand my question.
Many thanks in advance!
UPDATE:
I have create a cronjob and the job gets activated coz I'm receiving an email every time it gets extivated :)
But why is my sql file not executing? Any ideas?
<?php
exec("mysql -u DB-USER -pDB-PASS DB-NAME < /home/users/XXXX/XXXX/yw-cronjobs/clean_demo_db.sql");
$to = 'contact@XXXX.nl';
$subject = 'Demo Cron Executed';
$message = 'Cron job to reset demo has been executed';
$headers = 'From: admin@XXXX.nl' . "\r\n" .
'Reply-To: admin@XXXX.nl' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
?>
When I import the clean_demo_db.sql file in PHPMyAdmin it does what it should...
Am I missing something here?