summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2018-12-10 10:44:28 +0300
committerAndrew Dolgov <[email protected]>2018-12-10 10:44:28 +0300
commit51de0ce8073065841bd523bd8722befc5343ee6c (patch)
tree2fa55d296233b302181676b91fdac9d8a03cb0d4 /include
parent96fccefa621c71d58ba77ce939690fedc78d2615 (diff)
runtime info: return count of recent eventlog entries
Diffstat (limited to 'include')
-rwxr-xr-xinclude/functions.php15
1 files changed, 15 insertions, 0 deletions
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();