]> git.mxchange.org Git - friendica.git/commitdiff
Centralized functionality to store and delete the check-full-text-search table develop
authorMichael <heluecht@pirati.ca>
Mon, 15 Jan 2024 22:28:42 +0000 (22:28 +0000)
committerRoland Häder <roland@mxchange.org>
Sun, 28 Jan 2024 15:37:43 +0000 (16:37 +0100)
src/Content/Conversation/Repository/UserDefinedChannel.php

index a74bdb06d39479b4b3c76500f741bf4bc855c2ea..0452b6dd2ba73cc979ac17ec4d084ba37254dbe6 100644 (file)
@@ -189,9 +189,10 @@ class UserDefinedChannel extends \Friendica\BaseRepository
                        $search .= '(' . $channel->fullTextSearch . ') ';
                }
 
-               $this->db->insert('check-full-text-search', ['pid' => getmypid(), 'searchtext' => $searchtext], Database::INSERT_UPDATE);
+               $this->insertCheckFullTextSearch($searchtext);
                $result = $this->inFulltext($search);
-               $this->db->delete('check-full-text-search', ['pid' => getmypid()]);
+               $this->deleteCheckFullTextSearch();
+
                return $result;
        }
 
@@ -220,7 +221,7 @@ class UserDefinedChannel extends \Friendica\BaseRepository
                        return [];
                }
 
-               $this->db->insert('check-full-text-search', ['pid' => getmypid(), 'searchtext' => $searchtext], Database::INSERT_UPDATE);
+               $this->insertCheckFullTextSearch($searchtext);
 
                $uids = [];
 
@@ -264,10 +265,20 @@ class UserDefinedChannel extends \Friendica\BaseRepository
                        $this->logger->debug('Matching channel found.', ['uid' => $channel->uid, 'label' => $channel->label, 'language' => $language, 'tags' => $tags, 'media_type' => $media_type, 'searchtext' => $searchtext]);
                }
 
-               $this->db->delete('check-full-text-search', ['pid' => getmypid()]);
+               $this->deleteCheckFullTextSearch();
                return $uids;
        }
 
+       private function insertCheckFullTextSearch(string $searchtext)
+       {
+               $this->db->insert('check-full-text-search', ['pid' => getmypid(), 'searchtext' => $searchtext], Database::INSERT_UPDATE);
+       }
+
+       private function deleteCheckFullTextSearch()
+       {
+               $this->db->delete('check-full-text-search', ['pid' => getmypid()]);
+       }
+
        private function inCircle(int $circleId, int $uid, int $cid): bool
        {
                if ($cid == 0) {