aboutsummaryrefslogtreecommitdiff
path: root/app/Models
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2018-11-05 18:10:38 +0100
committerGravatar GitHub <noreply@github.com> 2018-11-05 18:10:38 +0100
commitcf899d8d25c57b05dff89b89e2c7e56808f83c50 (patch)
treed91c139f4f7d12c5b83359a6a3c093e6405b93b1 /app/Models
parente1faf9dfcf74725e0616a56303aeeb80fa9ed82f (diff)
TT-RSS import (#2099)
* TT-RSS import Import of Tiny Tiny RSS favourites https://github.com/FreshRSS/FreshRSS/issues/2018#issuecomment-432710462 * Fallback feed_url * Simpler JSON * TT-RSS import custom labels * Fix syntax
Diffstat (limited to 'app/Models')
-rw-r--r--app/Models/EntryDAO.php9
-rw-r--r--app/Models/FeedDAO.php8
-rw-r--r--app/Models/TagDAO.php2
3 files changed, 17 insertions, 2 deletions
diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php
index a01c2227b..708d01a69 100644
--- a/app/Models/EntryDAO.php
+++ b/app/Models/EntryDAO.php
@@ -671,6 +671,15 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable {
return isset($entries[0]) ? $entries[0] : null;
}
+ public function searchIdByGuid($id_feed, $guid) {
+ $sql = 'SELECT id FROM `' . $this->prefix . 'entry` WHERE id_feed=? AND guid=?';
+ $stm = $this->bd->prepare($sql);
+ $values = array($id_feed, $guid);
+ $stm->execute($values);
+ $res = $stm->fetchAll(PDO::FETCH_COLUMN, 0);
+ return isset($res[0]) ? $res[0] : null;
+ }
+
protected function sqlConcat($s1, $s2) {
return 'CONCAT(' . $s1 . ',' . $s2 . ')'; //MySQL
}
diff --git a/app/Models/FeedDAO.php b/app/Models/FeedDAO.php
index e579f5881..7f00642f4 100644
--- a/app/Models/FeedDAO.php
+++ b/app/Models/FeedDAO.php
@@ -465,9 +465,15 @@ UPDATE `{$this->prefix}feed`
SQL;
$stm = $this->bd->prepare($sql);
if (!($stm && $stm->execute(array(':new_value' => FreshRSS_Feed::TTL_DEFAULT, ':old_value' => -2)))) {
+ $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo();
+ Minz_Log::error('SQL warning updateTTL 1: ' . $info[2] . ' ' . $sql);
+
$sql2 = 'ALTER TABLE `' . $this->prefix . 'feed` ADD COLUMN ttl INT NOT NULL DEFAULT ' . FreshRSS_Feed::TTL_DEFAULT; //v0.7.3
$stm = $this->bd->prepare($sql2);
- $stm->execute();
+ if (!($stm && $stm->execute())) {
+ $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo();
+ Minz_Log::error('SQL error updateTTL 2: ' . $info[2] . ' ' . $sql2);
+ }
} else {
$stm->execute(array(':new_value' => -3600, ':old_value' => -1));
}
diff --git a/app/Models/TagDAO.php b/app/Models/TagDAO.php
index 1b59c8971..b55d2b35d 100644
--- a/app/Models/TagDAO.php
+++ b/app/Models/TagDAO.php
@@ -266,7 +266,7 @@ class FreshRSS_TagDAO extends Minz_ModelPdo implements FreshRSS_Searchable {
if (is_array($entries) && count($entries) > 0) {
$sql .= ' AND et.id_entry IN (' . str_repeat('?,', count($entries) - 1). '?)';
foreach ($entries as $entry) {
- $values[] = $entry->id();
+ $values[] = is_array($entry) ? $entry['id'] : $entry->id();
}
}
$stm = $this->bd->prepare($sql);