diff --git a/core/includes/install.inc b/core/includes/install.inc index c9fd75d..8ab1360 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); + file_prepare_directory($config_directory, FILE_CREATE_DIRECTORY); + if (!is_dir($config_directory)) { + 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; } /** diff --git a/core/modules/system/system.install b/core/modules/system/system.install index 69044a1..36e478d 100644 --- a/core/modules/system/system.install +++ b/core/modules/system/system.install @@ -534,16 +534,11 @@ function system_requirements($phase) { // Check the config directory if it is defined in settings.php. If it isn't // defined, the installer will create a valid config directory later, but // during runtime we must always display an error. - if (!empty($GLOBALS['config_directories'])) { - foreach ($GLOBALS['config_directories'] as $type => $directory) { - $directories[] = config_get_config_directory($type); - } - } - elseif ($phase != 'install') { + if (empty($GLOBALS['config_directories']) && $phase == 'install') { $requirements['config directories'] = array( 'title' => t('Configuration directories'), 'value' => t('Not present'), - 'description' => t('Your %file file must define the $config_directories variable as an array containing the name of a directories in which configuration files can be written.', array('%file' => $site_path . '/settings.php')), + 'description' => t('Your %file file must define the $config_directories variable as an array containing the name of a directories in which configuration files can be read or written.', array('%file' => $site_path . '/settings.php')), 'severity' => REQUIREMENT_ERROR, ); }