function install_verify_config_directory

Checks whether a config directory exists and is writable.

This partially duplicates install_ensure_config_directory(), but is required since the installer would create the config directory too early in the installation process otherwise (e.g., when only visiting install.php when there is a settings.php already, but not actually executing the installation).

Parameters

string $type: Type of config directory to return. Drupal core provides 'active' and 'staging'.

Return value

bool TRUE if the config directory exists and is writable.

1 call to install_verify_config_directory()
install_begin_request in drupal/core/includes/install.core.inc
Begins an installation request, modifying the installation state as needed.

File

drupal/core/includes/install.inc, line 322
API functions for installing modules and themes.

Code

function install_verify_config_directory($type) {
  global $config_directories;
  if (!isset($config_directories[$type])) {
    return FALSE;
  }

  // config_get_config_directory() throws an exception when the passed $type
  // does not exist in $config_directories. This can happen if there is a
  // prepared settings.php that defines $config_directories already.
  try {
    $config_directory = config_get_config_directory($type);
    if (is_dir($config_directory) && is_writable($config_directory)) {
      return TRUE;
    }
  } catch (\Exception $e) {
  }
  return FALSE;
}