summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xclasses/handler/public.php6
-rwxr-xr-xclasses/pref/feeds.php4
-rwxr-xr-xclasses/rpc.php4
-rwxr-xr-xclasses/rssutils.php15
-rwxr-xr-xinclude/functions.php2
-rw-r--r--schema/ttrss_schema_mysql.sql3
-rw-r--r--schema/ttrss_schema_pgsql.sql3
-rw-r--r--schema/versions/mysql/136.sql9
-rw-r--r--schema/versions/pgsql/136.sql9
9 files changed, 43 insertions, 12 deletions
diff --git a/classes/handler/public.php b/classes/handler/public.php
index 99c605dee..03c35f536 100755
--- a/classes/handler/public.php
+++ b/classes/handler/public.php
@@ -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>";
diff --git a/classes/pref/feeds.php b/classes/pref/feeds.php
index 6e0a68365..353775f4c 100755
--- a/classes/pref/feeds.php
+++ b/classes/pref/feeds.php
@@ -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]);
diff --git a/classes/rpc.php b/classes/rpc.php
index 7220e10ea..76cca6f8e 100755
--- a/classes/rpc.php
+++ b/classes/rpc.php
@@ -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]);
diff --git a/classes/rssutils.php b/classes/rssutils.php
index 6048c8310..8684a2c5d 100755
--- a/classes/rssutils.php
+++ b/classes/rssutils.php
@@ -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.");
diff --git a/include/functions.php b/include/functions.php
index d93be856d..2ab43e0b6 100755
--- a/include/functions.php
+++ b/include/functions.php
@@ -1,6 +1,6 @@
<?php
define('EXPECTED_CONFIG_VERSION', 26);
- define('SCHEMA_VERSION', 135);
+ define('SCHEMA_VERSION', 136);
define('LABEL_BASE_INDEX', -1024);
define('PLUGIN_FEED_BASE_INDEX', -128);
diff --git a/schema/ttrss_schema_mysql.sql b/schema/ttrss_schema_mysql.sql
index 81f941127..7f7a834df 100644
--- a/schema/ttrss_schema_mysql.sql
+++ b/schema/ttrss_schema_mysql.sql
@@ -69,6 +69,7 @@ create table ttrss_feed_categories(id integer not null primary key auto_incremen
create table ttrss_archived_feeds (id integer not null primary key,
owner_uid integer not null,
+ created datetime not null,
title varchar(200) not null,
feed_url text not null,
site_url varchar(250) not null default '',
@@ -285,7 +286,7 @@ create table ttrss_tags (id integer primary key auto_increment,
create table ttrss_version (schema_version int not null) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
-insert into ttrss_version values (135);
+insert into ttrss_version values (136);
create table ttrss_enclosures (id integer primary key auto_increment,
content_url text not null,
diff --git a/schema/ttrss_schema_pgsql.sql b/schema/ttrss_schema_pgsql.sql
index 3f0e012b3..ca78dd2dc 100644
--- a/schema/ttrss_schema_pgsql.sql
+++ b/schema/ttrss_schema_pgsql.sql
@@ -109,6 +109,7 @@ insert into ttrss_feeds (owner_uid, title, feed_url) values
create table ttrss_archived_feeds (id integer not null primary key,
owner_uid integer not null references ttrss_users(id) on delete cascade,
+ created timestamp not null,
title varchar(200) not null,
feed_url text not null,
site_url varchar(250) not null default '');
@@ -267,7 +268,7 @@ create index ttrss_tags_post_int_id_idx on ttrss_tags(post_int_id);
create table ttrss_version (schema_version int not null);
-insert into ttrss_version values (135);
+insert into ttrss_version values (136);
create table ttrss_enclosures (id serial not null primary key,
content_url text not null,
diff --git a/schema/versions/mysql/136.sql b/schema/versions/mysql/136.sql
new file mode 100644
index 000000000..b4dd70d9b
--- /dev/null
+++ b/schema/versions/mysql/136.sql
@@ -0,0 +1,9 @@
+begin;
+
+alter table ttrss_archived_feeds add column created datetime;
+update ttrss_version set schema_version = 136;
+alter table ttrss_archived_feeds alter column created set not null;
+
+update ttrss_archived_feeds set created = NOW();
+
+commit;
diff --git a/schema/versions/pgsql/136.sql b/schema/versions/pgsql/136.sql
new file mode 100644
index 000000000..d74136537
--- /dev/null
+++ b/schema/versions/pgsql/136.sql
@@ -0,0 +1,9 @@
+begin;
+
+alter table ttrss_archived_feeds add column created timestamp;
+update ttrss_archived_feeds set created = NOW();
+alter table ttrss_archived_feeds alter column created set not null;
+
+update ttrss_version set schema_version = 136;
+
+commit;