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