Skip to content

Commit 2a9bfdc

Browse files
committed
Fix missing fields when inserting
1 parent 9bb8800 commit 2a9bfdc

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

app/Models/EntryDAO.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,9 @@ public function addEntry($valuesTmp, $useTmpTable = true) {
177177
$valuesTmp['link'] = safe_ascii($valuesTmp['link']);
178178
$this->addEntryPrepared->bindParam(':link', $valuesTmp['link']);
179179
$this->addEntryPrepared->bindParam(':date', $valuesTmp['date'], PDO::PARAM_INT);
180-
$valuesTmp['lastSeen'] = time();
180+
if (empty($valuesTmp['lastSeen'])) {
181+
$valuesTmp['lastSeen'] = time();
182+
}
181183
$this->addEntryPrepared->bindParam(':last_seen', $valuesTmp['lastSeen'], PDO::PARAM_INT);
182184
$valuesTmp['is_read'] = $valuesTmp['is_read'] ? 1 : 0;
183185
$this->addEntryPrepared->bindParam(':is_read', $valuesTmp['is_read'], PDO::PARAM_INT);

app/Models/FeedDAO.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function addFeed($valuesTmp) {
4747
attributes
4848
)
4949
VALUES
50-
(?, ?, ?, ?, ?, ?, 10, ?, ?, 0, ?, ?, ?)';
50+
(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)';
5151
$stm = $this->bd->prepare($sql);
5252

5353
$valuesTmp['url'] = safe_ascii($valuesTmp['url']);
@@ -63,9 +63,11 @@ public function addFeed($valuesTmp) {
6363
substr($valuesTmp['website'], 0, 255),
6464
mb_strcut($valuesTmp['description'], 0, 1023, 'UTF-8'),
6565
$valuesTmp['lastUpdate'],
66+
isset($valuesTmp['priority']) ? intval($valuesTmp['priority']) : FreshRSS_Feed::PRIORITY_MAIN_STREAM,
6667
mb_strcut($valuesTmp['pathEntries'], 0, 511, 'UTF-8'),
6768
base64_encode($valuesTmp['httpAuth']),
68-
FreshRSS_Feed::KEEP_HISTORY_DEFAULT,
69+
isset($valuesTmp['error']) ? intval($valuesTmp['error']) : 0,
70+
isset($valuesTmp['keep_history']) ? intval($valuesTmp['keep_history']) : FreshRSS_Feed::KEEP_HISTORY_DEFAULT,
6971
isset($valuesTmp['ttl']) ? intval($valuesTmp['ttl']) : FreshRSS_Feed::TTL_DEFAULT,
7072
isset($valuesTmp['attributes']) ? json_encode($valuesTmp['attributes']) : '',
7173
);

0 commit comments

Comments
 (0)