mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-13 06:45:54 +00:00
try to calculate counters conditionally based on feed ids
This commit is contained in:
@@ -1765,7 +1765,7 @@ class Feeds extends Handler_Protected {
|
||||
$sth->execute([$cat, $owner_uid]);
|
||||
|
||||
while ($line = $sth->fetch()) {
|
||||
array_push($rv, $line["parent_cat"]);
|
||||
array_push($rv, (int)$line["parent_cat"]);
|
||||
$rv = array_merge($rv, self::_get_parent_cats($line["parent_cat"], $owner_uid));
|
||||
}
|
||||
|
||||
@@ -1789,6 +1789,30 @@ class Feeds extends Handler_Protected {
|
||||
return $rv;
|
||||
}
|
||||
|
||||
static function _cats_of(array $feeds, int $owner_uid, bool $with_parents = false) {
|
||||
$pdo = Db::pdo();
|
||||
|
||||
$feeds_qmarks = arr_qmarks($feeds);
|
||||
|
||||
$sth = $pdo->prepare("SELECT DISTINCT cat_id FROM ttrss_feeds
|
||||
WHERE id IN ($feeds_qmarks)");
|
||||
$sth->execute($feeds);
|
||||
|
||||
$rv = [];
|
||||
|
||||
if ($row = $sth->fetch()) {
|
||||
array_push($rv, (int)$row["cat_id"]);
|
||||
|
||||
if ($with_parents)
|
||||
$rv = array_merge($rv,
|
||||
self::_get_parent_cats($row["cat_id"], $owner_uid));
|
||||
}
|
||||
|
||||
$rv = array_unique($rv);
|
||||
|
||||
return $rv;
|
||||
}
|
||||
|
||||
static function _cat_of_feed($feed) {
|
||||
$pdo = Db::pdo();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user