W3cubDocs

/Drupal 8

function install_ensure_config_directory

install_ensure_config_directory($type)

Ensures that the config directory exists and is writable, or can be made so.

Parameters

string $type: Type of config directory to return. Drupal core provides 'sync'.

Return value

bool TRUE if the config directory exists and is writable.

Deprecated

in Drupal 8.1.x, will be removed before Drupal 9.0.x. Use config_get_config_directory() and file_prepare_directory() instead.

File

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

Code

function install_ensure_config_directory($type) {
  // The config directory must be defined in settings.php.
  global $config_directories;
  if (!isset($config_directories[$type])) {
    return FALSE;
  }
  // The logic here is similar to that used by system_requirements() for other
  // directories that the installer creates.
  else {
    $config_directory = config_get_config_directory($type);
    return file_prepare_directory($config_directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS);
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!includes!install.inc/function/install_ensure_config_directory/8.1.x