From 51de0ce8073065841bd523bd8722befc5343ee6c Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 10 Dec 2018 10:44:28 +0300 Subject: [PATCH] runtime info: return count of recent eventlog entries --- include/functions.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/include/functions.php b/include/functions.php index 9c7d98b69..fe7582ad2 100755 --- a/include/functions.php +++ b/include/functions.php @@ -1311,6 +1311,21 @@ $data["labels"] = Labels::get_all_labels($_SESSION["uid"]); + if (LOG_DESTINATION == 'sql') { + if (DB_TYPE == 'pgsql') { + $log_interval = "created_at > NOW() - interval '1 hour'"; + } else { + $log_interval = "created_at > DATE_SUB(NOW(), INTERVAL 1 HOUR)"; + } + + $sth = $pdo->prepare("SELECT COUNT(id) AS cid FROM ttrss_error_log WHERE $log_interval"); + $sth->execute(); + + if ($row = $sth->fetch()) { + $data['recent_eventlog_entries'] = $row['cid']; + } + } + if (CHECK_FOR_UPDATES && !$disable_update_check && $_SESSION["last_version_check"] + 86400 + rand(-1000, 1000) < time()) { $update_result = @check_for_update();