mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-18 17:01:29 +00:00
getLabelCounters: skip processing when labels are disabled; misc performance tweaks
This commit is contained in:
@@ -358,7 +358,7 @@
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
if (get_pref($link, 'COMBINED_DISPLAY_MODE') || $subop ||
|
if (get_pref($link, 'COMBINED_DISPLAY_MODE') || $subop ||
|
||||||
time() - $_SESSION["viewfeed:counters_stamp"] > 30) {
|
time() - $_SESSION["viewfeed:counters_stamp"] > 60) {
|
||||||
if (!$offset) {
|
if (!$offset) {
|
||||||
print "<counters>";
|
print "<counters>";
|
||||||
getAllCounters($link, $omode, $feed);
|
getAllCounters($link, $omode, $feed);
|
||||||
|
|||||||
@@ -2678,47 +2678,49 @@
|
|||||||
$ret_arr["-3"]["description"] = __("Fresh articles");
|
$ret_arr["-3"]["description"] = __("Fresh articles");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (GLOBAL_ENABLE_LABELS && get_pref($link, 'ENABLE_LABELS')) {
|
||||||
|
|
||||||
$result = db_query($link, "SELECT owner_uid,id,sql_exp,description FROM
|
$result = db_query($link, "SELECT owner_uid,id,sql_exp,description FROM
|
||||||
ttrss_labels WHERE owner_uid = ".$_SESSION["uid"]." ORDER by description");
|
ttrss_labels WHERE owner_uid = ".$_SESSION["uid"]." ORDER by description");
|
||||||
|
|
||||||
|
while ($line = db_fetch_assoc($result)) {
|
||||||
|
|
||||||
while ($line = db_fetch_assoc($result)) {
|
$id = -$line["id"] - 11;
|
||||||
|
|
||||||
$id = -$line["id"] - 11;
|
$label_name = $line["description"];
|
||||||
|
|
||||||
$label_name = $line["description"];
|
error_reporting (0);
|
||||||
|
|
||||||
error_reporting (0);
|
$tmp_result = db_query($link, "SELECT count(ttrss_entries.id) as count FROM ttrss_user_entries,ttrss_entries,ttrss_feeds
|
||||||
|
WHERE (" . $line["sql_exp"] . ") AND unread = true AND
|
||||||
$tmp_result = db_query($link, "SELECT count(ttrss_entries.id) as count FROM ttrss_user_entries,ttrss_entries,ttrss_feeds
|
ttrss_feeds.hidden = false AND
|
||||||
WHERE (" . $line["sql_exp"] . ") AND unread = true AND
|
$age_qpart AND
|
||||||
ttrss_feeds.hidden = false AND
|
ttrss_user_entries.feed_id = ttrss_feeds.id AND
|
||||||
$age_qpart AND
|
ttrss_user_entries.ref_id = ttrss_entries.id AND
|
||||||
ttrss_user_entries.feed_id = ttrss_feeds.id AND
|
ttrss_user_entries.owner_uid = ".$_SESSION["uid"]);
|
||||||
ttrss_user_entries.ref_id = ttrss_entries.id AND
|
|
||||||
ttrss_user_entries.owner_uid = ".$_SESSION["uid"]);
|
$count = db_fetch_result($tmp_result, 0, "count");
|
||||||
|
|
||||||
$count = db_fetch_result($tmp_result, 0, "count");
|
if (!$smart_mode || $old_counters[$id] != $count) {
|
||||||
|
$old_counters[$id] = $count;
|
||||||
if (!$smart_mode || $old_counters[$id] != $count) {
|
$lctrs_modified = true;
|
||||||
$old_counters[$id] = $count;
|
if (!$ret_mode) {
|
||||||
$lctrs_modified = true;
|
|
||||||
if (!$ret_mode) {
|
if (get_pref($link, 'EXTENDED_FEEDLIST')) {
|
||||||
|
$xmsg_part = "xmsg=\"(" . getFeedArticles($link, $id) . " total)\"";
|
||||||
if (get_pref($link, 'EXTENDED_FEEDLIST')) {
|
} else {
|
||||||
$xmsg_part = "xmsg=\"(" . getFeedArticles($link, $id) . " total)\"";
|
$xmsg_part = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
print "<counter type=\"label\" id=\"$id\" counter=\"$count\" $xmsg_part/>";
|
||||||
} else {
|
} else {
|
||||||
$xmsg_part = "";
|
$ret_arr[$id]["counter"] = $count;
|
||||||
|
$ret_arr[$id]["description"] = $label_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
print "<counter type=\"label\" id=\"$id\" counter=\"$count\" $xmsg_part/>";
|
|
||||||
} else {
|
|
||||||
$ret_arr[$id]["counter"] = $count;
|
|
||||||
$ret_arr[$id]["description"] = $label_name;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
error_reporting (DEFAULT_ERROR_LEVEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
error_reporting (DEFAULT_ERROR_LEVEL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($smart_mode && $lctrs_modified) {
|
if ($smart_mode && $lctrs_modified) {
|
||||||
|
|||||||
Reference in New Issue
Block a user