aboutsummaryrefslogtreecommitdiff
path: root/app/Controllers/feedController.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2017-03-27 21:26:38 +0200
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2017-03-27 21:26:38 +0200
commit5541e3951262bf93fc0eeb4938d6b93b01bfd1bd (patch)
tree9ae8ae786aa4ab2df1ca0e0d9689b9680d4dfeeb /app/Controllers/feedController.php
parentbc580c5905522143cb3d73a37641f7bf21225545 (diff)
More defered insertion
Diffstat (limited to 'app/Controllers/feedController.php')
-rwxr-xr-xapp/Controllers/feedController.php10
1 files changed, 8 insertions, 2 deletions
diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php
index bfc8b2045..5359ad198 100755
--- a/app/Controllers/feedController.php
+++ b/app/Controllers/feedController.php
@@ -321,6 +321,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
unset($newGuids);
$oldGuids = array();
+ $needFeedCacheRefresh = false;
// Add entries in database if possible.
foreach ($entries as $entry) {
$entry_date = $entry->date(true);
@@ -333,11 +334,12 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
//Minz_Log::debug('Entry with GUID `' . $entry->guid() . '` updated in feed ' . $feed->id() .
//', old hash ' . $existingHash . ', new hash ' . $entry->hash());
//TODO: Make an updated/is_read policy by feed, in addition to the global one.
+ $needFeedCacheRefresh = FreshRSS_Context::$user_conf->mark_updated_article_unread;
$entry->_isRead(FreshRSS_Context::$user_conf->mark_updated_article_unread ? false : null); //Change is_read according to policy.
if (!$entryDAO->inTransaction()) {
$entryDAO->beginTransaction();
}
- $entryDAO->updateEntry($entry->toArray());
+ $entryDAO->updateEntry($entry->toArray()); //TODO: Need to refresh cache
}
} elseif ($feed_history == 0 && $entry_date < $date_min) {
// This entry should not be added considering configuration and date.
@@ -388,12 +390,16 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
$date_min,
max($feed_history, count($entries) + 10));
if ($nb > 0) {
+ $needFeedCacheRefresh = true;
Minz_Log::debug($nb . ' old entries cleaned in feed [' .
$feed->url() . ']');
}
}
$feedDAO->updateLastUpdate($feed->id(), false, $mtime);
+ if ($needFeedCacheRefresh) {
+ $feedDAO->updateCachedValue($feed->id());
+ }
if ($entryDAO->inTransaction()) {
$entryDAO->commit();
}
@@ -439,7 +445,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
$entryDAO->beginTransaction();
}
$entryDAO->commitNewEntries();
- $feedDAO->updateCachedValues(); //TODO: Optimize
+ $feedDAO->updateCachedValues();
if ($entryDAO->inTransaction()) {
$entryDAO->commit();
}