1 bootstrap.inc conf_path($require_settings = TRUE, $reset = FALSE)

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 sites/sites.php for examples on how the URL is converted to a directory.

Parameters

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 Backdrop 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.

Return value

The path of the matching directory.

See also

settings.php

File

core/includes/bootstrap.inc, line 569
Functions that need to be loaded on every Backdrop request.

Code

function conf_path($require_settings = TRUE, $reset = FALSE) {
  $conf = &backdrop_static(__FUNCTION__, '');

  if ($conf && !$reset) {
    return $conf;
  }

  $script_name = $_SERVER['SCRIPT_NAME'];
  if (!$script_name) {
    $script_name = $_SERVER['SCRIPT_FILENAME'];
  }
  $http_host = $_SERVER['HTTP_HOST'];
  $conf = find_conf_path($http_host, $script_name, $require_settings);
  return $conf;
}