From: Alexander Ebert Date: Fri, 31 Mar 2023 09:47:33 +0000 (+0200) Subject: Merge branch '5.5' X-Git-Tag: 6.0.0_Alpha_1~304 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=6f90f0882ecdabc6fdcbe196c1d873f89b9aa80d;p=GitHub%2FWoltLab%2FWCF.git Merge branch '5.5' --- 6f90f0882ecdabc6fdcbe196c1d873f89b9aa80d diff --cc wcfsetup/install/files/lib/system/search/SearchIndexManager.class.php index e4222cb567,fc42640306..966eb378d6 --- a/wcfsetup/install/files/lib/system/search/SearchIndexManager.class.php +++ b/wcfsetup/install/files/lib/system/search/SearchIndexManager.class.php @@@ -114,7 -121,11 +114,11 @@@ class SearchIndexManager extends Single $username, $languageID = null, $metaData = '' - ) { + ): void { + // Inserts a whitespace after certain tags to prevent words from adjacent + // lines to be effectively be glued together when the tags are removed. + $message = \preg_replace('~(
|)~', '\\1 ', $message); + // strip html; remove whitespace from beginning and end of the message $message = StringUtil::trim(StringUtil::stripHTML($message)); @@@ -123,43 -134,37 +127,47 @@@ } /** - * @deprecated 3.0 - please use `set() instead` - */ - public function add( - $objectType, - $objectID, - $message, - $subject, - $time, - $userID, - $username, - $languageID = null, - $metaData = '' - ) { - $this->set($objectType, $objectID, $message, $subject, $time, $userID, $username, $languageID, $metaData); - } - - /** - * @deprecated 3.0 - please use `set() instead` - */ - public function update( - $objectType, - $objectID, - $message, - $subject, - $time, - $userID, - $username, - $languageID = null, - $metaData = '' - ) { - $this->set($objectType, $objectID, $message, $subject, $time, $userID, $username, $languageID, $metaData); + * @inheritDoc + * @since 6.0 + */ + public function setWithContext( + string $objectType, + int $objectID, + int $parentID, + int $containerID, + string $message, + string $subject, + int $time, + ?int $userID, + string $username, + ?int $languageID = null, + string $metaData = '' + ): void { + $searchIndexManager = $this->getSearchIndexManager(); + if ($searchIndexManager instanceof IContextAwareSearchIndexManager) { ++ // Inserts a whitespace after certain tags to prevent words from adjacent ++ // lines to be effectively be glued together when the tags are removed. ++ $message = \preg_replace('~(
|)~', '\\1 ', $message); ++ + $message = StringUtil::trim(StringUtil::stripHTML($message)); + + $searchIndexManager->setWithContext( + $objectType, + $objectID, + $parentID, + $containerID, + $message, + $subject, + $time, + $userID, + $username, + $languageID, + $metaData + ); + } else { + $searchIndexManager + ->set($objectType, $objectID, $message, $subject, $time, $userID, $username, $languageID, $metaData); + } } /**