Skip to content

Commit b37d784

Browse files
committed
fix(linker): may add several times a postponed item
Signed-off-by: Thierry Bugier <tbugier@teclib.com>
1 parent deb1e20 commit b37d784

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

inc/linker.class.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public function addObject($originalId, PluginFormcreatorExportableInterface $obj
8080
$this->imported[$object->getType()] = [];
8181
}
8282
if (isset($this->imported[$object->getType()][$originalId])) {
83-
throw new ImportFailureException(sprintf('Attempt to create an already created item "%1$s" with original ID "%2$s"', $object->getType(), $originalId));
83+
throw new ImportFailureException(sprintf('Attempt to create twice the item "%1$s" with original ID "%2$s"', $object->getType(), $originalId));
8484
}
8585
$this->imported[$object->getType()][$originalId] = $object;
8686
$this->progress++;
@@ -156,15 +156,16 @@ public function linkPostponed() {
156156
do {
157157
$postponedCount = 0;
158158
$postponedAgainCount = 0;
159-
foreach ($this->postponed as $itemtype => $postponedItemtypeList) {
159+
foreach ($this->postponed as $itemtype => &$postponedItemtypeList) {
160160
$postponedCount += count($postponedItemtypeList);
161-
$newList = $postponedItemtypeList;
161+
$newList = [];
162162
foreach ($postponedItemtypeList as $originalId => $postponedItem) {
163163
if ($itemtype::import($this, $postponedItem['input'], $postponedItem['relationId']) === false) {
164164
$newList[$originalId] = $postponedItem;
165165
$postponedAgainCount++;
166166
}
167167
}
168+
$postponedItemtypeList = $newList;
168169
}
169170

170171
// If no item was successfully imported, then the import is in a deadlock and fails

0 commit comments

Comments
 (0)