function boost_cache_directory in Boost 6
Same name and namespace in other branches
- 5 boost.api.inc \boost_cache_directory()
Returns the full directory path to the static file cache directory.
Parameters
$host: Host name. Example: example.com
$absolute: Give path from system root if true. If false give path from web root.
$root_dir: Cache directory
$normal_dir: Normal directory
7 calls to boost_cache_directory()
- boost_admin_boost_performance_page in ./
boost.admin.inc - Form builder; Displays Boost's configuration page.
- boost_admin_boost_performance_page_validate in ./
boost.admin.inc - validate boost_admin_boost_performance_page form submissions.
- boost_cron in ./
boost.module - Implementation of hook_cron(). Performs periodic actions.
- boost_expire_node in ./
boost.module - Expires a node from the cache; including related pages.
- boost_requirements in ./
boost.install - Implementation of hook_requirements().
File
- ./
boost.module, line 4490 - Provides static file caching for Drupal text output. Pages, Feeds, ect...
Code
function boost_cache_directory($host = NULL, $absolute = TRUE, $root_dir = NULL, $normal_dir = NULL) {
global $base_url;
$temp_base_url = $base_url;
$root_dir = is_null($root_dir) ? BOOST_ROOT_CACHE_DIR : $root_dir;
$normal_dir = is_null($normal_dir) ? BOOST_NORMAL_DIR : $normal_dir;
if ($temp_base_url == "http://") {
if (!BOOST_MULTISITE_SINGLE_DB) {
$temp_base_url = $temp_base_url . str_replace($root_dir . '/', '', variable_get('boost_file_path', boost_cache_directory(NULL, FALSE)));
}
elseif (BOOST_NORMAL_DIR != '' && db_result(db_query("SELECT count(DISTINCT base_dir) FROM {boost_cache}")) == 1) {
$temp_base_url = db_result(db_query("SELECT DISTINCT base_dir FROM {boost_cache}"));
$temp_base_url = $temp_base_url . str_replace($root_dir . '/', '', $base_dir);
$temp_base_url = $temp_base_url . str_replace($normal_dir . '/', '', $base_dir);
}
}
if (@parse_url($temp_base_url) === FALSE) {
//Error has been caught here
if (BOOST_VERBOSE >= 1) {
watchdog('boost', 'base_url is not set in your settings.php file. Please read Important Notes in boosts README.txt file.', array(), WATCHDOG_NOTICE);
}
return FALSE;
}
$parts = parse_url($temp_base_url);
$host = !empty($host) ? $host : $parts['host'];
$host = strtolower($host);
$parts['path'] = isset($parts['path']) ? $parts['path'] : '/';
$subdir = implode('/', array_filter(explode('/', !empty($base_path) ? $base_path : $parts['path'])));
return implode('/', !$absolute ? array_filter(array(
$root_dir,
$normal_dir,
$host,
$subdir,
)) : array_filter(array(
getcwd(),
$root_dir,
$normal_dir,
$host,
$subdir,
)));
}