summaryrefslogtreecommitdiff
path: root/include/functions.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/functions.php')
-rw-r--r--include/functions.php52
1 files changed, 28 insertions, 24 deletions
diff --git a/include/functions.php b/include/functions.php
index 5296f9e61..bad01eb96 100644
--- a/include/functions.php
+++ b/include/functions.php
@@ -961,23 +961,28 @@
}
function file_is_locked($filename) {
- if (function_exists('flock')) {
- $fp = @fopen(LOCK_DIRECTORY . "/$filename", "r");
- if ($fp) {
- if (flock($fp, LOCK_EX | LOCK_NB)) {
- flock($fp, LOCK_UN);
+ if (file_exists(LOCK_DIRECTORY . "/$filename")) {
+ if (function_exists('flock')) {
+ $fp = @fopen(LOCK_DIRECTORY . "/$filename", "r");
+ if ($fp) {
+ if (flock($fp, LOCK_EX | LOCK_NB)) {
+ flock($fp, LOCK_UN);
+ fclose($fp);
+ return false;
+ }
fclose($fp);
+ return true;
+ } else {
return false;
}
- fclose($fp);
- return true;
- } else {
- return false;
}
+ return true; // consider the file always locked and skip the test
+ } else {
+ return false;
}
- return true; // consider the file always locked and skip the test
}
+
function make_lockfile($filename) {
$fp = fopen(LOCK_DIRECTORY . "/$filename", "w");
@@ -1493,11 +1498,13 @@
$owner_uid = $_SESSION["uid"];
- $result = db_query("SELECT id,caption,COUNT(unread) AS unread
+ $result = db_query("SELECT id,caption,COUNT(u1.unread) AS unread,COUNT(u2.unread) AS total
FROM ttrss_labels2 LEFT JOIN ttrss_user_labels2 ON
(ttrss_labels2.id = label_id)
- LEFT JOIN ttrss_user_entries ON (ref_id = article_id AND unread = true
- AND ttrss_user_entries.owner_uid = $owner_uid)
+ LEFT JOIN ttrss_user_entries AS u1 ON (u1.ref_id = article_id AND u1.unread = true
+ AND u1.owner_uid = $owner_uid)
+ LEFT JOIN ttrss_user_entries AS u2 ON (u2.ref_id = article_id AND u2.unread = false
+ AND u2.owner_uid = $owner_uid)
WHERE ttrss_labels2.owner_uid = $owner_uid GROUP BY ttrss_labels2.id,
ttrss_labels2.caption");
@@ -1505,17 +1512,12 @@
$id = label_to_feed_id($line["id"]);
- $label_name = $line["caption"];
- $count = $line["unread"];
-
$cv = array("id" => $id,
- "counter" => (int) $count);
+ "counter" => (int) $line["unread"],
+ "auxcounter" => (int) $line["total"]);
if ($descriptions)
- $cv["description"] = $label_name;
-
-// if (get_pref('EXTENDED_FEEDLIST'))
-// $cv["xmsg"] = getFeedArticles($id)." ".__("total");
+ $cv["description"] = $line["caption"];
array_push($ret_arr, $cv);
}
@@ -2334,8 +2336,10 @@
$filter_query_part = filter_to_sql($filter, $owner_uid);
// Try to check if SQL regexp implementation chokes on a valid regexp
+
+
$result = db_query("SELECT true AS true_val FROM ttrss_entries,
- ttrss_user_entries, ttrss_feeds, ttrss_feed_categories
+ ttrss_user_entries, ttrss_feeds
WHERE $filter_query_part LIMIT 1", false);
if ($result) {
@@ -3124,7 +3128,7 @@
$rv['content'] .= "<html><head>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/>
<title>Tiny Tiny RSS - ".$line["title"]."</title>
- <link rel=\"stylesheet\" type=\"text/css\" href=\"tt-rss.css\">
+ <link rel=\"stylesheet\" type=\"text/css\" href=\"css/tt-rss.css\">
</head><body id=\"ttrssZoom\">";
}
@@ -4167,7 +4171,7 @@
}
function calculate_dep_timestamp() {
- $files = array_merge(glob("js/*.js"), glob("*.css"));
+ $files = array_merge(glob("js/*.js"), glob("css/*.css"));
$max_ts = -1;