Skip to content

Commit

Permalink
Merge pull request #1090 from webflo/si-keep-config
Browse files Browse the repository at this point in the history
Keep configuration in confgis dirs during installation
  • Loading branch information
weitzman committed Jan 9, 2015
2 parents 73dda9a + b9b559a commit 9dd205d
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions commands/core/site_install.drush.inc
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ function site_install_drush_command() {
'example-value' => 'directory_name',
),
'writable' => 'Make CMI and other dirs writable by both web and CLI users. Suitable for non Prod environments.',
'keep-config' => 'Keep CMI directories untouched. This preserves existing configuration.'
),
'examples' => array(
'drush site-install expert --locale=uk' => '(Re)install using the expert install profile. Set default language to Ukrainian.',
Expand All @@ -63,6 +64,7 @@ function site_install_drush_help_alter(&$command) {
}
else {
unset($command['options']['writable']);
unset($command['options']['keep-config']);
}
}
}
Expand Down Expand Up @@ -108,7 +110,7 @@ function drush_core_pre_site_install($profile = NULL) {
$sitesfile = "sites/sites.php";
$default = realpath($alias_record['root'] . '/sites/default');
$sitesfile_write = drush_drupal_major_version() >= 8 && $conf_path != $default && !file_exists($sitesfile);

if (!file_exists($settingsfile)) {
$msg[] = dt('create a @settingsfile file', array('@settingsfile' => $settingsfile));
}
Expand Down Expand Up @@ -212,9 +214,11 @@ function drush_core_pre_site_install($profile = NULL) {
$directories['staging'] = $files . '/' . $directories[2];
}

foreach ($directories as $directory) {
if (file_exists($directory)) {
drush_delete_dir_contents($directory, TRUE);
if (drush_get_option('keep-config', FALSE) == FALSE) {
foreach ($directories as $directory) {
if (file_exists($directory)) {
drush_delete_dir_contents($directory, TRUE);
}
}
}

Expand Down

0 comments on commit 9dd205d

Please sign in to comment.