Fix notice in Item::deleteById

This commit is contained in:
Hypolite Petovan 2018-07-01 14:46:45 -04:00
parent 18eb13a598
commit 633a71ec97

View file

@ -801,8 +801,10 @@ class Item extends BaseObject
// If item has attachments, drop them // If item has attachments, drop them
foreach (explode(", ", $item['attach']) as $attach) { foreach (explode(", ", $item['attach']) as $attach) {
preg_match("|attach/(\d+)|", $attach, $matches); preg_match("|attach/(\d+)|", $attach, $matches);
if (is_array($matches) && count($matches) > 1) {
dba::delete('attach', ['id' => $matches[1], 'uid' => $item['uid']]); dba::delete('attach', ['id' => $matches[1], 'uid' => $item['uid']]);
} }
}
// Delete tags that had been attached to other items // Delete tags that had been attached to other items
self::deleteTagsFromItem($item); self::deleteTagsFromItem($item);