Only fetch category when it exists
This commit is contained in:
parent
fb3353d4bd
commit
1f43332a1d
2 changed files with 9 additions and 0 deletions
|
@ -93,6 +93,10 @@ class Item
|
|||
|
||||
$uid = $item['uid'] ?: $uid;
|
||||
|
||||
if (!Post\Category::existsForURIId($item['uri-id'], $uid)) {
|
||||
return [$categories, $folders];
|
||||
}
|
||||
|
||||
foreach (Post\Category::getArrayByURIId($item['uri-id'], $uid, Post\Category::CATEGORY) as $savedFolderName) {
|
||||
if (!empty($item['author-link'])) {
|
||||
$url = $item['author-link'] . "?category=" . rawurlencode($savedFolderName);
|
||||
|
|
|
@ -111,6 +111,11 @@ class Category
|
|||
return array_column($tags, 'name');
|
||||
}
|
||||
|
||||
public static function existsForURIId(int $uri_id, int $uid)
|
||||
{
|
||||
return DBA::exists('post-category', ['uri-id' => $uri_id, 'uid' => $uid]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates an array of files or categories of a given uri-id
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue