summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2005-08-22 10:07:47 +0100
committerAndrew Dolgov <[email protected]>2005-08-22 10:07:47 +0100
commitcac95b8d16aed28b500ae73937e332eba3abf449 (patch)
tree719eb37dc1c199c7d3278de77cec2597fe80be62
parentb197f11776dd091565497c79e5119ab5b596e401 (diff)
posts register as updated when their MD5 hash changes
-rw-r--r--config.php-dist2
-rw-r--r--functions.php16
2 files changed, 13 insertions, 5 deletions
diff --git a/config.php-dist b/config.php-dist
index 56d9c13a2..9126ef2fd 100644
--- a/config.php-dist
+++ b/config.php-dist
@@ -3,6 +3,6 @@
define('MAGPIE_CACHE_DIR', '/var/tmp/magpie-ttrss-cache');
define(HEADLINES_PER_PAGE, 15);
define(MIN_UPDATE_TIME, 600);
- define(CONTENT_CHECK_MD5, false);
+// define(CONTENT_CHECK_MD5, false);
?>
diff --git a/functions.php b/functions.php
index d89e6bc83..bafb8d08e 100644
--- a/functions.php
+++ b/functions.php
@@ -77,7 +77,7 @@
$result = pg_query($link, "
SELECT
- id,unread,md5_hash,
+ id,unread,md5_hash,last_read,
EXTRACT(EPOCH FROM updated) as updated_timestamp
FROM
ttrss_entries
@@ -104,13 +104,20 @@
$entry_id = pg_fetch_result($result, 0, "id");
$updated_timestamp = pg_fetch_result($result, 0, "updated_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");
$md5_hash = pg_fetch_result($result, 0, "md5_hash");
- if ($md5_hash != $content_md5 && CONTENT_CHECK_MD5)
- $unread = "true";
-
+// if ($md5_hash != $content_md5 && CONTENT_CHECK_MD5)
+// $unread = "true";
+
+ if ($md5_hash != $content_md5) {
+ $last_read = 'null';
+ } else {
+ $last_read = "'$last_read'";
+ }
+
// if ($unread || !CONTENT_CHECK_MD5) {
// $updated_query_part = "updated = '$entry_timestamp',";
// }
@@ -127,6 +134,7 @@
updated = '$entry_timestamp_fmt',
content = '$entry_content',
md5_hash = '$content_md5',
+ last_read = $last_read,
unread = '$unread'
WHERE
id = '$entry_id'";