disable headline cache when searching

master
Andrew Dolgov 17 years ago
parent 7e8832b3e2
commit 52d7e7da48

@ -227,6 +227,7 @@
$topmost_article_ids = $ret[0]; $topmost_article_ids = $ret[0];
$headlines_count = $ret[1]; $headlines_count = $ret[1];
$returned_feed = $ret[2]; $returned_feed = $ret[2];
$disable_cache = $ret[3];
print "]]></headlines>"; print "]]></headlines>";
@ -235,6 +236,7 @@
$headlines_unread = getFeedUnread($link, $returned_feed); $headlines_unread = getFeedUnread($link, $returned_feed);
print "<headlines-unread value=\"$headlines_unread\"/>"; print "<headlines-unread value=\"$headlines_unread\"/>";
printf("<disable-cache value=\"%d\"/>", $disable_cache);
if ($_GET["debug"]) $timing_info = print_checkpoint("10", $timing_info); if ($_GET["debug"]) $timing_info = print_checkpoint("10", $timing_info);

@ -36,6 +36,8 @@ function viewfeed(feed, subop, is_cat, subop_param, skip_history, offset) {
// if (!offset) page_offset = 0; // if (!offset) page_offset = 0;
var force_nocache = false;
var page_offset = 0; var page_offset = 0;
if (offset > 0) { if (offset > 0) {
@ -76,6 +78,9 @@ function viewfeed(feed, subop, is_cat, subop_param, skip_history, offset) {
var toolbar_query = Form.serialize("main_toolbar_form"); var toolbar_query = Form.serialize("main_toolbar_form");
if (toolbar_form.query) { if (toolbar_form.query) {
if (toolbar_form.query.value != "") {
force_nocache = true;
}
toolbar_form.query.value = ""; toolbar_form.query.value = "";
} }
@ -86,6 +91,7 @@ function viewfeed(feed, subop, is_cat, subop_param, skip_history, offset) {
var search_query = Form.serialize("search_form"); var search_query = Form.serialize("search_form");
query = query + "&" + search_query; query = query + "&" + search_query;
closeInfoBox(true); closeInfoBox(true);
force_nocache = true;
} }
// debug("IS_CAT_STORED: " + activeFeedIsCat() + ", IS_CAT: " + is_cat); // debug("IS_CAT_STORED: " + activeFeedIsCat() + ", IS_CAT: " + is_cat);
@ -146,7 +152,7 @@ function viewfeed(feed, subop, is_cat, subop_param, skip_history, offset) {
var unread_ctr = document.getElementById("FEEDU-" + feed); var unread_ctr = document.getElementById("FEEDU-" + feed);
var cache_check = false; var cache_check = false;
if (unread_ctr && !page_offset) { if (unread_ctr && !page_offset && !force_nocache) {
unread_ctr = unread_ctr.innerHTML; unread_ctr = unread_ctr.innerHTML;
var cache_prefix = ""; var cache_prefix = "";

@ -4519,6 +4519,8 @@
function outputHeadlinesList($link, $feed, $subop, $view_mode, $limit, $cat_view, function outputHeadlinesList($link, $feed, $subop, $view_mode, $limit, $cat_view,
$next_unread_feed, $offset) { $next_unread_feed, $offset) {
$disable_cache = false;
$timing_info = getmicrotime(); $timing_info = getmicrotime();
$topmost_article_ids = array(); $topmost_article_ids = array();
@ -4586,6 +4588,11 @@
/// START ///////////////////////////////////////////////////////////////////////////////// /// START /////////////////////////////////////////////////////////////////////////////////
$search = db_escape_string($_GET["query"]); $search = db_escape_string($_GET["query"]);
if ($search) {
$disable_cache = true;
}
$search_mode = db_escape_string($_GET["search_mode"]); $search_mode = db_escape_string($_GET["search_mode"]);
$match_on = db_escape_string($_GET["match_on"]); $match_on = db_escape_string($_GET["match_on"]);
@ -4952,7 +4959,7 @@
print "</div>"; print "</div>";
} }
return array($topmost_article_ids, $headlines_count, $feed); return array($topmost_article_ids, $headlines_count, $feed, $disable_cache);
} }
// from here: http://www.roscripts.com/Create_tag_cloud-71.html // from here: http://www.roscripts.com/Create_tag_cloud-71.html

@ -91,9 +91,11 @@ function headlines_callback2(transport, active_feed_id, is_cat, feed_cur_page) {
var headlines = transport.responseXML.getElementsByTagName("headlines")[0]; var headlines = transport.responseXML.getElementsByTagName("headlines")[0];
var headlines_count_obj = transport.responseXML.getElementsByTagName("headlines-count")[0]; var headlines_count_obj = transport.responseXML.getElementsByTagName("headlines-count")[0];
var headlines_unread_obj = transport.responseXML.getElementsByTagName("headlines-unread")[0]; var headlines_unread_obj = transport.responseXML.getElementsByTagName("headlines-unread")[0];
var disable_cache_obj = transport.responseXML.getElementsByTagName("disable-cache")[0];
var headlines_count = headlines_count_obj.getAttribute("value"); var headlines_count = headlines_count_obj.getAttribute("value");
var headlines_unread = headlines_unread_obj.getAttribute("value"); var headlines_unread = headlines_unread_obj.getAttribute("value");
var disable_cache = disable_cache_obj.getAttribute("value") != "0";
if (headlines_count == 0) _infscroll_disable = 1; if (headlines_count == 0) _infscroll_disable = 1;
@ -115,8 +117,10 @@ function headlines_callback2(transport, active_feed_id, is_cat, feed_cur_page) {
cache_invalidate(cache_prefix + active_feed_id); cache_invalidate(cache_prefix + active_feed_id);
cache_inject(cache_prefix + active_feed_id, if (!disable_cache) {
headlines.firstChild.nodeValue, headlines_unread); cache_inject(cache_prefix + active_feed_id,
headlines.firstChild.nodeValue, headlines_unread);
}
} else { } else {
debug("headlines_callback: returned no data"); debug("headlines_callback: returned no data");

Loading…
Cancel
Save