header("Pragma: no-cache");
header("Expires: -1");
- if ($_GET["debug"]) {
+/* if ($_GET["debug"]) {
define('DEFAULT_ERROR_LEVEL', E_ALL);
} else {
define('DEFAULT_ERROR_LEVEL', E_ERROR | E_WARNING | E_PARSE);
}
-
- error_reporting(DEFAULT_ERROR_LEVEL);
+
+ error_reporting(DEFAULT_ERROR_LEVEL); */
$op = $_REQUEST["op"];
// $content_query_part = "";
// }
- $result = db_query($link, "SELECT
+ $query = "SELECT
ttrss_entries.id,ttrss_entries.title,
SUBSTRING(updated,1,16) as updated,
unread,feed_id,marked,link,last_read,
$search_query_part
$view_query_part
$query_strategy_part ORDER BY $order_by
- $limit_query_part");
+ $limit_query_part";
+
+ $result = db_query($link, $query);
+
+ if ($_GET["debug"]) print $query;
} else {
// browsing by tag
notify("[all_counters_callback] backend did not return valid XML");
return;
}
-
+
+ if (!parent.frames["feeds-frame"]) {
+ notify("[all_counters_callback] no parent feeds-frame");
+ return;
+ }
+
var reply = xmlhttp_rpc.responseXML.firstChild;
var f_document = parent.frames["feeds-frame"].document;
<?
- if ($_GET["debug"]) {
+/* if ($_GET["debug"]) {
define('DEFAULT_ERROR_LEVEL', E_ALL);
} else {
define('DEFAULT_ERROR_LEVEL', E_ERROR | E_WARNING | E_PARSE);
- }
+ } */
require_once 'config.php';
require_once 'db-prefs.php';
function global_purge_old_posts($link, $do_output = false, $limit = false) {
- if (DB_TYPE == "mysql") {
- $random_qpart = "RAND()";
- } else {
- $random_qpart = "RANDOM()";
- }
+ $random_qpart = sql_random_function();
if ($limit) {
$limit_qpart = "LIMIT $limit";
}
}
+ function sql_random_function() {
+ if (DB_TYPE == "mysql") {
+ return "RAND()";
+ } else {
+ return "RANDOM()";
+ }
+ }
+
?>
author varchar(250) not null default '');
create index ttrss_entries_guid_index on ttrss_entries(guid);
-create index ttrss_entries_title_index on ttrss_entries(title);
-create index ttrss_entries_date_entered_index on ttrss_entries(date_entered);
+-- create index ttrss_entries_title_index on ttrss_entries(title);
+-- create index ttrss_entries_date_entered_index on ttrss_entries(date_entered);
create table ttrss_user_entries (
int_id serial not null primary key,
last_read timestamp,
unread boolean not null default true);
-create index ttrss_user_entries_feed_id_index on ttrss_user_entries(feed_id);
-create index ttrss_user_entries_owner_uid_index on ttrss_user_entries(owner_uid);
+-- create index ttrss_user_entries_feed_id_index on ttrss_user_entries(feed_id);
+-- create index ttrss_user_entries_owner_uid_index on ttrss_user_entries(owner_uid);
create index ttrss_user_entries_ref_id_index on ttrss_user_entries(ref_id);
+create index ttrss_user_entries_feed_id on ttrss_user_entries(feed_id);
create table ttrss_entry_comments (id serial not null primary key,
ref_id integer not null references ttrss_entries(id) ON DELETE CASCADE,
date_entered timestamp not null);
create index ttrss_entry_comments_ref_id_index on ttrss_entry_comments(ref_id);
-create index ttrss_entry_comments_owner_uid_index on ttrss_entry_comments(owner_uid);
+-- create index ttrss_entry_comments_owner_uid_index on ttrss_entry_comments(owner_uid);
create table ttrss_filter_types (id integer not null primary key,
name varchar(120) unique not null,
value text not null);
create index ttrss_user_prefs_owner_uid_index on ttrss_user_prefs(owner_uid);
-create index ttrss_user_prefs_value_index on ttrss_user_prefs(value);
+-- create index ttrss_user_prefs_value_index on ttrss_user_prefs(value);
create table ttrss_scheduled_updates (id serial not null primary key,
owner_uid integer not null references ttrss_users(id) ON DELETE CASCADE,
while (true) {
if (time() - $last_purge > PURGE_INTERVAL) {
- print "Purging old posts...\n";
- global_purge_old_posts($link, true);
+ print "Purging old posts (random 30 feeds)...\n";
+ global_purge_old_posts($link, true, 30);
$last_purge = time();
}
// Process all other feeds using last_updated and interval parameters
+ $random_qpart = sql_random_function();
+
$result = db_query($link, "SELECT feed_url,id,owner_uid,
SUBSTRING(last_updated,1,19) AS last_updated,
- update_interval FROM ttrss_feeds ORDER BY last_updated DESC");
+ update_interval FROM ttrss_feeds ORDER BY $random_qpart DESC");
$user_prefs_cache = array();
if (keycode == 82) { // r
return parent.scheduleFeedUpdate(true);
}
-
+
var f_doc = parent.frames["feeds-frame"].document;
var feedlist = f_doc.getElementById('feedList');
function init() {
if (arguments.callee.done) return;
arguments.callee.done = true;
- document.onkeydown = hotkey_handler;
+
+ if (parent.frames["feeds-frame"]) {
+ document.onkeydown = hotkey_handler;
+ }
var hw = document.getElementById("headlinesList").scrollHeight;
var pw = parent.document.getElementById("headlines").scrollHeight;