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/models/Feed.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'app/models/Feed.php') diff --git a/app/models/Feed.php b/app/models/Feed.php index 40394fa46..678809af6 100644 --- a/app/models/Feed.php +++ b/app/models/Feed.php @@ -13,6 +13,7 @@ class Feed extends Model { private $pathEntries = ''; private $httpAuth = ''; private $error = false; + private $keep_history = false; public function __construct ($url) { $this->_url ($url); @@ -73,6 +74,9 @@ class Feed extends Model { public function inError () { return $this->error; } + public function keepHistory () { + return $this->keep_history; + } public function nbEntries () { $feedDAO = new FeedDAO (); return $feedDAO->countEntries ($this->id ()); @@ -150,6 +154,14 @@ class Feed extends Model { } $this->error = $value; } + public function _keepHistory ($value) { + if ($value) { + $value = true; + } else { + $value = false; + } + $this->keep_history = $value; + } public function load () { if (!is_null ($this->url)) { @@ -242,7 +254,7 @@ class Feed extends Model { class FeedDAO extends Model_pdo { public function addFeed ($valuesTmp) { - $sql = 'INSERT INTO ' . $this->prefix . 'feed (id, url, category, name, website, description, lastUpdate, priority, httpAuth, error) VALUES(?, ?, ?, ?, ?, ?, ?, 10, ?, 0)'; + $sql = 'INSERT INTO ' . $this->prefix . 'feed (id, url, category, name, website, description, lastUpdate, priority, httpAuth, error, keep_history) VALUES(?, ?, ?, ?, ?, ?, ?, 10, ?, 0, 0)'; $stm = $this->bd->prepare ($sql); $values = array ( @@ -493,6 +505,7 @@ class HelperFeed { $list[$key]->_pathEntries ($dao['pathEntries']); $list[$key]->_httpAuth (base64_decode ($dao['httpAuth'])); $list[$key]->_error ($dao['error']); + $list[$key]->_keepHistory ($dao['keep_history']); if (isset ($dao['id'])) { $list[$key]->_id ($dao['id']); -- cgit v1.2.3