new option: SYNC_COUNTERS (bump schema)

This commit is contained in:
Andrew Dolgov 2008-07-23 04:55:35 +01:00
parent 3e6623a99a
commit d234a2e39d
9 changed files with 29 additions and 6 deletions

View File

@ -214,7 +214,8 @@
} }
} }
if ($mode == "prefetch" && $csync) {
if (get_pref($link, "SYNC_COUNTERS") || ($mode == "prefetch" && $csync)) {
print "<counters>"; print "<counters>";
getAllCounters($link, $omode); getAllCounters($link, $omode);
print "</counters>"; print "</counters>";
@ -299,7 +300,8 @@
$viewfeed_ctr_interval = 60; $viewfeed_ctr_interval = 60;
} }
if (time() - $_SESSION["get_all_counters_stamp"] > $viewfeed_ctr_interval) { if (get_pref($link, "SYNC_COUNTERS") ||
time() - $_SESSION["get_all_counters_stamp"] > $viewfeed_ctr_interval) {
print "<counters>"; print "<counters>";
getAllCounters($link, $omode, $feed); getAllCounters($link, $omode, $feed);
print "</counters>"; print "</counters>";

View File

@ -542,7 +542,11 @@ function request_counters() {
var date = new Date(); var date = new Date();
var timestamp = Math.round(date.getTime() / 1000); var timestamp = Math.round(date.getTime() / 1000);
// if (getInitParam("sync_counters") == "1" ||
// timestamp - counters_last_request > 10) {
if (timestamp - counters_last_request > 10) { if (timestamp - counters_last_request > 10) {
debug("scheduling request of counters..."); debug("scheduling request of counters...");
window.setTimeout("request_counters_real()", 1000); window.setTimeout("request_counters_real()", 1000);
counters_last_request = timestamp; counters_last_request = timestamp;

View File

@ -2227,7 +2227,10 @@
/* getting all counters is a resource intensive operation, so we /* getting all counters is a resource intensive operation, so we
* rate limit it a little bit */ * rate limit it a little bit */
if (time() - $_SESSION["get_all_counters_stamp"] > 5) {
if (get_pref($link, "SYNC_COUNTERS") ||
time() - $_SESSION["get_all_counters_stamp"] > 5) {
if (!$omode) $omode = "flc"; if (!$omode) $omode = "flc";
@ -3018,6 +3021,9 @@
print "<param key=\"bw_limit\" value=\"". print "<param key=\"bw_limit\" value=\"".
(int) $_SESSION["bw_limit"]."\"/>"; (int) $_SESSION["bw_limit"]."\"/>";
print "<param key=\"sync_counters\" value=\"" .
(int) get_pref($link, "SYNC_COUNTERS") . "\"/>";
print "</init-params>"; print "</init-params>";
} }

View File

@ -72,5 +72,6 @@
__("Automatically expand articles in combined mode"); __("Automatically expand articles in combined mode");
__("Purge unread articles"); __("Purge unread articles");
__("Show special feeds when hiding read feeds"); __("Show special feeds when hiding read feeds");
__("Prefer more accurate feedlist counters to UI speed");
?> ?>

View File

@ -2,7 +2,7 @@
require_once "functions.php"; require_once "functions.php";
define('EXPECTED_CONFIG_VERSION', 17); define('EXPECTED_CONFIG_VERSION', 17);
define('SCHEMA_VERSION', 37); define('SCHEMA_VERSION', 38);
if (!file_exists("config.php")) { if (!file_exists("config.php")) {
print __("<b>Fatal Error</b>: You forgot to copy print __("<b>Fatal Error</b>: You forgot to copy

View File

@ -209,7 +209,7 @@ create table ttrss_tags (id integer primary key auto_increment,
create table ttrss_version (schema_version int not null) TYPE=InnoDB; create table ttrss_version (schema_version int not null) TYPE=InnoDB;
insert into ttrss_version values (37); insert into ttrss_version values (38);
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,
@ -332,6 +332,8 @@ insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('VFEED_GROUP_BY_FEED', 1, 'false', 'Group headlines in virtual feeds',2, insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('VFEED_GROUP_BY_FEED', 1, 'false', 'Group headlines in virtual feeds',2,
'When this option is enabled, headlines in Special feeds and Labels are grouped by feeds'); 'When this option is enabled, headlines in Special feeds and Labels are grouped by feeds');
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('SYNC_COUNTERS', 1, 'false', 'Prefer more accurate feedlist counters to UI speed',3);
create table ttrss_user_prefs ( create table ttrss_user_prefs (
owner_uid integer not null, owner_uid integer not null,
pref_name varchar(250), pref_name varchar(250),

View File

@ -189,7 +189,7 @@ create index ttrss_tags_owner_uid_index on ttrss_tags(owner_uid);
create table ttrss_version (schema_version int not null); create table ttrss_version (schema_version int not null);
insert into ttrss_version values (37); insert into ttrss_version values (38);
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,
@ -306,6 +306,8 @@ insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('VFEED_GROUP_BY_FEED', 1, 'false', 'Group headlines in virtual feeds',2, insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('VFEED_GROUP_BY_FEED', 1, 'false', 'Group headlines in virtual feeds',2,
'When this option is enabled, headlines in Special feeds and Labels are grouped by feeds'); 'When this option is enabled, headlines in Special feeds and Labels are grouped by feeds');
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('SYNC_COUNTERS', 1, 'false', 'Prefer more accurate feedlist counters to UI speed',3);
create table ttrss_user_prefs ( create table ttrss_user_prefs (
owner_uid integer not null references ttrss_users(id) ON DELETE CASCADE, owner_uid integer not null references ttrss_users(id) ON DELETE CASCADE,
pref_name varchar(250) not null references ttrss_prefs(pref_name) ON DELETE CASCADE, pref_name varchar(250) not null references ttrss_prefs(pref_name) ON DELETE CASCADE,

View File

@ -0,0 +1,3 @@
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('SYNC_COUNTERS', 1, 'false', 'Prefer more accurate feedlist counters to UI speed',3);
update ttrss_version set schema_version = 38;

View File

@ -0,0 +1,3 @@
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('SYNC_COUNTERS', 1, 'false', 'Prefer more accurate feedlist counters to UI speed',3);
update ttrss_version set schema_version = 38;