summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
authorAndrew Dolgov <fox@fakecake.org>2025-05-05 22:08:01 +0300
committerAndrew Dolgov <fox@fakecake.org>2025-05-05 22:08:01 +0300
commitea6f42dc612d6af0178d4451a06f98c550614db9 (patch)
tree5984f710d81383c0177839862b6384089956572d /classes
parent677cd7453f4c531aa8e1cb8c6ed68ea81864ca73 (diff)
switch insert query for base article record to named parameters and add previously missing ts_content stuff
Diffstat (limited to 'classes')
-rw-r--r--classes/RSSUtils.php50
1 files changed, 32 insertions, 18 deletions
diff --git a/classes/RSSUtils.php b/classes/RSSUtils.php
index 254750c07..5354ae7ba 100644
--- a/classes/RSSUtils.php
+++ b/classes/RSSUtils.php
@@ -998,9 +998,10 @@ class RSSUtils {
Debug::log("base guid [$entry_guid or $entry_guid_hashed] not found, creating...", Debug::LOG_VERBOSE);
// base post entry does not exist, create it
- $usth = $pdo->prepare(
+ $isth = $pdo->prepare(
"INSERT INTO ttrss_entries
(title,
+ tsvector_combined,
guid,
link,
updated,
@@ -1015,25 +1016,38 @@ class RSSUtils {
lang,
author)
VALUES
- (?, ?, ?, ?, ?, ?,
+ (:title,
+ to_tsvector(:ts_lang, :ts_content),
+ :guid,
+ :link,
+ :updated,
+ :content,
+ :content_hash,
false,
NOW(),
- ?, ?, ?, ?, ?, ?) RETURNING id");
-
- $usth->execute([$entry_title,
- $entry_guid_hashed,
- $entry_link,
- $entry_timestamp_fmt,
- "$entry_content",
- $entry_current_hash,
- $date_feed_processed,
- $entry_comments,
- (int)$num_comments,
- $entry_plugin_data,
- "$entry_language",
- "$entry_author"]);
-
- $row = $usth->fetch();
+ :date_entered,
+ :comments,
+ :num_comments,
+ :plugin_data,
+ :lang,
+ :author) RETURNING id");
+
+ $isth->execute([":title" => $entry_title,
+ ":ts_lang" => $feed_language,
+ ":ts_content" => mb_substr(strip_tags($entry_title) . " " . \Soundasleep\Html2Text::convert($entry_content), 0, 900000),
+ ":guid" => $entry_guid_hashed,
+ ":link" => $entry_link,
+ ":updated" => $entry_timestamp_fmt,
+ ":content" => $entry_content,
+ ":content_hash" => $entry_current_hash,
+ ":date_entered" => $date_feed_processed,
+ ":comments" => $entry_comments,
+ ":num_comments" => (int)$num_comments,
+ ":plugin_data" => $entry_plugin_data,
+ ":lang" => $entry_language,
+ ":author" => $entry_author]);
+
+ $row = $isth->fetch();
Debug::log("insert returned RID: " . $row['id'], Debug::LOG_VERBOSE);
$base_record_created = true;