FileStorage::ensureStorage

protected FileStorage::ensureStorage()

Check if the directory exists and create it if not.

File

core/lib/Drupal/Core/Config/FileStorage.php, line 77

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;
}
doc_Drupal
2016-10-29 09:13:40
Comments
Leave a Comment

Please login to continue.