From 3e4326e34dcb4a9eb922c6d212fd05a58a11b124 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 6 Dec 2018 19:37:20 +0300 Subject: [PATCH] add ttrss_filters2.last_triggered (bump schema version) --- classes/pref/filters.php | 1 + classes/rssutils.php | 6 ++++++ include/functions.php | 4 ++-- js/PrefFilterTree.js | 4 ++++ schema/ttrss_schema_mysql.sql | 3 ++- schema/ttrss_schema_pgsql.sql | 3 ++- schema/versions/mysql/135.sql | 8 ++++++++ schema/versions/pgsql/135.sql | 8 ++++++++ 8 files changed, 33 insertions(+), 4 deletions(-) create mode 100644 schema/versions/mysql/135.sql create mode 100644 schema/versions/pgsql/135.sql diff --git a/classes/pref/filters.php b/classes/pref/filters.php index 54fc99bdc..7c255db4f 100755 --- a/classes/pref/filters.php +++ b/classes/pref/filters.php @@ -333,6 +333,7 @@ class Pref_Filters extends Handler_Protected { $filter['name'] = $name[0]; $filter['param'] = $name[1]; $filter['checkbox'] = false; + $filter['last_triggered'] = $line["last_triggered"] ? make_local_datetime($line["last_triggered"], false) : null; $filter['enabled'] = $line["enabled"]; $filter['rules'] = $this->getfilterrules_concise($line['id']); diff --git a/classes/rssutils.php b/classes/rssutils.php index 923e98c82..b43e752da 100755 --- a/classes/rssutils.php +++ b/classes/rssutils.php @@ -781,6 +781,12 @@ 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)); + + $fsth = $pdo->prepare("UPDATE ttrss_filters2 SET last_triggered = NOW() WHERE + id IN (?) AND owner_uid = ?"); + $fsth->execute([$matched_filter_ids, $owner_uid]); + if (Debug::get_loglevel() >= Debug::$LOG_EXTENDED) { Debug::log("matched filters: ", Debug::$LOG_VERBOSE); diff --git a/include/functions.php b/include/functions.php index 83cc72f80..2b6ad50e4 100755 --- a/include/functions.php +++ b/include/functions.php @@ -1,6 +1,6 @@