aboutsummaryrefslogtreecommitdiff
path: root/app/Models
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2024-12-03 12:59:45 +0100
committerGravatar GitHub <noreply@github.com> 2024-12-03 12:59:45 +0100
commit2c7e5b829fb60e2b62771e918b91c1f86aedb2f0 (patch)
treec475f95e78e8b7c0e917aea00fa0aae2f3eb26b1 /app/Models
parentb84cbce9056989f9936240809cbe156c2e6b4759 (diff)
New button to delete errored feeds from a category (#7030)
* New button to delete errored feeds from a category fix https://github.com/FreshRSS/FreshRSS/issues/7025 fix https://github.com/FreshRSS/FreshRSS/issues/7026 * Remove English TODO * in error state * Feeds with errors
Diffstat (limited to 'app/Models')
-rw-r--r--app/Models/FeedDAO.php12
1 files changed, 10 insertions, 2 deletions
diff --git a/app/Models/FeedDAO.php b/app/Models/FeedDAO.php
index bb4209eca..fa52838ca 100644
--- a/app/Models/FeedDAO.php
+++ b/app/Models/FeedDAO.php
@@ -267,12 +267,16 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo {
/**
* @param bool|null $muted to include only muted feeds
+ * @param bool|null $errored to include only errored feeds
*/
- public function deleteFeedByCategory(int $id, ?bool $muted = null): int|false {
+ public function deleteFeedByCategory(int $id, ?bool $muted = null, ?bool $errored = null): int|false {
$sql = 'DELETE FROM `_feed` WHERE category=?';
if ($muted) {
$sql .= ' AND ttl < 0';
}
+ if ($errored) {
+ $sql .= ' AND error <> 0';
+ }
$stm = $this->pdo->prepare($sql);
$values = [$id];
@@ -406,13 +410,17 @@ SQL;
/**
* @param bool|null $muted to include only muted feeds
+ * @param bool|null $errored to include only errored feeds
* @return array<int,FreshRSS_Feed>
*/
- public function listByCategory(int $cat, ?bool $muted = null): array {
+ public function listByCategory(int $cat, ?bool $muted = null, ?bool $errored = null): array {
$sql = 'SELECT * FROM `_feed` WHERE category=:category';
if ($muted) {
$sql .= ' AND ttl < 0';
}
+ if ($errored) {
+ $sql .= ' AND error <> 0';
+ }
$res = $this->fetchAssoc($sql, [':category' => $cat]);
if ($res == null) {
return [];