1 config.inc public ConfigFileStorage::initializeStorage()

Create a configuration directory, if it does not already exist, and ensure it is writable by the site. Additionally, protect it with a .htaccess file.

Return value

bool: TRUE on success, FALSE in case of an error.

Throws

ConfigStorageException

Overrides ConfigStorageInterface::initializeStorage

File

core/includes/config.inc, line 1288
This is the API for configuration storage.

Class

ConfigFileStorage
Defines the file storage controller.

Code

public function initializeStorage() {
  if (!file_prepare_directory($this->directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS)) {
    throw new ConfigStorageException(format_string('The directory <code>@directory</code> could not be created or could not be made writable.', array(
      '@directory' => $this->directory,
    )));
  }
  // No need to create htaccess files if not running Apache.
  if (backdrop_is_apache()) {
    file_save_htaccess($this->directory);
  }
}