summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2014-02-11 22:10:55 +0100
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2014-02-11 22:10:55 +0100
commit06abbd02c2d10934155b2464f73d8ecdb2a68de1 (patch)
tree03494c385ffd6604332dbd65cb8a0d2893607bf8
parent0cabd1f50dd7d1cf0941a50139e6fbeed6825b4d (diff)
Rafraîchit uniquement les flux qui n'ont pas déjà été rafraîchis récemment
Contribue à https://github.com/marienfressinaud/FreshRSS/issues/351
-rwxr-xr-xapp/Controllers/javascriptController.php2
-rw-r--r--app/Models/FeedDAO.php7
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 ();