Rafraîchit uniquement les flux qui n'ont pas déjà été rafraîchis récemment

Contribue à https://github.com/marienfressinaud/FreshRSS/issues/351
This commit is contained in:
Alexandre Alapetite
2014-02-11 22:10:55 +01:00
parent 0cabd1f50d
commit 06abbd02c2
2 changed files with 6 additions and 3 deletions

View File

@@ -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() {

View File

@@ -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 ();