mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-13 09:15:55 +00:00
archived feeds: expire old entries (schema bump)
This commit is contained in:
@@ -1137,10 +1137,8 @@ class Handler_Public extends Handler {
|
||||
|
||||
print "<h3>" . T_sprintf("Updating to schema version %d", SCHEMA_VERSION) . "</h3>";
|
||||
|
||||
print "<ul>";
|
||||
|
||||
for ($i = $updater->getSchemaVersion() + 1; $i <= SCHEMA_VERSION; $i++) {
|
||||
print "<li>" . T_sprintf("Performing update up to version %d...", $i);
|
||||
print_notice(T_sprintf("Performing update up to version %d...", $i));
|
||||
|
||||
$result = $updater->performUpdateTo($i, true);
|
||||
|
||||
@@ -1157,8 +1155,6 @@ class Handler_Public extends Handler {
|
||||
}
|
||||
}
|
||||
|
||||
print "</ul>";
|
||||
|
||||
print_notice("Your Tiny Tiny RSS database is now updated to the latest version.");
|
||||
|
||||
print "<a href='index.php'>".__("Return to Tiny Tiny RSS")."</a>";
|
||||
|
||||
@@ -1635,8 +1635,8 @@ class Pref_Feeds extends Handler_Protected {
|
||||
$new_feed_id = (int)$row['id'] + 1;
|
||||
|
||||
$sth = $pdo->prepare("INSERT INTO ttrss_archived_feeds
|
||||
(id, owner_uid, title, feed_url, site_url)
|
||||
SELECT ?, owner_uid, title, feed_url, site_url from ttrss_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]);
|
||||
|
||||
|
||||
@@ -240,8 +240,8 @@ class RPC extends Handler_Protected {
|
||||
$new_feed_id = (int)$row['id'] + 1;
|
||||
|
||||
$sth = $this->pdo->prepare("INSERT INTO ttrss_archived_feeds
|
||||
(id, owner_uid, title, feed_url, site_url)
|
||||
SELECT ?, owner_uid, title, feed_url, site_url from ttrss_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]);
|
||||
|
||||
@@ -1288,6 +1288,20 @@ class RSSUtils {
|
||||
}
|
||||
}
|
||||
|
||||
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)");
|
||||
}
|
||||
}
|
||||
|
||||
static function expire_lock_files() {
|
||||
Debug::log("Removing old lock files...", Debug::$LOG_VERBOSE);
|
||||
|
||||
@@ -1526,6 +1540,7 @@ class RSSUtils {
|
||||
RSSUtils::expire_cached_files();
|
||||
RSSUtils::expire_lock_files();
|
||||
RSSUtils::expire_error_log();
|
||||
RSSUtils::expire_feed_archive();
|
||||
|
||||
$count = RSSUtils::update_feedbrowser_cache();
|
||||
Debug::log("Feedbrowser updated, $count feeds processed.");
|
||||
|
||||
Reference in New Issue
Block a user