Browse Source

do not try to update filter triggers if nothing was triggered (properly this time)

Andrew Dolgov 8 months ago
parent
commit
1e3a53c037
1 changed files with 6 additions and 4 deletions
  1. 6 4
      classes/rssutils.php

+ 6 - 4
classes/rssutils.php

@@ -781,13 +781,15 @@ class RSSUtils {
 					$plugin->hook_filter_triggered($feed, $owner_uid, $article, $matched_filters, $matched_rules, $article_filters);
 				}
 
-				$matched_filter_ids = implode(",", array_map(function($f) { return $f['id']; }, $matched_filters));
+				$matched_filter_ids = array_map(function($f) { return $f['id']; }, $matched_filters);
 
+				if (count($matched_filter_ids) > 0) {
+					$filter_ids_qmarks = arr_qmarks($matched_filter_ids);
 
-				if ($matched_filter_ids) {
 					$fsth = $pdo->prepare("UPDATE ttrss_filters2 SET last_triggered = NOW() WHERE 
-							   id IN (?) AND owner_uid = ?");
-					$fsth->execute([$matched_filter_ids, $owner_uid]);
+							   id IN ($filter_ids_qmarks) AND owner_uid = ?");
+
+					$fsth->execute(array_merge($matched_filter_ids, [$owner_uid]));
 				}
 
 				if (Debug::get_loglevel() >= Debug::$LOG_EXTENDED) {