From 0b74db5ad7b3b93cf97b7fa65b467f929f6b232f Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 6 Mar 2019 20:02:06 +0300 Subject: [PATCH] remove feedbrowser (other feeds) --- classes/feeds.php | 55 +-------------------- classes/rpc.php | 14 ------ classes/rssutils.php | 50 ------------------- include/feedbrowser.php | 106 ---------------------------------------- update.php | 7 --- 5 files changed, 1 insertion(+), 231 deletions(-) delete mode 100644 include/feedbrowser.php diff --git a/classes/feeds.php b/classes/feeds.php index 5daed696a..f7a6aea7b 100755 --- a/classes/feeds.php +++ b/classes/feeds.php @@ -6,7 +6,7 @@ class Feeds extends Handler_Protected { private $params; function csrf_ignore($method) { - $csrf_ignored = array("index", "feedbrowser", "quickaddfeed", "search"); + $csrf_ignored = array("index", "quickaddfeed", "search"); return array_search($method, $csrf_ignored) !== false; } @@ -707,65 +707,12 @@ class Feeds extends Handler_Protected { print ""; - if (!(defined('_DISABLE_FEED_BROWSER') && _DISABLE_FEED_BROWSER)) { - print ""; - } - print ""; print ""; print ""; } - function feedBrowser() { - if (defined('_DISABLE_FEED_BROWSER') && _DISABLE_FEED_BROWSER) return; - - $browser_search = $_REQUEST["search"]; - - print_hidden("op", "rpc"); - print_hidden("method", "updateFeedBrowser"); - - print "
-
- - - -
"; - - print " "; - - print __("limit:"); - - print " "; - - print "
"; - - require_once "feedbrowser.php"; - - print ""; - - print ""; - - } - function search() { $this->params = explode(":", $_REQUEST["param"], 2); diff --git a/classes/rpc.php b/classes/rpc.php index 76cca6f8e..037e14132 100755 --- a/classes/rpc.php +++ b/classes/rpc.php @@ -347,20 +347,6 @@ class RPC extends Handler_Protected { print ""; } - function updateFeedBrowser() { - if (defined('_DISABLE_FEED_BROWSER') && _DISABLE_FEED_BROWSER) return; - - $search = clean($_REQUEST["search"]); - $limit = clean($_REQUEST["limit"]); - $mode = (int) clean($_REQUEST["mode"]); - - require_once "feedbrowser.php"; - - print json_encode(array("content" => - make_feed_browser($search, $limit, $mode), - "mode" => $mode)); - } - // Silent function massSubscribe() { diff --git a/classes/rssutils.php b/classes/rssutils.php index 8684a2c5d..36236bafe 100755 --- a/classes/rssutils.php +++ b/classes/rssutils.php @@ -19,53 +19,6 @@ class RSSUtils { return preg_replace('/[\x{10000}-\x{10FFFF}]/u', "\xEF\xBF\xBD", $str); } - static function update_feedbrowser_cache() { - - $pdo = Db::pdo(); - - $sth = $pdo->query("SELECT feed_url, site_url, title, COUNT(id) AS subscribers - FROM ttrss_feeds WHERE feed_url NOT IN (SELECT feed_url FROM ttrss_feeds - WHERE private IS true OR auth_login != '' OR auth_pass != '' OR feed_url LIKE '%:%@%/%') - GROUP BY feed_url, site_url, title ORDER BY subscribers DESC LIMIT 1000"); - - $pdo->beginTransaction(); - - $pdo->query("DELETE FROM ttrss_feedbrowser_cache"); - - $count = 0; - - while ($line = $sth->fetch()) { - - $subscribers = $line["subscribers"]; - $feed_url = $line["feed_url"]; - $title = $line["title"]; - $site_url = $line["site_url"]; - - $tmph = $pdo->prepare("SELECT subscribers FROM - ttrss_feedbrowser_cache WHERE feed_url = ?"); - $tmph->execute([$feed_url]); - - if (!$tmph->fetch()) { - - $tmph = $pdo->prepare("INSERT INTO ttrss_feedbrowser_cache - (feed_url, site_url, title, subscribers) - VALUES - (?, ?, ?, ?)"); - - $tmph->execute([$feed_url, $site_url, $title, $subscribers]); - - ++$count; - - } - - } - - $pdo->commit(); - - return $count; - - } - static function update_daemon_common($limit = DAEMON_FEED_LIMIT) { $schema_version = get_schema_version(); @@ -1542,9 +1495,6 @@ class RSSUtils { RSSUtils::expire_error_log(); RSSUtils::expire_feed_archive(); - $count = RSSUtils::update_feedbrowser_cache(); - Debug::log("Feedbrowser updated, $count feeds processed."); - Article::purge_orphans(); RSSUtils::cleanup_counters_cache(); diff --git a/include/feedbrowser.php b/include/feedbrowser.php deleted file mode 100644 index 77ae9d649..000000000 --- a/include/feedbrowser.php +++ /dev/null @@ -1,106 +0,0 @@ -quote($search); - - $search_qpart = "AND (UPPER(feed_url) LIKE UPPER('%$search%') OR - UPPER(title) LIKE UPPER('%$search%'))"; - } else { - $search_qpart = ""; - } - - if ($mode == 1) { - $sth = $pdo->prepare("SELECT feed_url, site_url, title, SUM(subscribers) AS subscribers FROM - (SELECT feed_url, site_url, title, subscribers FROM ttrss_feedbrowser_cache UNION ALL - SELECT feed_url, site_url, title, subscribers FROM ttrss_linked_feeds) AS qqq - WHERE - (SELECT COUNT(id) = 0 FROM ttrss_feeds AS tf - WHERE tf.feed_url = qqq.feed_url - AND owner_uid = ?) $search_qpart - GROUP BY feed_url, site_url, title ORDER BY subscribers DESC LIMIT " . (int)$limit); - $sth->execute([$_SESSION['uid']]); - - } else if ($mode == 2) { - $sth = $pdo->prepare("SELECT *, - (SELECT COUNT(*) FROM ttrss_user_entries WHERE - orig_feed_id = ttrss_archived_feeds.id) AS articles_archived - FROM - ttrss_archived_feeds - WHERE - (SELECT COUNT(*) FROM ttrss_feeds - WHERE ttrss_feeds.feed_url = ttrss_archived_feeds.feed_url AND - owner_uid = :uid) = 0 AND - owner_uid = :uid $search_qpart - ORDER BY id DESC LIMIT " . (int)$limit); - - $sth->execute([":uid" => $_SESSION['uid']]); - } - - $feedctr = 0; - - while ($line = $sth->fetch()) { - - if ($mode == 1) { - - $feed_url = htmlspecialchars($line["feed_url"]); - $site_url = htmlspecialchars($line["site_url"]); - $subscribers = $line["subscribers"]; - - $check_box = ""; - - $site_url = " - ". - htmlspecialchars($line["title"]).""; - - $feed_url = "rss_feed"; - - $rv .= "
  • $check_box $feed_url $site_url". - " ($subscribers)
  • "; - - } else if ($mode == 2) { - $feed_url = htmlspecialchars($line["feed_url"]); - $site_url = htmlspecialchars($line["site_url"]); - - $check_box = ""; - - if ($line['articles_archived'] > 0) { - $archived = sprintf(_ngettext("%d archived article", "%d archived articles", (int) $line['articles_archived']), $line['articles_archived']); - $archived = " ($archived)"; - } else { - $archived = ''; - } - - $site_url = " - ". - htmlspecialchars($line["title"]).""; - - $feed_url = "rss_feed"; - - - $rv .= "
  • ". - "$check_box $feed_url $site_url $archived
  • "; - } - - ++$feedctr; - } - - if ($feedctr == 0) { - $rv .= "
  • ".__('No feeds found.')."

  • "; - } - - return $rv; - } diff --git a/update.php b/update.php index 21aa09d01..1dc2efd91 100755 --- a/update.php +++ b/update.php @@ -22,7 +22,6 @@ init_plugins(); $longopts = array("feeds", - "feedbrowser", "daemon", "daemon-loop", "task:", @@ -78,7 +77,6 @@ print "Tiny Tiny RSS data update script.\n\n"; print "Options:\n"; print " --feeds - update feeds\n"; - print " --feedbrowser - update feedbrowser\n"; print " --daemon - start single-process update daemon\n"; print " --task N - create lockfile using this task id\n"; print " --cleanup-tags - perform tags table maintenance\n"; @@ -181,11 +179,6 @@ PluginHost::getInstance()->run_hooks(PluginHost::HOOK_UPDATE_TASK, "hook_update_task", $op); } - if (isset($options["feedbrowser"])) { - $count = RSSUtils::update_feedbrowser_cache(); - print "Finished, $count feeds processed.\n"; - } - if (isset($options["daemon"])) { while (true) { $quiet = (isset($options["quiet"])) ? "--quiet" : "";