You are here

protected function FileStorage::ensureStorage in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Config/FileStorage.php \Drupal\Core\Config\FileStorage::ensureStorage()

Check if the directory exists and create it if not.

1 call to FileStorage::ensureStorage()
FileStorage::write in core/lib/Drupal/Core/Config/FileStorage.php
Writes configuration data to the storage.

File

core/lib/Drupal/Core/Config/FileStorage.php, line 69
Contains \Drupal\Core\Config\FileStorage.

Class

FileStorage
Defines the file storage.

Namespace

Drupal\Core\Config

Code

protected function ensureStorage() {
  $dir = $this
    ->getCollectionDirectory();
  $success = file_prepare_directory($dir, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS);

  // Only create .htaccess file in root directory.
  if ($dir == $this->directory) {
    $success = $success && file_save_htaccess($this->directory, TRUE, TRUE);
  }
  if (!$success) {
    throw new StorageException('Failed to create config directory ' . $dir);
  }
  return $this;
}