mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-13 16:45:55 +00:00
only update database entries when really needed
This commit is contained in:
@@ -206,6 +206,8 @@
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$entry_is_modified = false;
|
||||||
|
|
||||||
$orig_timestamp = pg_fetch_result($result, 0, "updated_timestamp");
|
$orig_timestamp = pg_fetch_result($result, 0, "updated_timestamp");
|
||||||
$orig_content_hash = pg_fetch_result($result, 0, "content_hash");
|
$orig_content_hash = pg_fetch_result($result, 0, "content_hash");
|
||||||
$orig_last_read = pg_fetch_result($result, 0, "last_read");
|
$orig_last_read = pg_fetch_result($result, 0, "last_read");
|
||||||
@@ -218,20 +220,34 @@
|
|||||||
// $last_read_qpart = 'last_read = null,';
|
// $last_read_qpart = 'last_read = null,';
|
||||||
// }
|
// }
|
||||||
|
|
||||||
if (UPDATE_POST_ON_CHECKSUM_CHANGE &&
|
if ($orig_content_hash != $content_hash) {
|
||||||
$orig_content_hash != $content_hash) {
|
if (UPDATE_POST_ON_CHECKSUM_CHANGE) {
|
||||||
$last_read_qpart = 'last_read = null,';
|
$last_read_qpart = 'last_read = null,';
|
||||||
}
|
}
|
||||||
|
$entry_is_modified = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($orig_title != $entry_title) {
|
||||||
|
$entry_is_modified = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($orig_timestamp != $entry_timestamp && !$orig_no_orig_date) {
|
||||||
|
$entry_is_modified = true;
|
||||||
|
}
|
||||||
|
|
||||||
// if (!$no_orig_date && $orig_timestamp < $entry_timestamp) {
|
// if (!$no_orig_date && $orig_timestamp < $entry_timestamp) {
|
||||||
// $last_read_qpart = 'last_read = null,';
|
// $last_read_qpart = 'last_read = null,';
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
if ($entry_is_modified) {
|
||||||
|
|
||||||
$entry_comments = pg_escape_string($entry_comments);
|
$entry_comments = pg_escape_string($entry_comments);
|
||||||
$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);
|
||||||
$entry_link = pg_escape_string($entry_link);
|
$entry_link = pg_escape_string($entry_link);
|
||||||
|
|
||||||
|
// print "update object $entry_guid<br>";
|
||||||
|
|
||||||
$query = "UPDATE ttrss_entries
|
$query = "UPDATE ttrss_entries
|
||||||
SET
|
SET
|
||||||
$last_read_qpart
|
$last_read_qpart
|
||||||
@@ -245,7 +261,7 @@
|
|||||||
id = '$orig_entry_id'";
|
id = '$orig_entry_id'";
|
||||||
|
|
||||||
$result = pg_query($link, $query);
|
$result = pg_query($link, $query);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user