How to clear database after a regular interval
Hello geeks, Most of the drupal modules has test site programmed to clear database after a regular interval, i would like to know how it works. I want to do the same for drupal quiz module demo site, The demo site has been hosted at bluehost which has cpanel where i have options to write my own cron and run it, but i have no idea on how to use it for this purpose. Any suggestions and criticisms regarding this will be appreciated. -- Thanks a lot ----------------------------------------- http://ubuntuslave.blogspot.com/
Write a module that implements hook_cron(). 2009/3/7 sivaji j.g <sivaji2009@gmail.com>
Hello geeks,
Most of the drupal modules has test site programmed to clear database after a regular interval, i would like to know how it works. I want to do the same for drupal quiz module demo site, The demo site has been hosted at bluehost which has cpanel where i have options to write my own cron and run it, but i have no idea on how to use it for this purpose. Any suggestions and criticisms regarding this will be appreciated.
-- Thanks a lot ----------------------------------------- http://ubuntuslave.blogspot.com/
Depends on what exactly you want to clear. If you just need to empty the user/node tables or reset the site theme, it's fairly straight-forward - just put a few "DELETE" statements in the hook_cron implementation. Re-installing the entire site would be tricky to do via a module inside the site itself ("cutting off the branch you're sitting on"). In that case, you would be better served by a batch script started by a separate cron-job outside the Drupal site. Robrecht Jacques wrote:
Write a module that implements hook_cron().
2009/3/7 sivaji j.g <sivaji2009@gmail.com <mailto:sivaji2009@gmail.com>>
Hello geeks,
Most of the drupal modules has test site programmed to clear database after a regular interval, i would like to know how it works. I want to do the same for drupal quiz module demo site, The demo site has been hosted at bluehost which has cpanel where i have options to write my own cron and run it, but i have no idea on how to use it for this purpose. Any suggestions and criticisms regarding this will be appreciated.
-- Thanks a lot ----------------------------------------- http://ubuntuslave.blogspot.com/
-- eternity lies ahead of us, and behind. have you drunk your fill? * * * PGP: http://ermarian.net/downloads/0x27CA5C74 XMPP: arancaytar.ilyaran@gmail.com AOL: 282026638 @icq / RealArancaytar @aim URL: http://ermarian.net
On Sat, Mar 7, 2009 at 1:55 PM, Arancaytar Ilyaran < arancaytar.ilyaran@gmail.com> wrote:
Depends on what exactly you want to clear. If you just need to empty the user/node tables or reset the site theme, it's fairly straight-forward - just put a few "DELETE" statements in the hook_cron implementation.
If you take this approach, and you use MySQL like most Drupal sites do, then use TRUNCATE on the tables. It is much faster and less resource intensive. Would not matter if you only have a small amount of data, but will matter for larger amounts.
Re-installing the entire site would be tricky to do via a module inside the site itself ("cutting off the branch you're sitting on"). In that case, you would be better served by a batch script started by a separate cron-job outside the Drupal site.
Robrecht Jacques wrote:
Write a module that implements hook_cron().
2009/3/7 sivaji j.g <sivaji2009@gmail.com <mailto:sivaji2009@gmail.com>>
Hello geeks,
Most of the drupal modules has test site programmed to clear database after a regular interval, i would like to know how it works. I want to do the same for drupal quiz module demo site, The demo site has been hosted at bluehost which has cpanel where i have options to write my own cron and run it, but i have no idea on how to use it for this purpose. Any suggestions and criticisms regarding this will be appreciated.
-- Thanks a lot ----------------------------------------- http://ubuntuslave.blogspot.com/
-- eternity lies ahead of us, and behind. have you drunk your fill? * * * PGP: http://ermarian.net/downloads/0x27CA5C74 XMPP: arancaytar.ilyaran@gmail.com AOL: 282026638 @icq / RealArancaytar @aim URL: http://ermarian.net
-- Khalid M. Baheyeldin 2bits.com, Inc. http://2bits.com Drupal optimization, development, customization and consulting. Simplicity is prerequisite for reliability. -- Edsger W.Dijkstra Simplicity is the ultimate sophistication. -- Leonardo da Vinci
Re-installing the entire site would be tricky to do via a module inside the site itself ("cutting off the branch you're sitting on"). In that case, you would be better served by a batch script started by a separate cron-job outside the Drupal site.
This is exactly what Demo module (http://drupal.org/project/demo) does. 1) Install the module. 2) Create a snapshot of your clean demo site. 3) Configure the reset interval and setup cron (see http://drupal.org/cron). - and/or - Enable the "Reset site" block, which allows users to reset the site manually. 4) Profit. Demo module is also a great way to - take arbitrary snapshots during site building and development (for testing potential modules to install, re-configuration, automated processes, data imports, safety backups before running update.php, etc) or - test module update paths (from 6.x-1.x to 6.x-2.x) or - even test entire upgrade paths (5.x to 6.x). Rob Loach even went ahead and created a Demo installation profile (http://drupal.org/project/demo_profile), which may be an alternative to regular installation profiles in certain use-cases. sun
On Sun, Mar 8, 2009 at 1:10 AM, Daniel F. Kudwien <news@unleashedmind.com>wrote:
This is exactly what Demo module (http://drupal.org/project/demo) does.
thanks to all, let me try this module . -- Thanks a lot ----------------------------------------- http://ubuntuslave.blogspot.com/
Use the demo module: http://drupal.org/project/demo Jamie Holly http://www.intoxination.net http://www.hollyit.net sivaji j.g wrote:
Hello geeks,
Most of the drupal modules has test site programmed to clear database after a regular interval, i would like to know how it works. I want to do the same for drupal quiz module demo site, The demo site has been hosted at bluehost which has cpanel where i have options to write my own cron and run it, but i have no idea on how to use it for this purpose. Any suggestions and criticisms regarding this will be appreciated.
-- Thanks a lot ----------------------------------------- http://ubuntuslave.blogspot.com/
participants (6)
-
Arancaytar Ilyaran -
Daniel F. Kudwien -
Jamie Holly -
Khalid Baheyeldin -
Robrecht Jacques -
sivaji j.g