Skip to content

Commit

Permalink
Merge pull request #5 from thinkshout/3_new_config_crash_alt
Browse files Browse the repository at this point in the history
Issue #3 wrap the test for active storage in an if statement, and add…
  • Loading branch information
mariacha authored Sep 17, 2021
2 parents 9148d46 + 818da32 commit d7e2918
Showing 1 changed file with 24 additions and 8 deletions.
32 changes: 24 additions & 8 deletions src/DistroHelperUpdates.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,30 @@ public function exportConfig($config_name) {
$sync_storage = $this->configStorageSync;
$active_storage = $this->configStorage;

// Find out which config was saved.
$sync_storage->write($config_name, $active_storage->read($config_name));

// Export configuration collections.
foreach ($active_storage->getAllCollectionNames() as $collection) {
$active_collection = $active_storage->createCollection($collection);
$sync_collection = $sync_storage->createCollection($collection);
$sync_collection->write($config_name, $active_collection->read($config_name));
if ($this_file_in_active_storage = $active_storage->read($config_name)) {

// Find out which config was saved.
$sync_storage->write($config_name, $active_storage->read($config_name));

// Export configuration collections.
foreach ($active_storage->getAllCollectionNames() as $collection) {
$active_collection = $active_storage->createCollection($collection);
$sync_collection = $sync_storage->createCollection($collection);
if ($this_file_in_active_storage = $active_collection->read($config_name)) {
$sync_collection->write($config_name, $active_collection->read($config_name));
}
else {
\Drupal::logger('distro_helper')->error(
'Could not write the @directory file. Did it successfully save to the database?',
['@directory' => $sync_collection->getFilePath($config_name)]);
}
}
}
else {
// Log: Could not write $config_name to the config sync directory. Did it successfully save to the database?
\Drupal::logger('distro_helper')->error(
'Could not write the @directory file. Did it successfully save to the database?',
['@directory' => $sync_storage->getFilePath($config_name)]);
}
}

Expand Down

0 comments on commit d7e2918

Please sign in to comment.