Skip to content

Commit 5708001

Browse files
authored
Merge pull request #11 from NamelessCoder/hotfix/allow-empty-data-sets
[BUGFIX] Ignore empty data sets
2 parents 37f1cf3 + a414c6d commit 5708001

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Command/SiteImportCommandController.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function fromFileCommand($file)
4141
$conn->truncate($config['table']);
4242
$this->outputLine('Emptied database table "' . $config['table'] . '"');
4343
}
44-
foreach ($config['entries'] as $entry) {
44+
foreach ($config['entries'] ?? [] as $entry) {
4545
if ($mode === 'update' && isset($entry['uid'])) {
4646
$identifiers = ['uid' => $entry['uid']];
4747
if ($conn->count('uid', $config['table'], $identifiers)) {
@@ -67,7 +67,7 @@ public function fromFileCommand($file)
6767
$conn->exec_TRUNCATEquery($config['table']);
6868
$this->outputLine('Emptied database table "' . $config['table'] . '"');
6969
}
70-
foreach ($config['entries'] as $entry) {
70+
foreach ($config['entries'] ?? [] as $entry) {
7171
if ($mode === 'update' && isset($entry['uid'])) {
7272
$condition = sprintf('uid = %d', $entry['uid']);
7373
if ($conn->exec_SELECTcountRows('uid', $config['table'], $condition)) {

0 commit comments

Comments
 (0)