Returns the appropriate configuration directory.
Returns the configuration path based on the site's hostname, port, and pathname. Uses find_conf_path() to find the current configuration directory. See default.settings.php for examples on how the URL is converted to a directory.
bool $require_settings: Only configuration directories with an existing settings.php file will be recognized. Defaults to TRUE. During initial installation, this is set to FALSE so that Drupal can detect a matching directory, then create a new settings.php file in it.
bool $reset: Force a full search for matching directories even if one had been found previously. Defaults to FALSE.
The path of the matching directory.
function conf_path($require_settings = TRUE, $reset = FALSE) {
$conf_path =& drupal_static(__FUNCTION__, '');
if ($conf_path && !$reset) {
return $conf_path;
}
// Check for a simpletest override.
if ($simpletest_conf_path = _drupal_simpletest_conf_path()) {
$conf_path = $simpletest_conf_path;
return $conf_path;
}
// Otherwise, use the normal $conf_path.
$script_name = $_SERVER['SCRIPT_NAME'];
if (!$script_name) {
$script_name = $_SERVER['SCRIPT_FILENAME'];
}
$http_host = $_SERVER['HTTP_HOST'];
$conf_path = find_conf_path($http_host, $script_name, $require_settings);
return $conf_path;
}