You are here

function boost_cache_delete in Boost 6

Deletes files in the cache.

Parameters

$flush: If true clear the entire cache directory.

2 calls to boost_cache_delete()
boost_cache_clear_all in ./boost.module
Deletes all files currently in the cache.
boost_cache_expire_all_filesystem in ./boost.module
Deletes all expired static files currently in the cache via filesystem.

File

./boost.module, line 2943
Provides static file caching for Drupal text output. Pages, Feeds, ect...

Code

function boost_cache_delete($flush = FALSE) {
  clearstatcache();

  //recreate dirs
  _boost_mkdir_p(BOOST_FILE_PATH);
  _boost_mkdir_p(BOOST_GZIP_FILE_PATH);

  //add in .boost root id file
  _boost_write_file_chmod(BOOST_FILE_PATH . '/' . BOOST_ROOT_FILE, BOOST_FILE_PATH);
  _boost_write_file_chmod(BOOST_GZIP_FILE_PATH . '/' . BOOST_ROOT_FILE, BOOST_FILE_PATH);
  foreach (_boost_copy_file_get_domains(BOOST_PERM_FILE_PATH) as $dir) {
    _boost_write_file_chmod($dir . '/' . BOOST_ROOT_FILE, $dir);
  }
  foreach (_boost_copy_file_get_domains(BOOST_PERM_GZIP_FILE_PATH) as $dir) {
    _boost_write_file_chmod($dir . '/' . BOOST_ROOT_FILE, $dir);
  }

  //Flush Cache
  if (file_exists(BOOST_FILE_PATH)) {
    _boost_rmdir_rf(BOOST_FILE_PATH, $flush, TRUE);
  }
  if (file_exists(BOOST_GZIP_FILE_PATH)) {
    _boost_rmdir_rf(BOOST_GZIP_FILE_PATH, $flush, TRUE);
  }

  //recreate dirs
  _boost_mkdir_p(BOOST_FILE_PATH);
  _boost_mkdir_p(BOOST_GZIP_FILE_PATH);

  //add in .boost root id file
  _boost_write_file_chmod(BOOST_FILE_PATH . '/' . BOOST_ROOT_FILE, BOOST_FILE_PATH);
  _boost_write_file_chmod(BOOST_GZIP_FILE_PATH . '/' . BOOST_ROOT_FILE, BOOST_FILE_PATH);
  foreach (_boost_copy_file_get_domains(BOOST_PERM_FILE_PATH) as $dir) {
    _boost_write_file_chmod($dir . '/' . BOOST_ROOT_FILE, $dir);
  }
  foreach (_boost_copy_file_get_domains(BOOST_PERM_GZIP_FILE_PATH) as $dir) {
    _boost_write_file_chmod($dir . '/' . BOOST_ROOT_FILE, $dir);
  }

  // Make sure cache dir has htaccess rules
  boost_htaccess_cache_dir_put();
}