diff --git a/core/includes/install.inc b/core/includes/install.inc index c9fd75d..1c091fd 100644 --- a/core/includes/install.inc +++ b/core/includes/install.inc @@ -505,18 +505,11 @@ function drupal_install_config_directories() { // itself. But if it somehow fails anyway, the installation cannot proceed. // Bail out using a similar error message as in system_requirements(). if (!install_ensure_config_directory(CONFIG_SYNC_DIRECTORY)) { - throw new Exception(t('The directory %directory could not be created or could not be made writable. To proceed with the installation, either create the directory and modify its permissions manually or ensure that the installer has the permissions to create it automatically. For more information, see the online handbook.', array( + throw new Exception(t('The directory %directory could not be created. To proceed with the installation, either create the directory manually or ensure that the installer has the permissions to create it automatically. For more information, see the online handbook.', array( '%directory' => config_get_config_directory(CONFIG_SYNC_DIRECTORY), ':handbook_url' => 'https://www.drupal.org/server-permissions', ))); } - - // Put a README.txt into the sync config directory. This is required so that - // they can later be added to git. Since this directory is auto-created, we - // have to write out the README rather than just adding it to the drupal core - // repo. - $text = 'This directory contains configuration to be imported into your Drupal site. To make this configuration active, visit admin/config/development/configuration/sync.' .' For information about deploying configuration between servers, see https://www.drupal.org/documentation/administer/config'; - file_put_contents(config_get_config_directory(CONFIG_SYNC_DIRECTORY) . '/README.txt', $text); } /** @@ -534,12 +527,25 @@ function install_ensure_config_directory($type) { 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); + $config_directory = config_get_config_directory($type); + $success = file_prepare_directory($config_directory, FILE_CREATE_DIRECTORY); + if (!$success) { + return FALSE; } + + // Put a README.txt into the sync config directory, if possible. This allows + // the directory to be added to git. Since this directory is auto-created, + // we have to write out the README rather than just adding it to the drupal + // core repo. + if ($type === CONFIG_SYNC_DIRECTORY && is_writable($config_directory) && !file_exists($config_directory . '/README.txt')) { + $text = 'This directory contains configuration to be imported into your Drupal site. To make this configuration active, visit admin/config/development/configuration/sync.' .' For information about deploying configuration between servers, see https://www.drupal.org/documentation/administer/config'; + file_put_contents($config_directory . '/README.txt', $text); + } + + return TRUE; } /**