You are here

function boost_cache_expire_all_db in Boost 6

Flushes all expired pages via database lookup.

TODO del empty dirs if enabled

1 call to boost_cache_expire_all_db()
boost_cache_expire_all in ./boost.module
Flushes all expired pages from cache.

File

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

Code

function boost_cache_expire_all_db() {
  global $_boost;
  $list = $files = array();
  if (BOOST_FLUSH_ALL_MULTISITE) {
    $result = db_query("SELECT filename, hash, base_dir FROM {boost_cache} WHERE expire BETWEEN 1 AND %d", BOOST_TIME);
  }
  else {
    $result = db_query("SELECT filename, hash, base_dir FROM {boost_cache} WHERE base_dir = '%s' AND expire BETWEEN 1 AND %d", BOOST_FILE_PATH, BOOST_TIME);
  }
  while ($boost = db_fetch_array($result)) {
    $files[] = $boost;
    if (BOOST_VERBOSE >= 9 && isset($_boost['verbose_option_selected']['boost_cache_expire_all_db_list'])) {
      $list[] = $boost['filename'];
    }
  }
  if (count($files)) {
    $count = boost_cache_kill($files, TRUE);
  }
  if (BOOST_FLUSH_DIR) {

    // TO-DO: del empty dirs.
  }
  if (BOOST_VERBOSE >= 9 && isset($_boost['verbose_option_selected']['boost_cache_expire_all_db_list'])) {
    watchdog('boost', 'Debug: boost_cache_expire_all_db() <br />Following files where flushed: <br />!list', array(
      '!list' => implode('<br />', $list),
    ));
  }
  elseif (BOOST_VERBOSE >= 7 && isset($_boost['verbose_option_selected']['boost_verbose_refined'])) {
    watchdog('boost', 'Debug: boost_cache_expire_all_db() <br />!num files where flushed', array(
      '!num' => $count,
    ));
  }
  return TRUE;
}