diff --git a/classes/feeds.php b/classes/feeds.php index a46d008a5..2015f2435 100755 --- a/classes/feeds.php +++ b/classes/feeds.php @@ -350,19 +350,6 @@ class Feeds extends Handler_Protected { $this->mark_timestamp(" enclosures"); - if ($line["orig_feed_id"]) { - - $ofgh = $this->pdo->prepare("SELECT * FROM ttrss_archived_feeds - WHERE id = ? AND owner_uid = ?"); - $ofgh->execute([$line["orig_feed_id"], $_SESSION['uid']]); - - if ($tmp_line = $ofgh->fetch()) { - $line["orig_feed"] = [ $tmp_line["title"], $tmp_line["site_url"], $tmp_line["feed_url"] ]; - } - } - - $this->mark_timestamp(" orig-feed-id"); - $line["updated_long"] = TimeHelper::make_local_datetime($line["updated"],true); $line["updated"] = TimeHelper::make_local_datetime($line["updated"], false, false, false, true); @@ -1840,7 +1827,7 @@ class Feeds extends Handler_Protected { uuid, lang, hide_images, - unread,feed_id,marked,published,link,last_read,orig_feed_id, + unread,feed_id,marked,published,link,last_read, last_marked, last_published, $vfeed_query_part $content_query_part @@ -1884,7 +1871,6 @@ class Feeds extends Handler_Protected { updated, unread, feed_id, - orig_feed_id, marked, published, num_comments, diff --git a/classes/handler/public.php b/classes/handler/public.php index 7fbad5530..fdf55b1d2 100755 --- a/classes/handler/public.php +++ b/classes/handler/public.php @@ -328,7 +328,6 @@ class Handler_Public extends Handler { tag_cache, author, guid, - orig_feed_id, note FROM ttrss_entries,ttrss_user_entries WHERE id = ? AND ref_id = id AND owner_uid = ?"); diff --git a/classes/pref/feeds.php b/classes/pref/feeds.php index e1e88ddc0..88c5b7f0e 100755 --- a/classes/pref/feeds.php +++ b/classes/pref/feeds.php @@ -1607,54 +1607,23 @@ class Pref_Feeds extends Handler_Protected { /* save starred articles in Archived feed */ - /* prepare feed if necessary */ + $sth = $pdo->prepare("UPDATE ttrss_user_entries SET + feed_id = NULL, orig_feed_id = NULL + WHERE feed_id = ? AND marked = true AND owner_uid = ?"); - $sth = $pdo->prepare("SELECT feed_url FROM ttrss_feeds WHERE id = ? - AND owner_uid = ?"); $sth->execute([$id, $owner_uid]); - if ($row = $sth->fetch()) { - $feed_url = $row["feed_url"]; + /* Remove access key for the feed */ - $sth = $pdo->prepare("SELECT id FROM ttrss_archived_feeds - WHERE feed_url = ? AND owner_uid = ?"); - $sth->execute([$feed_url, $owner_uid]); + $sth = $pdo->prepare("DELETE FROM ttrss_access_keys WHERE + feed_id = ? AND owner_uid = ?"); + $sth->execute([$id, $owner_uid]); - if ($row = $sth->fetch()) { - $archive_id = $row["id"]; - } else { - $res = $pdo->query("SELECT MAX(id) AS id FROM ttrss_archived_feeds"); - $row = $res->fetch(); + /* remove the feed */ - $new_feed_id = (int)$row['id'] + 1; - - $sth = $pdo->prepare("INSERT INTO ttrss_archived_feeds - (id, owner_uid, title, feed_url, site_url, created) - SELECT ?, owner_uid, title, feed_url, site_url, NOW() from ttrss_feeds - WHERE id = ?"); - $sth->execute([$new_feed_id, $id]); - - $archive_id = $new_feed_id; - } - - $sth = $pdo->prepare("UPDATE ttrss_user_entries SET feed_id = NULL, - orig_feed_id = ? WHERE feed_id = ? AND - marked = true AND owner_uid = ?"); - - $sth->execute([$archive_id, $id, $owner_uid]); - - /* Remove access key for the feed */ - - $sth = $pdo->prepare("DELETE FROM ttrss_access_keys WHERE - feed_id = ? AND owner_uid = ?"); - $sth->execute([$id, $owner_uid]); - - /* remove the feed */ - - $sth = $pdo->prepare("DELETE FROM ttrss_feeds - WHERE id = ? AND owner_uid = ?"); - $sth->execute([$id, $owner_uid]); - } + $sth = $pdo->prepare("DELETE FROM ttrss_feeds + WHERE id = ? AND owner_uid = ?"); + $sth->execute([$id, $owner_uid]); $pdo->commit(); diff --git a/classes/rpc.php b/classes/rpc.php index 6b41a51b8..0e881b3ce 100755 --- a/classes/rpc.php +++ b/classes/rpc.php @@ -80,20 +80,6 @@ class RPC extends Handler_Protected { } } - // Silent - function remarchive() { - $ids = explode(",", clean($_REQUEST["ids"])); - - $sth = $this->pdo->prepare("DELETE FROM ttrss_archived_feeds WHERE - (SELECT COUNT(*) FROM ttrss_user_entries - WHERE orig_feed_id = :id) = 0 AND - id = :id AND owner_uid = :uid"); - - foreach ($ids as $id) { - $sth->execute([":id" => $id, ":uid" => $_SESSION['uid']]); - } - } - function addfeed() { $feed = clean($_REQUEST['feed']); $cat = clean($_REQUEST['cat']); @@ -150,113 +136,6 @@ class RPC extends Handler_Protected { print json_encode(array("message" => "UPDATE_COUNTERS")); } - function unarchive() { - $ids = explode(",", clean($_REQUEST["ids"])); - - foreach ($ids as $id) { - $this->pdo->beginTransaction(); - - $sth = $this->pdo->prepare("SELECT feed_url,site_url,title FROM ttrss_archived_feeds - WHERE id = (SELECT orig_feed_id FROM ttrss_user_entries WHERE ref_id = :id - AND owner_uid = :uid) AND owner_uid = :uid"); - $sth->execute([":uid" => $_SESSION['uid'], ":id" => $id]); - - if ($row = $sth->fetch()) { - $feed_url = $row['feed_url']; - $site_url = $row['site_url']; - $title = $row['title']; - - $sth = $this->pdo->prepare("SELECT id FROM ttrss_feeds WHERE feed_url = ? - AND owner_uid = ?"); - $sth->execute([$feed_url, $_SESSION['uid']]); - - if ($row = $sth->fetch()) { - $feed_id = $row["id"]; - } else { - if (!$title) $title = '[Unknown]'; - - $sth = $this->pdo->prepare("INSERT INTO ttrss_feeds - (owner_uid,feed_url,site_url,title,cat_id,auth_login,auth_pass,update_method) - VALUES (?, ?, ?, ?, NULL, '', '', 0)"); - $sth->execute([$_SESSION['uid'], $feed_url, $site_url, $title]); - - $sth = $this->pdo->prepare("SELECT id FROM ttrss_feeds WHERE feed_url = ? - AND owner_uid = ?"); - $sth->execute([$feed_url, $_SESSION['uid']]); - - if ($row = $sth->fetch()) { - $feed_id = $row['id']; - } - } - - if ($feed_id) { - $sth = $this->pdo->prepare("UPDATE ttrss_user_entries - SET feed_id = ?, orig_feed_id = NULL - WHERE ref_id = ? AND owner_uid = ?"); - $sth->execute([$feed_id, $id, $_SESSION['uid']]); - } - } - - $this->pdo->commit(); - } - - print json_encode(array("message" => "UPDATE_COUNTERS")); - } - - function archive() { - $ids = explode(",", clean($_REQUEST["ids"])); - - foreach ($ids as $id) { - $this->archive_article($id, $_SESSION["uid"]); - } - - print json_encode(array("message" => "UPDATE_COUNTERS")); - } - - private function archive_article($id, $owner_uid) { - $this->pdo->beginTransaction(); - - if (!$owner_uid) $owner_uid = $_SESSION['uid']; - - $sth = $this->pdo->prepare("SELECT feed_id FROM ttrss_user_entries - WHERE ref_id = ? AND owner_uid = ?"); - $sth->execute([$id, $owner_uid]); - - if ($row = $sth->fetch()) { - - /* prepare the archived table */ - - $feed_id = (int) $row['feed_id']; - - if ($feed_id) { - $sth = $this->pdo->prepare("SELECT id FROM ttrss_archived_feeds - WHERE id = ? AND owner_uid = ?"); - $sth->execute([$feed_id, $owner_uid]); - - if ($row = $sth->fetch()) { - $new_feed_id = $row['id']; - } else { - $row = $this->pdo->query("SELECT MAX(id) AS id FROM ttrss_archived_feeds")->fetch(); - $new_feed_id = (int)$row['id'] + 1; - - $sth = $this->pdo->prepare("INSERT INTO ttrss_archived_feeds - (id, owner_uid, title, feed_url, site_url, created) - SELECT ?, owner_uid, title, feed_url, site_url, NOW() from ttrss_feeds - WHERE id = ?"); - - $sth->execute([$new_feed_id, $feed_id]); - } - - $sth = $this->pdo->prepare("UPDATE ttrss_user_entries - SET orig_feed_id = ?, feed_id = NULL - WHERE ref_id = ? AND owner_uid = ?"); - $sth->execute([$new_feed_id, $id, $owner_uid]); - } - } - - $this->pdo->commit(); - } - function publ() { $pub = clean($_REQUEST["pub"]); $id = clean($_REQUEST["id"]); @@ -347,60 +226,6 @@ class RPC extends Handler_Protected { print ""; } - // Silent - function massSubscribe() { - - $payload = json_decode(clean($_REQUEST["payload"]), false); - $mode = clean($_REQUEST["mode"]); - - if (!$payload || !is_array($payload)) return; - - if ($mode == 1) { - foreach ($payload as $feed) { - - $title = $feed[0]; - $feed_url = $feed[1]; - - $sth = $this->pdo->prepare("SELECT id FROM ttrss_feeds WHERE - feed_url = ? AND owner_uid = ?"); - $sth->execute([$feed_url, $_SESSION['uid']]); - - if (!$sth->fetch()) { - $sth = $this->pdo->prepare("INSERT INTO ttrss_feeds - (owner_uid,feed_url,title,cat_id,site_url) - VALUES (?, ?, ?, NULL, '')"); - - $sth->execute([$_SESSION['uid'], $feed_url, $title]); - } - } - } else if ($mode == 2) { - // feed archive - foreach ($payload as $id) { - $sth = $this->pdo->prepare("SELECT * FROM ttrss_archived_feeds - WHERE id = ? AND owner_uid = ?"); - $sth->execute([$id, $_SESSION['uid']]); - - if ($row = $sth->fetch()) { - $site_url = $row['site_url']; - $feed_url = $row['feed_url']; - $title = $row['title']; - - $sth = $this->pdo->prepare("SELECT id FROM ttrss_feeds WHERE - feed_url = ? AND owner_uid = ?"); - $sth->execute([$feed_url, $_SESSION['uid']]); - - if (!$sth->fetch()) { - $sth = $this->pdo->prepare("INSERT INTO ttrss_feeds - (owner_uid,feed_url,title,cat_id,site_url) - VALUES (?, ?, ?, NULL, ?)"); - - $sth->execute([$_SESSION['uid'], $feed_url, $title, $site_url]); - } - } - } - } - } - function catchupFeed() { $feed_id = clean($_REQUEST['feed_id']); $is_cat = clean($_REQUEST['is_cat']) == "true"; diff --git a/classes/rssutils.php b/classes/rssutils.php index dc80dd965..96f7b7c36 100755 --- a/classes/rssutils.php +++ b/classes/rssutils.php @@ -1379,18 +1379,11 @@ class RSSUtils { } } + // deprecated; table not used static function expire_feed_archive() { - Debug::log("Removing old archived feeds..."); - $pdo = Db::pdo(); - if (DB_TYPE == "pgsql") { - $pdo->query("DELETE FROM ttrss_archived_feeds - WHERE created < NOW() - INTERVAL '1 month'"); - } else { - $pdo->query("DELETE FROM ttrss_archived_feeds - WHERE created < DATE_SUB(NOW(), INTERVAL 1 MONTH)"); - } + $pdo->query("DELETE FROM ttrss_archived_feeds"); } static function expire_lock_files() { diff --git a/js/Article.js b/js/Article.js index 587243a01..a075e321f 100644 --- a/js/Article.js +++ b/js/Article.js @@ -175,11 +175,6 @@ const Article = { return comments; }, - formatOriginallyFrom: function(hl) { - return hl.orig_feed ? ` - ${__('Originally from:')} ${hl.orig_feed[0]} - ` : ""; - }, unpack: function(row) { if (row.hasAttribute("data-content")) { console.log("unpacking: " + row.id); @@ -220,7 +215,6 @@ const Article = { if (hl) { const comments = this.formatComments(hl); - const originally_from = this.formatOriginallyFrom(hl); const article = `