From 9642fbb2211368f8063f657d34e043b311df4718 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Thu, 22 Aug 2013 11:11:22 +0200 Subject: Fix issue #118 : option pour garder historique MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit *** ATTENTION, MODIFICATION DE LA BDD *** Cette option permet de garder les vieux articles d'un flux en même s'ils sont plus vieux que la limite des X mois d'historique (3 par défaut) Les modifications de la base de données : - ajout du champ "keep_history int(1) DEFAULT 0" à la table feed - suppression des champs "is_public" et "lastUpdate" de la table entry (n'étaient plus utilisés de toute façon) --- app/controllers/configureController.php | 9 ++++++++- app/controllers/feedController.php | 6 ++++-- 2 files changed, 12 insertions(+), 3 deletions(-) (limited to 'app/controllers') diff --git a/app/controllers/configureController.php b/app/controllers/configureController.php index 6ebc13f39..6396dbfeb 100755 --- a/app/controllers/configureController.php +++ b/app/controllers/configureController.php @@ -92,12 +92,18 @@ class configureController extends ActionController { if (Request::isPost () && $this->view->flux) { $name = Request::param ('name', ''); + $hist = Request::param ('keep_history', 'no'); $cat = Request::param ('category', 0); $path = Request::param ('path_entries', ''); $priority = Request::param ('priority', 0); $user = Request::param ('http_user', ''); $pass = Request::param ('http_pass', ''); + $keep_history = false; + if ($hist == 'yes') { + $keep_history = true; + } + $httpAuth = ''; if ($user != '' || $pass != '') { $httpAuth = $user . ':' . $pass; @@ -108,7 +114,8 @@ class configureController extends ActionController { 'category' => $cat, 'pathEntries' => $path, 'priority' => $priority, - 'httpAuth' => $httpAuth + 'httpAuth' => $httpAuth, + 'keep_history' => $keep_history ); if ($feedDAO->updateFeed ($id, $values)) { diff --git a/app/controllers/feedController.php b/app/controllers/feedController.php index 21ea2aadd..18a46f322 100755 --- a/app/controllers/feedController.php +++ b/app/controllers/feedController.php @@ -69,7 +69,8 @@ class feedController extends ActionController { // on ajoute les articles en masse sans vérification foreach ($entries as $entry) { - if ($entry->date (true) >= $date_min) { + if ($entry->date (true) >= $date_min || + $feed->keepHistory ()) { $values = $entry->toArray (); $entryDAO->addEntry ($values); } @@ -150,7 +151,8 @@ class feedController extends ActionController { // La BDD refusera l'ajout de son côté car l'id doit être // unique foreach ($entries as $entry) { - if ($entry->date (true) >= $date_min) { + if ($entry->date (true) >= $date_min || + $feed->keepHistory ()) { $values = $entry->toArray (); $entryDAO->addEntry ($values); } -- cgit v1.2.3