diff --git a/backend.php b/backend.php index 7a006a47..c7f0628c 100644 --- a/backend.php +++ b/backend.php @@ -596,7 +596,7 @@ $instance_id = db_fetch_result($result, 0, "id"); - $result = db_query($link, "SELECT feed_url, title, subscribers + $result = db_query($link, "SELECT feed_url, site_url, title, subscribers FROM ttrss_feedbrowser_cache ORDER BY subscribers DESC LIMIT 100"); $feeds = array(); diff --git a/functions.php b/functions.php index 7fd9df78..3978e5af 100644 --- a/functions.php +++ b/functions.php @@ -5881,11 +5881,11 @@ function update_feedbrowser_cache($link) { - $result = db_query($link, "SELECT feed_url,title, COUNT(id) AS subscribers + $result = db_query($link, "SELECT feed_url, site_url, title, COUNT(id) AS subscribers FROM ttrss_feeds WHERE (SELECT COUNT(id) = 0 FROM ttrss_feeds AS tf WHERE tf.feed_url = ttrss_feeds.feed_url AND (private IS true OR feed_url LIKE '%:%@%/%')) - GROUP BY feed_url, title ORDER BY subscribers DESC LIMIT 1000"); + GROUP BY feed_url, site_url, title ORDER BY subscribers DESC LIMIT 1000"); db_query($link, "BEGIN"); @@ -5897,6 +5897,7 @@ $subscribers = db_escape_string($line["subscribers"]); $feed_url = db_escape_string($line["feed_url"]); $title = db_escape_string($line["title"]); + $site_url = db_escape_string($line["site_url"]); $tmp_result = db_query($link, "SELECT subscribers FROM ttrss_feedbrowser_cache WHERE feed_url = '$feed_url'"); @@ -5904,8 +5905,8 @@ if (db_num_rows($tmp_result) == 0) { db_query($link, "INSERT INTO ttrss_feedbrowser_cache - (feed_url, title, subscribers) VALUES ('$feed_url', - '$title', '$subscribers')"); + (feed_url, site_url, title, subscribers) VALUES ('$feed_url', + '$site_url', '$title', '$subscribers')"); ++$count; diff --git a/sanity_check.php b/sanity_check.php index 9e4168b3..7d040e54 100644 --- a/sanity_check.php +++ b/sanity_check.php @@ -2,7 +2,7 @@ require_once "functions.php"; define('EXPECTED_CONFIG_VERSION', 22); - define('SCHEMA_VERSION', 84); + define('SCHEMA_VERSION', 85); if (!file_exists("config.php")) { print "Fatal Error: You forgot to copy diff --git a/schema/ttrss_schema_mysql.sql b/schema/ttrss_schema_mysql.sql index 61fcff45..9582c468 100644 --- a/schema/ttrss_schema_mysql.sql +++ b/schema/ttrss_schema_mysql.sql @@ -254,7 +254,7 @@ create table ttrss_tags (id integer primary key auto_increment, create table ttrss_version (schema_version int not null) TYPE=InnoDB DEFAULT CHARSET=UTF8; -insert into ttrss_version values (84); +insert into ttrss_version values (85); create table ttrss_enclosures (id integer primary key auto_increment, content_url text not null, @@ -404,6 +404,7 @@ create table ttrss_sessions (id varchar(250) unique not null primary key, create table ttrss_feedbrowser_cache ( feed_url text not null, + site_url text not null, title text not null, subscribers integer not null) DEFAULT CHARSET=UTF8; @@ -437,6 +438,7 @@ create table ttrss_linked_instances (id integer not null primary key auto_increm create table ttrss_linked_feeds ( feed_url text not null, + site_url text not null, title text not null, created datetime not null, updated datetime not null, diff --git a/schema/ttrss_schema_pgsql.sql b/schema/ttrss_schema_pgsql.sql index 67fe8a8d..68742653 100644 --- a/schema/ttrss_schema_pgsql.sql +++ b/schema/ttrss_schema_pgsql.sql @@ -225,7 +225,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 (84); +insert into ttrss_version values (85); create table ttrss_enclosures (id serial not null primary key, content_url text not null, @@ -368,6 +368,7 @@ create function SUBSTRING_FOR_DATE(timestamp, int, int) RETURNS text AS 'SELECT create table ttrss_feedbrowser_cache ( feed_url text not null primary key, title text not null, + site_url text not null, subscribers integer not null); create table ttrss_labels2 (id serial not null primary key, @@ -397,6 +398,7 @@ create table ttrss_linked_instances (id serial not null primary key, create table ttrss_linked_feeds ( feed_url text not null, + site_url text not null, title text not null, created timestamp not null, updated timestamp not null, diff --git a/schema/versions/mysql/85.sql b/schema/versions/mysql/85.sql new file mode 100644 index 00000000..70cab029 --- /dev/null +++ b/schema/versions/mysql/85.sql @@ -0,0 +1,13 @@ +begin; + +alter table ttrss_feedbrowser_cache add column site_url text; +update ttrss_feedbrowser_cache set site_url = ''; +alter table ttrss_feedbrowser_cache change site_url site_url text not null; + +alter table ttrss_linked_feeds add column site_url text; +update ttrss_linked_feeds set site_url = ''; +alter table ttrss_linked_feeds change site_url site_url text not null; + +update ttrss_version set schema_version = 85; + +commit; diff --git a/schema/versions/pgsql/85.sql b/schema/versions/pgsql/85.sql new file mode 100644 index 00000000..a0a78228 --- /dev/null +++ b/schema/versions/pgsql/85.sql @@ -0,0 +1,13 @@ +begin; + +alter table ttrss_feedbrowser_cache add column site_url text; +update ttrss_feedbrowser_cache set site_url = ''; +alter table ttrss_feedbrowser_cache alter column site_url set not null; + +alter table ttrss_linked_feeds add column site_url text; +update ttrss_linked_feeds set site_url = ''; +alter table ttrss_linked_feeds alter column site_url set not null; + +update ttrss_version set schema_version = 85; + +commit;