summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2021-01-17 14:55:11 +0300
committerAndrew Dolgov <[email protected]>2021-01-17 14:55:11 +0300
commitda0ad82c2497ed34cb29cf78e29c75a4d4ffb8bd (patch)
tree12f9b19df9a31766585e39e54d8d860f2dec3692
parent6c1344908862e344a1108e92ec19368402cfd9d1 (diff)
Archive cleanup:
- remove code to manually archive/unarchive articles - remove ttrss_archived_feeds/orig_feed_id handling - the whole thing was implemented for this data to be kept indefinitely; it doesn't make a lot of sense to deal with this stuff now that it is expired after one month anyway (same reasons as feed browser being removed - privacy) - remove "originally from"-related stuff because of the above - also remove unused remaining frontend/backend code related to feed browser (rip)
-rwxr-xr-xclasses/feeds.php16
-rwxr-xr-xclasses/handler/public.php1
-rwxr-xr-xclasses/pref/feeds.php53
-rwxr-xr-xclasses/rpc.php175
-rwxr-xr-xclasses/rssutils.php11
-rw-r--r--js/Article.js7
-rwxr-xr-xjs/Headlines.js39
7 files changed, 14 insertions, 288 deletions
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]);
-
- if ($row = $sth->fetch()) {
- $archive_id = $row["id"];
- } else {
- $res = $pdo->query("SELECT MAX(id) AS id FROM ttrss_archived_feeds");
- $row = $res->fetch();
-
- $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]);
+ $sth = $pdo->prepare("DELETE FROM ttrss_access_keys WHERE
+ feed_id = ? AND owner_uid = ?");
+ $sth->execute([$id, $owner_uid]);
- /* remove the feed */
+ /* 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 "</ul>";
}
- // 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 ? `<span>
- ${__('Originally from:')} <a target="_blank" rel="noopener noreferrer" href="${App.escapeHtml(hl.orig_feed[1])}">${hl.orig_feed[0]}</a>
- </span>` : "";
- },
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 = `<div class="post post-${hl.id}" data-article-id="${hl.id}">
<div class="header">
@@ -243,7 +237,6 @@ const Article = {
</div>
<div id="POSTNOTE-${hl.id}">${hl.note}</div>
<div class="content" lang="${hl.lang ? hl.lang : 'en'}">
- ${originally_from}
${hl.content}
${hl.enclosures}
</div>
diff --git a/js/Headlines.js b/js/Headlines.js
index 03e3f506a..d0c352aed 100755
--- a/js/Headlines.js
+++ b/js/Headlines.js
@@ -420,7 +420,6 @@ const Headlines = {
row_class += App.getInitParam("cdm_expanded") ? " expanded" : " expandable";
const comments = Article.formatComments(hl);
- const originally_from = Article.formatOriginallyFrom(hl);
row = `<div class="cdm ${row_class} ${Article.getScoreClass(hl.score)}"
id="RROW-${hl.id}"
@@ -483,7 +482,6 @@ const Headlines = {
</div>
<div class="right">
- ${originally_from}
${hl.buttons}
</div>
</div>
@@ -1085,43 +1083,6 @@ const Headlines = {
}
}
},
- /* not exposed in the UI by default, deprecated - ? */
- archiveSelection: function () {
- const rows = Headlines.getSelected();
-
- if (rows.length == 0) {
- alert(__("No articles selected."));
- return;
- }
-
- const fn = Feeds.getName(Feeds.getActive(), Feeds.activeIsCat());
- let str;
- let op;
-
- if (Feeds.getActive() != 0) {
- str = ngettext("Archive %d selected article in %s?", "Archive %d selected articles in %s?", rows.length);
- op = "archive";
- } else {
- str = ngettext("Move %d archived article back?", "Move %d archived articles back?", rows.length);
- str += " " + __("Please note that unstarred articles might get purged on next feed update.");
-
- op = "unarchive";
- }
-
- str = str.replace("%d", rows.length);
- str = str.replace("%s", fn);
-
- if (App.getInitParam("confirm_feed_catchup") && !confirm(str)) {
- return;
- }
-
- const query = {op: "rpc", method: op, ids: rows.toString()};
-
- xhrPost("backend.php", query, (transport) => {
- App.handleRpcJson(transport);
- Feeds.reloadCurrent();
- });
- },
catchupSelection: function () {
const rows = Headlines.getSelected();