A free, self-hostable news aggregator…
More defered insertion
Alexandre Alapetite5541e3951262
diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.phpindex 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();}diff --git a/app/Controllers/importExportController.php b/app/Controllers/importExportController.phpindex 82c49cc6a..2bc68848c 100644--- a/app/Controllers/importExportController.php+++ b/app/Controllers/importExportController.php@@ -474,7 +474,11 @@ class FreshRSS_importExport_Controller extends Minz_ActionController {}$this->entryDAO->commit();- $entryDAO->commitNewEntries();++ $this->entryDAO->beginTransaction();+ $this->entryDAO->commitNewEntries();+ $this->feedDAO->updateCachedValues();+ $this->entryDAO->commit();return !$error;}