_cats_of: only request parents if needed
This commit is contained in:
parent
d6203bf350
commit
e6505b7d83
|
@ -1794,8 +1794,9 @@ class Feeds extends Handler_Protected {
|
||||||
|
|
||||||
$feeds_qmarks = arr_qmarks($feeds);
|
$feeds_qmarks = arr_qmarks($feeds);
|
||||||
|
|
||||||
$sth = $pdo->prepare("SELECT DISTINCT cat_id FROM ttrss_feeds
|
$sth = $pdo->prepare("SELECT DISTINCT cat_id, fc.parent_cat FROM ttrss_feeds f LEFT JOIN ttrss_feed_categories fc
|
||||||
WHERE id IN ($feeds_qmarks)");
|
ON (fc.id = f.cat_id)
|
||||||
|
WHERE f.id IN ($feeds_qmarks)");
|
||||||
$sth->execute($feeds);
|
$sth->execute($feeds);
|
||||||
|
|
||||||
$rv = [];
|
$rv = [];
|
||||||
|
@ -1803,7 +1804,7 @@ class Feeds extends Handler_Protected {
|
||||||
if ($row = $sth->fetch()) {
|
if ($row = $sth->fetch()) {
|
||||||
array_push($rv, (int)$row["cat_id"]);
|
array_push($rv, (int)$row["cat_id"]);
|
||||||
|
|
||||||
if ($with_parents)
|
if ($with_parents && $row["parent_cat"])
|
||||||
$rv = array_merge($rv,
|
$rv = array_merge($rv,
|
||||||
self::_get_parent_cats($row["cat_id"], $owner_uid));
|
self::_get_parent_cats($row["cat_id"], $owner_uid));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue