posts register as updated when their MD5 hash changes
This commit is contained in:
parent
b197f11776
commit
cac95b8d16
2 changed files with 13 additions and 5 deletions
|
@ -3,6 +3,6 @@
|
||||||
define('MAGPIE_CACHE_DIR', '/var/tmp/magpie-ttrss-cache');
|
define('MAGPIE_CACHE_DIR', '/var/tmp/magpie-ttrss-cache');
|
||||||
define(HEADLINES_PER_PAGE, 15);
|
define(HEADLINES_PER_PAGE, 15);
|
||||||
define(MIN_UPDATE_TIME, 600);
|
define(MIN_UPDATE_TIME, 600);
|
||||||
define(CONTENT_CHECK_MD5, false);
|
// define(CONTENT_CHECK_MD5, false);
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,7 @@
|
||||||
|
|
||||||
$result = pg_query($link, "
|
$result = pg_query($link, "
|
||||||
SELECT
|
SELECT
|
||||||
id,unread,md5_hash,
|
id,unread,md5_hash,last_read,
|
||||||
EXTRACT(EPOCH FROM updated) as updated_timestamp
|
EXTRACT(EPOCH FROM updated) as updated_timestamp
|
||||||
FROM
|
FROM
|
||||||
ttrss_entries
|
ttrss_entries
|
||||||
|
@ -104,13 +104,20 @@
|
||||||
$entry_id = pg_fetch_result($result, 0, "id");
|
$entry_id = pg_fetch_result($result, 0, "id");
|
||||||
$updated_timestamp = pg_fetch_result($result, 0, "updated_timestamp");
|
$updated_timestamp = pg_fetch_result($result, 0, "updated_timestamp");
|
||||||
$entry_timestamp_fmt = strftime("%Y/%m/%d %H:%M:%S", $entry_timestamp);
|
$entry_timestamp_fmt = strftime("%Y/%m/%d %H:%M:%S", $entry_timestamp);
|
||||||
|
$last_read = pg_fetch_result($result, 0, "last_read");
|
||||||
|
|
||||||
$unread = pg_fetch_result($result, 0, "unread");
|
$unread = pg_fetch_result($result, 0, "unread");
|
||||||
$md5_hash = pg_fetch_result($result, 0, "md5_hash");
|
$md5_hash = pg_fetch_result($result, 0, "md5_hash");
|
||||||
|
|
||||||
if ($md5_hash != $content_md5 && CONTENT_CHECK_MD5)
|
// if ($md5_hash != $content_md5 && CONTENT_CHECK_MD5)
|
||||||
$unread = "true";
|
// $unread = "true";
|
||||||
|
|
||||||
|
if ($md5_hash != $content_md5) {
|
||||||
|
$last_read = 'null';
|
||||||
|
} else {
|
||||||
|
$last_read = "'$last_read'";
|
||||||
|
}
|
||||||
|
|
||||||
// if ($unread || !CONTENT_CHECK_MD5) {
|
// if ($unread || !CONTENT_CHECK_MD5) {
|
||||||
// $updated_query_part = "updated = '$entry_timestamp',";
|
// $updated_query_part = "updated = '$entry_timestamp',";
|
||||||
// }
|
// }
|
||||||
|
@ -127,6 +134,7 @@
|
||||||
updated = '$entry_timestamp_fmt',
|
updated = '$entry_timestamp_fmt',
|
||||||
content = '$entry_content',
|
content = '$entry_content',
|
||||||
md5_hash = '$content_md5',
|
md5_hash = '$content_md5',
|
||||||
|
last_read = $last_read,
|
||||||
unread = '$unread'
|
unread = '$unread'
|
||||||
WHERE
|
WHERE
|
||||||
id = '$entry_id'";
|
id = '$entry_id'";
|
||||||
|
|
Loading…
Reference in a new issue