summaryrefslogtreecommitdiff
path: root/functions.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2005-08-23 08:32:11 +0100
committerAndrew Dolgov <[email protected]>2005-08-23 08:32:11 +0100
commita20153510b9bc070a9efb3e5ab04832f26fa26b2 (patch)
treef7013c9d09819491c8422b2cb0f77d8cd8f8a1e1 /functions.php
parent3ad5aa855ca40e89941cd00090f6005ddbf6f96e (diff)
updated schema (md5_hash is not unique any more), feed parsing fixes
Diffstat (limited to 'functions.php')
-rw-r--r--functions.php24
1 files changed, 17 insertions, 7 deletions
diff --git a/functions.php b/functions.php
index d2cb65d2c..bada34c02 100644
--- a/functions.php
+++ b/functions.php
@@ -37,8 +37,6 @@
if ($rss) {
- pg_query("BEGIN");
-
$result = pg_query("SELECT title FROM ttrss_feeds WHERE id = '$feed'");
$registered_title = pg_fetch_result($result, 0, "title");
@@ -48,6 +46,8 @@
pg_query("UPDATE ttrss_feeds SET title = '$feed_title' WHERE id = '$feed'");
}
+ pg_query("BEGIN");
+
foreach ($rss->items as $item) {
$entry_guid = $item["id"];
@@ -83,7 +83,9 @@
$entry_content = $item["description"];
if (!$entry_content) $entry_content = $item["content"];
-
+
+ if (!$entry_content) continue;
+
$entry_content = pg_escape_string($entry_content);
$entry_title = pg_escape_string($entry_title);
@@ -96,7 +98,7 @@
FROM
ttrss_entries
WHERE
- guid = '$entry_guid' OR md5_hash = '$content_md5'");
+ guid = '$entry_guid'");
if (pg_num_rows($result) == 0) {
@@ -150,24 +152,32 @@
$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) {
+ $update_md5_qpart = "md5_hash = '$content_md5',";
+ }
+
$query = "UPDATE ttrss_entries
SET
title ='$entry_title',
link = '$entry_link',
$update_timestamp_qpart
$last_read_qpart
+ $update_md5_qpart
content = '$entry_content',
- md5_hash = '$content_md5',
unread = '$unread'
WHERE
id = '$entry_id'";
-
+
+// print "<pre>".htmlspecialchars($query)."</pre>";
+
$result = pg_query($link, $query);
if ($result) ++$num_unread;
}
-
+
}
if ($result) {