Skip to content

Commit

Permalink
Merge pull request #11 from NamelessCoder/hotfix/allow-empty-data-sets
Browse files Browse the repository at this point in the history
[BUGFIX] Ignore empty data sets
  • Loading branch information
bmack authored Aug 1, 2020
2 parents 37f1cf3 + a414c6d commit 5708001
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Command/SiteImportCommandController.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function fromFileCommand($file)
$conn->truncate($config['table']);
$this->outputLine('Emptied database table "' . $config['table'] . '"');
}
foreach ($config['entries'] as $entry) {
foreach ($config['entries'] ?? [] as $entry) {
if ($mode === 'update' && isset($entry['uid'])) {
$identifiers = ['uid' => $entry['uid']];
if ($conn->count('uid', $config['table'], $identifiers)) {
Expand All @@ -67,7 +67,7 @@ public function fromFileCommand($file)
$conn->exec_TRUNCATEquery($config['table']);
$this->outputLine('Emptied database table "' . $config['table'] . '"');
}
foreach ($config['entries'] as $entry) {
foreach ($config['entries'] ?? [] as $entry) {
if ($mode === 'update' && isset($entry['uid'])) {
$condition = sprintf('uid = %d', $entry['uid']);
if ($conn->exec_SELECTcountRows('uid', $config['table'], $condition)) {
Expand Down

0 comments on commit 5708001

Please sign in to comment.