Skip to content

Commit

Permalink
Compare the sync directory and wipe storage smartly (drush-ops#2637)
Browse files Browse the repository at this point in the history
  • Loading branch information
bircher authored and mikeker committed Aug 4, 2017
1 parent 6c8aa5d commit ee467a9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Commands/config/ConfigExportCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function doExport($options, $destination_dir) {
$storage_filters = $this->getStorageFilters($options);
if (count(glob($destination_dir . '/*')) > 0) {
// Retrieve a list of differences between the active and target configuration (if any).
if ($destination_dir == CONFIG_SYNC_DIRECTORY) {
if ($destination_dir == \config_get_config_directory(CONFIG_SYNC_DIRECTORY)) {
$target_storage = \Drupal::service('config.storage.sync');
}
else {
Expand Down Expand Up @@ -117,12 +117,12 @@ public function doExport($options, $destination_dir) {
return drush_user_abort();
}
// Only delete .yml files, and not .htaccess or .git.
drush_scan_directory($destination_dir, '/\.yml$/', array('.', '..'), 'unlink');
$target_storage->deleteAll();
}

// Write all .yml files.
$source_storage = \Drupal::service('config.storage');
if ($destination_dir == CONFIG_SYNC_DIRECTORY) {
if ($destination_dir == \config_get_config_directory(CONFIG_SYNC_DIRECTORY)) {
$destination_storage = \Drupal::service('config.storage.sync');
}
else {
Expand Down

0 comments on commit ee467a9

Please sign in to comment.