From e641547d37ce39ae67a119202795c51781f35228 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 30 Sep 2020 16:35:50 +0300 Subject: [PATCH] set ttrss_feeds.last_successful_update as needed --- classes/rssutils.php | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/classes/rssutils.php b/classes/rssutils.php index 54113360a..0e0ea75bb 100755 --- a/classes/rssutils.php +++ b/classes/rssutils.php @@ -497,15 +497,21 @@ class RSSUtils { Debug::log("unable to fetch: $fetch_last_error [$fetch_last_error_code]", Debug::$LOG_VERBOSE); // If-Modified-Since - if ($fetch_last_error_code != 304) { - $error_message = $fetch_last_error; - } else { + if ($fetch_last_error_code == 304) { Debug::log("source claims data not modified, nothing to do.", Debug::$LOG_VERBOSE); $error_message = ""; - } - $sth = $pdo->prepare("UPDATE ttrss_feeds SET last_error = ?, + $sth = $pdo->prepare("UPDATE ttrss_feeds SET last_error = ?, + last_successful_update = NOW(), + last_updated = NOW() WHERE id = ?"); + + } else { + $error_message = $fetch_last_error; + + $sth = $pdo->prepare("UPDATE ttrss_feeds SET last_error = ?, last_updated = NOW() WHERE id = ?"); + } + $sth->execute([$error_message, $feed]); return $error_message == ""; @@ -1232,8 +1238,11 @@ class RSSUtils { Feeds::purge_feed($feed, 0); - $sth = $pdo->prepare("UPDATE ttrss_feeds - SET last_updated = NOW(), last_unconditional = NOW(), last_error = '' WHERE id = ?"); + $sth = $pdo->prepare("UPDATE ttrss_feeds SET + last_updated = NOW(), + last_unconditional = NOW(), + last_successful_update = NOW(), + last_error = '' WHERE id = ?"); $sth->execute([$feed]); } else { @@ -1248,8 +1257,10 @@ class RSSUtils { } } - $sth = $pdo->prepare("UPDATE ttrss_feeds SET last_error = ?, - last_updated = NOW(), last_unconditional = NOW() WHERE id = ?"); + $sth = $pdo->prepare("UPDATE ttrss_feeds SET + last_error = ?, + last_updated = NOW(), + last_unconditional = NOW() WHERE id = ?"); $sth->execute([$error_msg, $feed]); unset($rss);