Posted By

tgbdad on 11/20/08


Tagged

drupal


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

shrop
resting


Clear Drupal 5 Cache


 / Published in: PHP
 

URL: http://drupal.org/node/152983

This might work in Drupal 6, but I haven't tried it.

  1. <?php
  2. /*
  3.  * See http://drupal.org/node/152983 for details!
  4.  */
  5.  
  6. // only allow site administrators to visit this page:
  7. if (!user_access('administer site configuration')) {
  8. drupal_not_found();
  9. }
  10. else {
  11. drupal_clear_css_cache();
  12. $tables = array(
  13. 'cache',
  14. 'cache_content',
  15. 'cache_filter',
  16. 'cache_menu',
  17. 'cache_page',
  18. 'cache_views',
  19. );
  20. foreach ($tables as $table) {
  21. cache_clear_all('*', $table, TRUE);
  22. }
  23. drupal_set_message('Cache cleared.');
  24. drupal_goto('/');
  25. }
  26. ?>

Report this snippet  

You need to login to post a comment.