From 06abbd02c2d10934155b2464f73d8ecdb2a68de1 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Tue, 11 Feb 2014 22:10:55 +0100 Subject: [PATCH] =?UTF-8?q?Rafra=C3=AEchit=20uniquement=20les=20flux=20qui?= =?UTF-8?q?=20n'ont=20pas=20d=C3=A9j=C3=A0=20=C3=A9t=C3=A9=20rafra=C3=AEch?= =?UTF-8?q?is=20r=C3=A9cemment?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Contribue à https://github.com/marienfressinaud/FreshRSS/issues/351 --- app/Controllers/javascriptController.php | 2 +- app/Models/FeedDAO.php | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/Controllers/javascriptController.php b/app/Controllers/javascriptController.php index b879dcd6d..3d741e298 100755 --- a/app/Controllers/javascriptController.php +++ b/app/Controllers/javascriptController.php @@ -8,7 +8,7 @@ class FreshRSS_javascript_Controller extends Minz_ActionController { public function actualizeAction () { header('Content-Type: text/javascript; charset=UTF-8'); $feedDAO = new FreshRSS_FeedDAO (); - $this->view->feeds = $feedDAO->listFeeds (); + $this->view->feeds = $feedDAO->listFeedsOrderUpdate(); } public function nbUnreadsPerFeedAction() { diff --git a/app/Models/FeedDAO.php b/app/Models/FeedDAO.php index a2ce0e46f..7ebe68d2b 100644 --- a/app/Models/FeedDAO.php +++ b/app/Models/FeedDAO.php @@ -198,8 +198,11 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo { return self::daoToFeed ($stm->fetchAll (PDO::FETCH_ASSOC)); } - public function listFeedsOrderUpdate () { - $sql = 'SELECT id, name, url, lastUpdate, pathEntries, httpAuth, keep_history FROM `' . $this->prefix . 'feed` ORDER BY lastUpdate'; + public function listFeedsOrderUpdate ($cacheDuration = 1500) { + $sql = 'SELECT id, name, url, lastUpdate, pathEntries, httpAuth, keep_history ' + . 'FROM `' . $this->prefix . 'feed` ' + . 'WHERE lastUpdate < ' . (time() - intval($cacheDuration)) + . ' ORDER BY lastUpdate'; $stm = $this->bd->prepare ($sql); $stm->execute ();