Merge branch 'master' of git.fakecake.org:tt-rss into pdo-experimental
This commit is contained in:
commit
d9e60c0f68
6 changed files with 37 additions and 16 deletions
|
@ -312,7 +312,8 @@ class RSSUtils {
|
||||||
feed_url,auth_pass,cache_images,
|
feed_url,auth_pass,cache_images,
|
||||||
mark_unread_on_update, owner_uid,
|
mark_unread_on_update, owner_uid,
|
||||||
auth_pass_encrypted, feed_language,
|
auth_pass_encrypted, feed_language,
|
||||||
last_modified
|
last_modified,
|
||||||
|
".SUBSTRING_FOR_DATE."(last_unconditional, 1, 19) AS last_unconditional
|
||||||
FROM ttrss_feeds WHERE id = '$feed'");
|
FROM ttrss_feeds WHERE id = '$feed'");
|
||||||
|
|
||||||
$owner_uid = db_fetch_result($result, 0, "owner_uid");
|
$owner_uid = db_fetch_result($result, 0, "owner_uid");
|
||||||
|
@ -333,6 +334,7 @@ class RSSUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
$stored_last_modified = db_fetch_result($result, 0, "last_modified");
|
$stored_last_modified = db_fetch_result($result, 0, "last_modified");
|
||||||
|
$last_unconditional = db_fetch_result($result, 0, "last_unconditional");
|
||||||
$cache_images = sql_bool_to_bool(db_fetch_result($result, 0, "cache_images"));
|
$cache_images = sql_bool_to_bool(db_fetch_result($result, 0, "cache_images"));
|
||||||
$fetch_url = db_fetch_result($result, 0, "feed_url");
|
$fetch_url = db_fetch_result($result, 0, "feed_url");
|
||||||
$feed_language = db_escape_string(mb_strtolower(db_fetch_result($result, 0, "feed_language")));
|
$feed_language = db_escape_string(mb_strtolower(db_fetch_result($result, 0, "feed_language")));
|
||||||
|
@ -384,21 +386,21 @@ class RSSUtils {
|
||||||
|
|
||||||
// fetch feed from source
|
// fetch feed from source
|
||||||
if (!$feed_data) {
|
if (!$feed_data) {
|
||||||
_debug("stored last modified: $stored_last_modified", $debug_enabled);
|
_debug("last unconditional update request: $last_unconditional");
|
||||||
_debug("fetching [$fetch_url]...", $debug_enabled);
|
|
||||||
|
|
||||||
if (ini_get("open_basedir") && function_exists("curl_init")) {
|
if (ini_get("open_basedir") && function_exists("curl_init")) {
|
||||||
_debug("not using CURL due to open_basedir restrictions");
|
_debug("not using CURL due to open_basedir restrictions");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*$feed_data = fetch_file_contents($fetch_url, false,
|
if (time() - strtotime($last_unconditional) > MAX_CONDITIONAL_INTERVAL) {
|
||||||
$auth_login, $auth_pass, false,
|
_debug("maximum allowed interval for conditional requests exceeded, forcing refetch");
|
||||||
$no_cache ? FEED_FETCH_NO_CACHE_TIMEOUT : FEED_FETCH_TIMEOUT,
|
|
||||||
0);*/
|
|
||||||
|
|
||||||
// TODO: last_modified should be limited, if the feed has not been updated for a while
|
$force_refetch = true;
|
||||||
// we probably should force one update without the header
|
} else {
|
||||||
// unfortunately last_updated gets bumped on http 304 so that daemon would work properly
|
_debug("stored last modified for conditional request: $stored_last_modified", $debug_enabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
_debug("fetching [$fetch_url] (force_refetch: $force_refetch)...", $debug_enabled);
|
||||||
|
|
||||||
$feed_data = fetch_file_contents([
|
$feed_data = fetch_file_contents([
|
||||||
"url" => $fetch_url,
|
"url" => $fetch_url,
|
||||||
|
@ -553,7 +555,7 @@ class RSSUtils {
|
||||||
_debug("no articles found.", $debug_enabled);
|
_debug("no articles found.", $debug_enabled);
|
||||||
|
|
||||||
db_query("UPDATE ttrss_feeds
|
db_query("UPDATE ttrss_feeds
|
||||||
SET last_updated = NOW(), last_error = '' WHERE id = '$feed'");
|
SET last_updated = NOW(), last_unconditional = NOW(), last_error = '' WHERE id = '$feed'");
|
||||||
|
|
||||||
return; // no articles
|
return; // no articles
|
||||||
}
|
}
|
||||||
|
@ -1140,7 +1142,7 @@ class RSSUtils {
|
||||||
purge_feed($feed, 0, $debug_enabled);
|
purge_feed($feed, 0, $debug_enabled);
|
||||||
|
|
||||||
db_query("UPDATE ttrss_feeds
|
db_query("UPDATE ttrss_feeds
|
||||||
SET last_updated = NOW(), last_error = '' WHERE id = '$feed'");
|
SET last_updated = NOW(), last_unconditional = NOW(), last_error = '' WHERE id = '$feed'");
|
||||||
|
|
||||||
// db_query("COMMIT");
|
// db_query("COMMIT");
|
||||||
|
|
||||||
|
@ -1158,7 +1160,7 @@ class RSSUtils {
|
||||||
|
|
||||||
db_query(
|
db_query(
|
||||||
"UPDATE ttrss_feeds SET last_error = '$error_msg',
|
"UPDATE ttrss_feeds SET last_error = '$error_msg',
|
||||||
last_updated = NOW() WHERE id = '$feed'");
|
last_updated = NOW(), last_unconditional = NOW() WHERE id = '$feed'");
|
||||||
|
|
||||||
unset($rss);
|
unset($rss);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
define('EXPECTED_CONFIG_VERSION', 26);
|
define('EXPECTED_CONFIG_VERSION', 26);
|
||||||
define('SCHEMA_VERSION', 132);
|
define('SCHEMA_VERSION', 133);
|
||||||
|
|
||||||
define('LABEL_BASE_INDEX', -1024);
|
define('LABEL_BASE_INDEX', -1024);
|
||||||
define('PLUGIN_FEED_BASE_INDEX', -128);
|
define('PLUGIN_FEED_BASE_INDEX', -128);
|
||||||
|
@ -57,6 +57,9 @@
|
||||||
// do not cache files smaller than that (bytes)
|
// do not cache files smaller than that (bytes)
|
||||||
define_default('CACHE_MAX_DAYS', 7);
|
define_default('CACHE_MAX_DAYS', 7);
|
||||||
// max age in days for various automatically cached (temporary) files
|
// max age in days for various automatically cached (temporary) files
|
||||||
|
define_default('MAX_CONDITIONAL_INTERVAL', 3600*6);
|
||||||
|
// max interval between forced unconditional updates for servers
|
||||||
|
// not complying with http if-modified-since (seconds)
|
||||||
|
|
||||||
/* tunables end here */
|
/* tunables end here */
|
||||||
|
|
||||||
|
|
|
@ -102,6 +102,7 @@ create table ttrss_feeds (id integer not null auto_increment primary key,
|
||||||
update_interval integer not null default 0,
|
update_interval integer not null default 0,
|
||||||
purge_interval integer not null default 0,
|
purge_interval integer not null default 0,
|
||||||
last_updated datetime default null,
|
last_updated datetime default null,
|
||||||
|
last_unconditional datetime default null,
|
||||||
last_error varchar(250) not null default '',
|
last_error varchar(250) not null default '',
|
||||||
last_modified varchar(250) not null default '',
|
last_modified varchar(250) not null default '',
|
||||||
favicon_avg_color varchar(11) default null,
|
favicon_avg_color varchar(11) default null,
|
||||||
|
@ -283,7 +284,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;
|
create table ttrss_version (schema_version int not null) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
|
||||||
|
|
||||||
insert into ttrss_version values (132);
|
insert into ttrss_version values (133);
|
||||||
|
|
||||||
create table ttrss_enclosures (id integer primary key auto_increment,
|
create table ttrss_enclosures (id integer primary key auto_increment,
|
||||||
content_url text not null,
|
content_url text not null,
|
||||||
|
|
|
@ -72,6 +72,7 @@ create table ttrss_feeds (id serial not null primary key,
|
||||||
update_interval integer not null default 0,
|
update_interval integer not null default 0,
|
||||||
purge_interval integer not null default 0,
|
purge_interval integer not null default 0,
|
||||||
last_updated timestamp default null,
|
last_updated timestamp default null,
|
||||||
|
last_unconditional timestamp default null,
|
||||||
last_error text not null default '',
|
last_error text not null default '',
|
||||||
last_modified text not null default '',
|
last_modified text not null default '',
|
||||||
favicon_avg_color varchar(11) default null,
|
favicon_avg_color varchar(11) default null,
|
||||||
|
@ -265,7 +266,7 @@ create index ttrss_tags_post_int_id_idx on ttrss_tags(post_int_id);
|
||||||
|
|
||||||
create table ttrss_version (schema_version int not null);
|
create table ttrss_version (schema_version int not null);
|
||||||
|
|
||||||
insert into ttrss_version values (132);
|
insert into ttrss_version values (133);
|
||||||
|
|
||||||
create table ttrss_enclosures (id serial not null primary key,
|
create table ttrss_enclosures (id serial not null primary key,
|
||||||
content_url text not null,
|
content_url text not null,
|
||||||
|
|
7
schema/versions/mysql/133.sql
Normal file
7
schema/versions/mysql/133.sql
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
begin;
|
||||||
|
|
||||||
|
alter table ttrss_feeds add column last_unconditional datetime null;
|
||||||
|
|
||||||
|
UPDATE ttrss_version SET schema_version = 133;
|
||||||
|
|
||||||
|
commit;
|
7
schema/versions/pgsql/133.sql
Normal file
7
schema/versions/pgsql/133.sql
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
begin;
|
||||||
|
|
||||||
|
alter table ttrss_feeds add column last_unconditional timestamp null;
|
||||||
|
|
||||||
|
UPDATE ttrss_version SET schema_version = 133;
|
||||||
|
|
||||||
|
commit;
|
Loading…
Reference in a new issue