From 1e3a53c037d36a49214f914a143da8b4b39debad Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 6 Dec 2018 23:12:20 +0300 Subject: [PATCH] do not try to update filter triggers if nothing was triggered (properly this time) --- classes/rssutils.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/classes/rssutils.php b/classes/rssutils.php index cc011d61a..65dd35043 100755 --- a/classes/rssutils.php +++ b/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) {