Update item-uri with guid if given

This commit is contained in:
Michael 2020-04-19 08:34:20 +00:00
parent 66f5e7c0f8
commit 98b3058601

View File

@ -42,13 +42,17 @@ class ItemURI
DBA::insert('item-uri', $fields, true); DBA::insert('item-uri', $fields, true);
} }
$itemuri = DBA::selectFirst('item-uri', ['id'], ['uri' => $uri]); $itemuri = DBA::selectFirst('item-uri', ['id', 'guid'], ['uri' => $uri]);
if (!DBA::isResult($itemuri)) { if (!DBA::isResult($itemuri)) {
// This shouldn't happen // This shouldn't happen
return null; return null;
} }
if (empty($itemuri['guid']) && !empty($fields['guid'])) {
DBA::update('item-uri', ['guid' => $fields['guid']], ['id' => $itemuri['id']]);
}
return $itemuri['id']; return $itemuri['id'];
} }