function install_ensure_config_directory

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.0 and is removed from drupal:9.0.0. Use config_get_config_directory() and \Drupal\Core\File\FileSystemInterface::prepareDirectory() instead.

See also

https://www.drupal.org/node/2501187

File

core/includes/install.inc, line 593

Code

function install_ensure_config_directory($type) {
    @trigger_error('install_ensure_config_directory() is deprecated in Drupal 8.1.0 and will be removed before Drupal 9.0.0. Use config_get_config_directory() and \\Drupal\\Core\\File\\FileSystemInterface::prepareDirectory() instead. See https://www.drupal.org/node/2501187.', E_USER_DEPRECATED);
    // The config directory must be defined in settings.php.
    global $config_directories;
    if (!isset($config_directories[$type])) {
        return FALSE;
    }
    else {
        $config_directory = config_get_config_directory($type);
        return \Drupal::service('file_system')->prepareDirectory($config_directory, FileSystemInterface::CREATE_DIRECTORY | FileSystemInterface::MODIFY_PERMISSIONS);
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.