$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('~(<br>|</(?:h[1-6]|kbd|li|p|pre|td|woltlab-metacode)>)~', '\\1 ', $message);
+
// strip html; remove whitespace from beginning and end of the message
$message = StringUtil::trim(StringUtil::stripHTML($message));
}
/**
- * @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('~(<br>|</(?:h[1-6]|kbd|li|p|pre|td|woltlab-metacode)>)~', '\\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);
+ }
}
/**