broken a lot of feed update functionality :(
This commit is contained in:
parent
a20153510b
commit
cb0bd8bd0f
|
@ -88,9 +88,9 @@
|
||||||
|
|
||||||
$entry_content = pg_escape_string($entry_content);
|
$entry_content = pg_escape_string($entry_content);
|
||||||
$entry_title = pg_escape_string($entry_title);
|
$entry_title = pg_escape_string($entry_title);
|
||||||
|
|
||||||
$content_md5 = md5($entry_content);
|
$content_md5 = md5(strip_tags($entry_content));
|
||||||
|
|
||||||
$result = pg_query($link, "
|
$result = pg_query($link, "
|
||||||
SELECT
|
SELECT
|
||||||
id,unread,md5_hash,last_read,no_orig_date,title,
|
id,unread,md5_hash,last_read,no_orig_date,title,
|
||||||
|
@ -128,49 +128,30 @@
|
||||||
$no_orig_date = pg_fetch_result($result, 0, "no_orig_date");
|
$no_orig_date = pg_fetch_result($result, 0, "no_orig_date");
|
||||||
$orig_title = pg_fetch_result($result, 0, "title");
|
$orig_title = pg_fetch_result($result, 0, "title");
|
||||||
|
|
||||||
// disable update detection for posts which didn't have correct
|
|
||||||
// publishment date, because they will always register as updated
|
|
||||||
// sadly this doesn't catch feed generators which input current date
|
|
||||||
// in posts all the time (some planets do this)
|
|
||||||
|
|
||||||
if ($no_orig_date != 't' && (!$last_read || $md5_hash != $content_md5)) {
|
|
||||||
$last_read_qpart = 'last_read = null,';
|
|
||||||
} else {
|
|
||||||
$last_read_qpart = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
// mark post as updated on title change
|
|
||||||
// maybe we should mark it as unread instead?
|
|
||||||
|
|
||||||
if ($orig_title != $entry_title) {
|
|
||||||
$last_read_qpart = 'last_read = null,';
|
|
||||||
}
|
|
||||||
|
|
||||||
// don't bother updating timestamps on posts with broken pubDate
|
|
||||||
|
|
||||||
if ($no_orig_date != 't') {
|
|
||||||
$update_timestamp_qpart = "updated = '$entry_timestamp_fmt',";
|
|
||||||
}
|
|
||||||
|
|
||||||
// print "$content_md5 vs $md5_hash [$entry_title vs $orig_title, $entry_id, $feed_id]<br>";
|
|
||||||
|
|
||||||
if ($content_md5 != $md5_hash) {
|
if ($content_md5 != $md5_hash) {
|
||||||
$update_md5_qpart = "md5_hash = '$content_md5',";
|
$update_md5_qpart = "md5_hash = '$content_md5',";
|
||||||
|
$last_read_qpart = 'last_read = null,';
|
||||||
|
$update_content_qpart = "content = '$entry_content',";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($orig_title != $entry_title) {
|
||||||
|
print "[$orig_title] : [$entry_title]";
|
||||||
|
$entry_title_qpart = "title ='$entry_title',";
|
||||||
}
|
}
|
||||||
|
|
||||||
$query = "UPDATE ttrss_entries
|
$query = "UPDATE ttrss_entries
|
||||||
SET
|
SET
|
||||||
title ='$entry_title',
|
$entry_title_qpart
|
||||||
link = '$entry_link',
|
link = '$entry_link',
|
||||||
$update_timestamp_qpart
|
$update_timestamp_qpart
|
||||||
$last_read_qpart
|
$last_read_qpart
|
||||||
$update_md5_qpart
|
$update_md5_qpart
|
||||||
content = '$entry_content',
|
$update_content_qpart
|
||||||
unread = '$unread'
|
unread = '$unread'
|
||||||
WHERE
|
WHERE
|
||||||
id = '$entry_id'";
|
id = '$entry_id'";
|
||||||
|
|
||||||
// print "<pre>".htmlspecialchars($query)."</pre>";
|
print "<pre>".htmlspecialchars($query)."</pre>";
|
||||||
|
|
||||||
$result = pg_query($link, $query);
|
$result = pg_query($link, $query);
|
||||||
|
|
||||||
|
|
44
tt-rss.js
44
tt-rss.js
|
@ -166,31 +166,39 @@ function catchupPage(feed) {
|
||||||
for (i = 0; i < content.rows.length; i++) {
|
for (i = 0; i < content.rows.length; i++) {
|
||||||
var row_id = content.rows[i].id.replace("RROW-", "");
|
var row_id = content.rows[i].id.replace("RROW-", "");
|
||||||
if (row_id.length > 0) {
|
if (row_id.length > 0) {
|
||||||
rows.push(row_id);
|
if (content.rows[i].className.match("Unread")) {
|
||||||
content.rows[i].className = content.rows[i].className.replace("Unread", "");
|
rows.push(row_id);
|
||||||
|
content.rows[i].className = content.rows[i].className.replace("Unread", "");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var feedr = document.getElementById("FEEDR-" + feed);
|
if (rows.length > 0) {
|
||||||
var feedu = document.getElementById("FEEDU-" + feed);
|
|
||||||
|
|
||||||
feedu.innerHTML = feedu.innerHTML - rows.length;
|
var feedr = document.getElementById("FEEDR-" + feed);
|
||||||
|
var feedu = document.getElementById("FEEDU-" + feed);
|
||||||
|
|
||||||
|
feedu.innerHTML = feedu.innerHTML - rows.length;
|
||||||
|
|
||||||
|
if (feedu.innerHTML > 0 && !feedr.className.match("Unread")) {
|
||||||
|
feedr.className = feedr.className + "Unread";
|
||||||
|
} else if (feedu.innerHTML <= 0) {
|
||||||
|
feedr.className = feedr.className.replace("Unread", "");
|
||||||
|
}
|
||||||
|
|
||||||
if (feedu.innerHTML > 0 && !feedr.className.match("Unread")) {
|
var query_str = "backend.php?op=rpc&subop=catchupPage&ids=" +
|
||||||
feedr.className = feedr.className + "Unread";
|
param_escape(rows.toString());
|
||||||
} else if (feedu.innerHTML <= 0) {
|
|
||||||
feedr.className = feedr.className.replace("Unread", "");
|
notify("Marking this page as read...");
|
||||||
}
|
|
||||||
|
xmlhttp.open("GET", query_str, true);
|
||||||
|
xmlhttp.onreadystatechange=notify_callback;
|
||||||
|
xmlhttp.send(null);
|
||||||
|
|
||||||
var query_str = "backend.php?op=rpc&subop=catchupPage&ids=" +
|
} else {
|
||||||
param_escape(rows.toString());
|
notify("No unread items on this page.");
|
||||||
|
|
||||||
notify("Marking this page as read...");
|
|
||||||
|
|
||||||
xmlhttp.open("GET", query_str, true);
|
|
||||||
xmlhttp.onreadystatechange=notify_callback;
|
|
||||||
xmlhttp.send(null);
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function catchupAllFeeds() {
|
function catchupAllFeeds() {
|
||||||
|
|
Loading…
Reference in New Issue