aboutsummaryrefslogtreecommitdiff
path: root/app/Controllers/feedController.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2022-06-25 11:11:23 +0200
committerGravatar GitHub <noreply@github.com> 2022-06-25 11:11:23 +0200
commit07a52137a975978dab762ac8276fd85919497013 (patch)
tree0e091565eddc3de4bb2a393ecf1a424757fc0e97 /app/Controllers/feedController.php
parente14a72681eaf728b6a64daaf2a81b9c18562388a (diff)
Fix last update & archive logic (#4422)
#fix https://github.com/FreshRSS/FreshRSS/issues/4401
Diffstat (limited to 'app/Controllers/feedController.php')
-rwxr-xr-xapp/Controllers/feedController.php14
1 files changed, 7 insertions, 7 deletions
diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php
index 49383342e..dd87650bc 100755
--- a/app/Controllers/feedController.php
+++ b/app/Controllers/feedController.php
@@ -361,6 +361,8 @@ class FreshRSS_feed_Controller extends FreshRSS_ActionController {
}
//Minz_Log::debug($feed->url(false) . ' was updated at ' . date('c', $mtime) . ' by another user');
//Will take advantage of the newer cache
+ } else {
+ $mtime = time();
}
if (!$feed->lock()) {
@@ -413,9 +415,9 @@ class FreshRSS_feed_Controller extends FreshRSS_ActionController {
// For this feed, check existing GUIDs already in database.
$existingHashForGuids = $entryDAO->listHashForFeedGuids($feed->id(), $newGuids);
- $newGuids = array();
+ /** @var array<string,bool> */
+ $newGuids = [];
- $oldGuids = array();
// Add entries in database if possible.
/** @var FreshRSS_Entry $entry */
foreach ($entries as $entry) {
@@ -426,10 +428,8 @@ class FreshRSS_feed_Controller extends FreshRSS_ActionController {
if (isset($existingHashForGuids[$entry->guid()])) {
$existingHash = $existingHashForGuids[$entry->guid()];
- if (strcasecmp($existingHash, $entry->hash()) === 0) {
- //This entry already exists and is unchanged.
- $oldGuids[] = $entry->guid();
- } else { //This entry already exists but has been updated
+ if (strcasecmp($existingHash, $entry->hash()) !== 0) {
+ //This entry already exists but has been updated
//Minz_Log::debug('Entry with GUID `' . $entry->guid() . '` updated in feed ' . $feed->url(false) .
//', old hash ' . $existingHash . ', new hash ' . $entry->hash());
$entry->_isRead($mark_updated_article_unread ? false : null); //Change is_read according to policy.
@@ -488,7 +488,7 @@ class FreshRSS_feed_Controller extends FreshRSS_ActionController {
$nb_new_articles++;
}
}
- $entryDAO->updateLastSeen($feed->id(), $oldGuids, $mtime);
+ $entryDAO->updateLastSeen($feed->id(), array_keys($newGuids), $mtime);
}
unset($entries);