A free, self-hostable news aggregator…
Date minimum pour afficher les articles
Alexandre Alapetite7e64cda41548
diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.phpindex 8c18150b6..b61b97624 100644--- a/app/Models/EntryDAO.php+++ b/app/Models/EntryDAO.php@@ -259,7 +259,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo {return isset ($entries[0]) ? $entries[0] : false;}- public function listWhere($type = 'a', $id = '', $state = 'all', $order = 'DESC', $limit = 1, $firstId = -1, $filter = '') {+ public function listWhere($type = 'a', $id = '', $state = 'all', $order = 'DESC', $limit = 1, $firstId = '', $filter = '', $date_min = 0) {$where = '';$values = array();switch ($type) {@@ -299,9 +299,12 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo {default:throw new FreshRSS_EntriesGetter_Exception ('Bad order in Entry->listByType: [' . $order . ']!');}- if ($firstId > 0) {+ if ($firstId !== '') {$where .= 'AND e.id ' . ($order === 'DESC' ? '<=' : '>=') . $firstId . ' ';}+ if ($date_min > 0) {+ $where .= 'AND e.id >= ' . $date_min . '000000 ';+ }$terms = array_unique(explode(' ', trim($filter)));sort($terms); //Put #tags first$having = '';diff --git a/app/controllers/feedController.php b/app/controllers/feedController.phpindex e4014c326..a85877724 100755--- a/app/controllers/feedController.php+++ b/app/controllers/feedController.php@@ -96,7 +96,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController {// on calcule la date des articles les plus anciens qu'on accepte$nb_month_old = $this->view->conf->oldEntries ();- $date_min = time () - (60 * 60 * 24 * 30 * $nb_month_old);+ $date_min = time () - (3600 * 24 * 30 * $nb_month_old);$transactionStarted = true;$feedDAO->beginTransaction ();@@ -196,7 +196,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController {// on calcule la date des articles les plus anciens qu'on accepte$nb_month_old = $this->view->conf->oldEntries ();- $date_min = time () - (60 * 60 * 24 * 30 * $nb_month_old);+ $date_min = time () - (3600 * 24 * 30 * $nb_month_old);$i = 0;$flux_update = 0;@@ -310,7 +310,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController {// on calcule la date des articles les plus anciens qu'on accepte$nb_month_old = $this->view->conf->oldEntries ();- $date_min = time () - (60 * 60 * 24 * 30 * $nb_month_old);+ $date_min = time () - (3600 * 24 * 30 * $nb_month_old);// la variable $error permet de savoir si une erreur est survenue// Le but est de ne pas arrêter l'import même en cas d'erreurdiff --git a/app/controllers/indexController.php b/app/controllers/indexController.phpindex 16a053ba3..92070590a 100755--- a/app/controllers/indexController.php+++ b/app/controllers/indexController.php@@ -124,15 +124,19 @@ class FreshRSS_index_Controller extends Minz_ActionController {}}+ // on calcule la date des articles les plus anciens qu'on affiche+ $nb_month_old = $this->view->conf->oldEntries ();+ $date_min = time () - (3600 * 24 * 30 * $nb_month_old);+try {- $entries = $this->entryDAO->listWhere($getType, $getId, $state, $order, $nb + 1, $first, $filter);+ $entries = $this->entryDAO->listWhere($getType, $getId, $state, $order, $nb + 1, $first, $filter, $date_min);// Si on a récupéré aucun article "non lus"// on essaye de récupérer tous les articlesif ($state === 'not_read' && empty($entries)) { //TODO: Remove in v0.8Minz_Log::record ('Conflicting information about nbNotRead!', Minz_Log::DEBUG);$this->view->state = 'all';- $entries = $this->entryDAO->listWhere($getType, $getId, 'all', $order, $nb, $first, $filter);+ $entries = $this->entryDAO->listWhere($getType, $getId, 'all', $order, $nb, $first, $filter, $date_min);}if (count($entries) <= $nb) {