feedbrowser_cache & linked feeds: add site url (bump schema)

This commit is contained in:
Andrew Dolgov 2011-04-20 20:05:10 +04:00
parent 6f907113ef
commit 109662e12f
7 changed files with 39 additions and 8 deletions

View file

@ -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();

View file

@ -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;

View file

@ -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 "<b>Fatal Error</b>: You forgot to copy

View file

@ -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,

View file

@ -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,

View file

@ -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;

View file

@ -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;