switch insert query for base article record to named parameters and add previously missing ts_content stuff

This commit is contained in:
Andrew Dolgov 2025-05-05 22:08:01 +03:00
parent 677cd7453f
commit ea6f42dc61
No known key found for this signature in database
GPG Key ID: 1A56B4FA25D4AF2A

View File

@ -998,9 +998,10 @@ class RSSUtils {
Debug::log("base guid [$entry_guid or $entry_guid_hashed] not found, creating...", Debug::LOG_VERBOSE); Debug::log("base guid [$entry_guid or $entry_guid_hashed] not found, creating...", Debug::LOG_VERBOSE);
// base post entry does not exist, create it // base post entry does not exist, create it
$usth = $pdo->prepare( $isth = $pdo->prepare(
"INSERT INTO ttrss_entries "INSERT INTO ttrss_entries
(title, (title,
tsvector_combined,
guid, guid,
link, link,
updated, updated,
@ -1015,25 +1016,38 @@ class RSSUtils {
lang, lang,
author) author)
VALUES VALUES
(?, ?, ?, ?, ?, ?, (:title,
to_tsvector(:ts_lang, :ts_content),
:guid,
:link,
:updated,
:content,
:content_hash,
false, false,
NOW(), NOW(),
?, ?, ?, ?, ?, ?) RETURNING id"); :date_entered,
:comments,
:num_comments,
:plugin_data,
:lang,
:author) RETURNING id");
$usth->execute([$entry_title, $isth->execute([":title" => $entry_title,
$entry_guid_hashed, ":ts_lang" => $feed_language,
$entry_link, ":ts_content" => mb_substr(strip_tags($entry_title) . " " . \Soundasleep\Html2Text::convert($entry_content), 0, 900000),
$entry_timestamp_fmt, ":guid" => $entry_guid_hashed,
"$entry_content", ":link" => $entry_link,
$entry_current_hash, ":updated" => $entry_timestamp_fmt,
$date_feed_processed, ":content" => $entry_content,
$entry_comments, ":content_hash" => $entry_current_hash,
(int)$num_comments, ":date_entered" => $date_feed_processed,
$entry_plugin_data, ":comments" => $entry_comments,
"$entry_language", ":num_comments" => (int)$num_comments,
"$entry_author"]); ":plugin_data" => $entry_plugin_data,
":lang" => $entry_language,
":author" => $entry_author]);
$row = $usth->fetch(); $row = $isth->fetch();
Debug::log("insert returned RID: " . $row['id'], Debug::LOG_VERBOSE); Debug::log("insert returned RID: " . $row['id'], Debug::LOG_VERBOSE);
$base_record_created = true; $base_record_created = true;