aboutsummaryrefslogtreecommitdiff
path: root/app/Controllers/feedController.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2015-05-09 23:37:56 +0200
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2015-05-09 23:37:56 +0200
commit993466844405bd9854d890d6d5ebf763ed8b78cb (patch)
treec47780d9d2265915dabf7c38e7965cceef14d531 /app/Controllers/feedController.php
parent57a21331e34e9480d542d0ced59c21075670f39a (diff)
SQL: more robust purge
https://github.com/FreshRSS/FreshRSS/issues/798 https://github.com/FreshRSS/FreshRSS/issues/493
Diffstat (limited to 'app/Controllers/feedController.php')
-rwxr-xr-xapp/Controllers/feedController.php13
1 files changed, 5 insertions, 8 deletions
diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php
index 59c9174fb..5657d4a88 100755
--- a/app/Controllers/feedController.php
+++ b/app/Controllers/feedController.php
@@ -329,7 +329,6 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
// For this feed, check existing GUIDs already in database.
$existingHashForGuids = $entryDAO->listHashForFeedGuids($feed->id(), $newGuids);
unset($newGuids);
- $use_declared_date = empty($existingHashForGuids);
$oldGuids = array();
// Add entries in database if possible.
@@ -353,14 +352,14 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
// This entry should not be added considering configuration and date.
$oldGuids[] = $entry->guid();
} else {
- $id = uTimeString();
- if ($use_declared_date || $entry_date < $date_min) {
- // Use declared date at first import.
+ if ($entry_date < $date_min) {
$id = min(time(), $entry_date) . uSecString();
+ $entry->_isRead(true); //Old article that was not in database. Probably an error, so mark as read
+ } else {
+ $id = uTimeString();
+ $entry->_isRead($is_read);
}
-
$entry->_id($id);
- $entry->_isRead($is_read);
$entry = Minz_ExtensionManager::callHook('entry_before_insert', $entry);
if ($entry === null) {
@@ -376,7 +375,6 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
}
$entryDAO->updateLastSeen($feed->id(), $oldGuids);
}
- //TODO: updateLastSeen old GUIDS once in a while, in the case of caching (i.e. the whole feed content has not changed)
if ($feed_history >= 0 && rand(0, 30) === 1) {
// TODO: move this function in web cron when available (see entry::purge)
@@ -384,7 +382,6 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
if (!$entryDAO->hasTransaction()) {
$entryDAO->beginTransaction();
}
- //TODO: more robust system based on entry.lastSeen to avoid cleaning entries that are still published in the RSS feed.
$nb = $feedDAO->cleanOldEntries($feed->id(),
$date_min,