diff options
author | Andrew Dolgov <[email protected]> | 2021-02-24 09:56:59 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2021-02-24 09:56:59 +0300 |
commit | e6505b7d83b8e25b507923feb86dc10e7954ed58 (patch) | |
tree | 7a6907ab65e44069cad90e2f48f9e17d9a0d073c /classes/feeds.php | |
parent | d6203bf3508ba77e3943ddc412eb562edb327f22 (diff) |
_cats_of: only request parents if needed
Diffstat (limited to 'classes/feeds.php')
-rwxr-xr-x | classes/feeds.php | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/classes/feeds.php b/classes/feeds.php index 453c8aa0f..631ba0915 100755 --- a/classes/feeds.php +++ b/classes/feeds.php @@ -1794,8 +1794,9 @@ class Feeds extends Handler_Protected { $feeds_qmarks = arr_qmarks($feeds); - $sth = $pdo->prepare("SELECT DISTINCT cat_id FROM ttrss_feeds - WHERE id IN ($feeds_qmarks)"); + $sth = $pdo->prepare("SELECT DISTINCT cat_id, fc.parent_cat FROM ttrss_feeds f LEFT JOIN ttrss_feed_categories fc + ON (fc.id = f.cat_id) + WHERE f.id IN ($feeds_qmarks)"); $sth->execute($feeds); $rv = []; @@ -1803,7 +1804,7 @@ class Feeds extends Handler_Protected { if ($row = $sth->fetch()) { array_push($rv, (int)$row["cat_id"]); - if ($with_parents) + if ($with_parents && $row["parent_cat"]) $rv = array_merge($rv, self::_get_parent_cats($row["cat_id"], $owner_uid)); } |