aboutsummaryrefslogtreecommitdiff
path: root/app/Models/FeedDAO.php
diff options
context:
space:
mode:
authorGravatar Alexis Degrugillier <aledeg@users.noreply.github.com> 2018-01-02 23:53:35 +0100
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2018-01-02 23:53:35 +0100
commit7642d334f827d1c077bb1444dfc4e79acf022891 (patch)
tree904bb76cc119ff6d7a806cefd3c1fabbdebf2233 /app/Models/FeedDAO.php
parente3ffc048d7a10a6116cf80fb6fceda0b4037368c (diff)
Replace "keep history" magic value by a constant (#1759)
I think the use of a magic value repeated many times in the code is prone to have some errors made by people not knowing its meaning. Using a constant is a bit more safe. Judging by some comments in the code, I am not the only one.
Diffstat (limited to 'app/Models/FeedDAO.php')
-rw-r--r--app/Models/FeedDAO.php5
1 files changed, 3 insertions, 2 deletions
diff --git a/app/Models/FeedDAO.php b/app/Models/FeedDAO.php
index deda02c63..011b3d112 100644
--- a/app/Models/FeedDAO.php
+++ b/app/Models/FeedDAO.php
@@ -18,7 +18,7 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo implements FreshRSS_Searchable {
ttl
)
VALUES
- (?, ?, ?, ?, ?, ?, 10, ?, 0, -2, ?)';
+ (?, ?, ?, ?, ?, ?, 10, ?, 0, ?, ?)';
$stm = $this->bd->prepare($sql);
$valuesTmp['url'] = safe_ascii($valuesTmp['url']);
@@ -32,6 +32,7 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo implements FreshRSS_Searchable {
substr($valuesTmp['description'], 0, 1023),
$valuesTmp['lastUpdate'],
base64_encode($valuesTmp['httpAuth']),
+ FreshRSS_Feed::KEEP_HISTORY_DEFAULT,
FreshRSS_Feed::TTL_DEFAULT,
);
@@ -406,7 +407,7 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo implements FreshRSS_Searchable {
$myFeed->_pathEntries(isset($dao['pathEntries']) ? $dao['pathEntries'] : '');
$myFeed->_httpAuth(isset($dao['httpAuth']) ? base64_decode($dao['httpAuth']) : '');
$myFeed->_error(isset($dao['error']) ? $dao['error'] : 0);
- $myFeed->_keepHistory(isset($dao['keep_history']) ? $dao['keep_history'] : -2);
+ $myFeed->_keepHistory(isset($dao['keep_history']) ? $dao['keep_history'] : FreshRSS_Feed::KEEP_HISTORY_DEFAULT);
$myFeed->_ttl(isset($dao['ttl']) ? $dao['ttl'] : FreshRSS_Feed::TTL_DEFAULT);
$myFeed->_nbNotRead(isset($dao['cache_nbUnreads']) ? $dao['cache_nbUnreads'] : 0);
$myFeed->_nbEntries(isset($dao['cache_nbEntries']) ? $dao['cache_nbEntries'] : 0);