? boost-617314.patch Index: boost.admin.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/boost/boost.admin.inc,v retrieving revision 1.1.2.1.2.3.2.96 diff -u -p -r1.1.2.1.2.3.2.96 boost.admin.inc --- boost.admin.inc 28 Oct 2009 04:25:04 -0000 1.1.2.1.2.3.2.96 +++ boost.admin.inc 30 Oct 2009 07:00:34 -0000 @@ -747,13 +747,13 @@ function boost_admin_boost_performance_p // Clear database button $form['clear'] = array( '#type' => 'fieldset', - '#title' => t('Clear Boost\'s Database'), - '#description' => t('Warning: This gives you a clean slate for the boost database, use with caution. If you change the directories or file extensions (in "Boost directories and file extensions"), then clearing the database would be a good idea, but not required.'), + '#title' => t("Clear Boost's Database & File Cache"), + '#description' => t('Warning: This gives you a clean slate for the boost database & file system, use with caution. If you change the directories or file extensions (in "Boost directories and file extensions"), then pressing this button would be a good idea, but not required. If you changed the CSS or JavaScript and wish to push it out, you need to press this button.'), ); $form['clear']['boost_reset'] = array( '#type' => 'submit', - '#value' => t('Reset boost database: !records records', array('!records' => boost_count_db(2))), - '#submit' => array('boost_reset_database_submit'), + '#value' => t('Reset Button - Database Records: !records, Files: !files', array('!records' => boost_count_db(2), '!files' => boost_count_all_files(BOOST_ROOT_CACHE_DIR))), + '#submit' => array('boost_reset_database_file_submit'), ); // Form validation @@ -1082,6 +1082,35 @@ function boost_count_db($all = 0) { } /** + * Count the number of files in a folder + * + * @param string $dir + * Directory name, usually BOOST_ROOT_CACHE_DIR or /cache + */ +function boost_count_all_files($dirname) { + if (is_dir($dirname)) { + $dir_handle = opendir($dirname); + } + if (!$dir_handle) { + return 0; + } + + $files = 0; + while ($file = readdir($dir_handle)) { + if ($file != "." && $file != "..") { + if (!is_dir($dirname . "/" . $file)) { + $files++; + } + else { + $files += boost_count_all_files($dirname . "/" . $file); + } + } + } + closedir($dir_handle); + return $files; +} + +/** * Counts the number of pages in the core cache. */ function boost_count_core_db($all = FALSE) { @@ -1120,9 +1149,9 @@ function boost_clear_expired_cache_submi } /** - * Resets boost database & cache + * Resets boost database & cache directory */ -function boost_reset_database_submit() { +function boost_reset_database_file_submit() { $ignore = variable_get('boost_ignore_flush', 0); $GLOBALS['conf']['boost_ignore_flush'] = 0; if (boost_cache_clear_all()) { @@ -1130,6 +1159,7 @@ function boost_reset_database_submit() { db_query("TRUNCATE {boost_cache_settings}"); db_query("TRUNCATE {boost_cache_relationships}"); db_query("TRUNCATE {boost_crawler}"); + _boost_rmdir_rf(BOOST_ROOT_CACHE_DIR, TRUE, TRUE, TRUE); drupal_set_message(t('Boost: Static page cache & 4 database tables cleared.')); } else { Index: boost.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/boost/boost.module,v retrieving revision 1.3.2.2.2.5.2.210 diff -u -p -r1.3.2.2.2.5.2.210 boost.module --- boost.module 29 Oct 2009 10:38:26 -0000 1.3.2.2.2.5.2.210 +++ boost.module 30 Oct 2009 07:00:35 -0000 @@ -2783,16 +2783,18 @@ function _boost_mkdir_p($pathname, $recu * optional nuke it all if true, otherwise kill only expired files * @param $first * id first call to this function + * @param $nuke + * clear it all, everything, ignore multisite restrictions */ -function _boost_rmdir_rf($dirname, $flush = TRUE, $first = TRUE) { +function _boost_rmdir_rf($dirname, $flush = TRUE, $first = TRUE, $nuke = FALSE) { $empty = TRUE; // Start with an optimistic mindset - if ($first || (!$first && !file_exists($dirname . '/' . BOOST_ROOT_FILE))) { + if ($first || (!$first && ($nuke || !file_exists($dirname . '/' . BOOST_ROOT_FILE)))) { $files = glob($dirname . '/*', GLOB_NOSORT); if ($files) { foreach ($files as $file) { if (is_dir($file)) { - if (!_boost_rmdir_rf($file, $flush, FALSE)) { + if (!_boost_rmdir_rf($file, $flush, FALSE, $nuke)) { $empty = FALSE; } }