From 2b6662dba051386343b1400865c5ab7bb7f15783 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Tue, 8 Jun 2021 16:51:27 +0200 Subject: [PATCH] Make MysqlSearchIndexManager implement set() The use of `add()` is deprecated. `set()` should be the canonical method. --- .../mysql/MysqlSearchIndexManager.class.php | 43 ++++++++++++++++--- 1 file changed, 38 insertions(+), 5 deletions(-) diff --git a/wcfsetup/install/files/lib/system/search/mysql/MysqlSearchIndexManager.class.php b/wcfsetup/install/files/lib/system/search/mysql/MysqlSearchIndexManager.class.php index 110a5ede11..bf283f78bf 100644 --- a/wcfsetup/install/files/lib/system/search/mysql/MysqlSearchIndexManager.class.php +++ b/wcfsetup/install/files/lib/system/search/mysql/MysqlSearchIndexManager.class.php @@ -22,7 +22,7 @@ class MysqlSearchIndexManager extends AbstractSearchIndexManager /** * @inheritDoc */ - public function add( + public function set( $objectType, $objectID, $message, @@ -59,11 +59,44 @@ class MysqlSearchIndexManager extends AbstractSearchIndexManager $languageID = null, $metaData = '' ) { - // delete existing entry - $this->delete($objectType, [$objectID]); + $this->set( + $objectType, + $objectID, + $message, + $subject, + $time, + $userID, + $username, + $languageID, + $metaData + ); + } - // save new entry - $this->add($objectType, $objectID, $message, $subject, $time, $userID, $username, $languageID, $metaData); + /** + * @inheritDoc + */ + public function add( + $objectType, + $objectID, + $message, + $subject, + $time, + $userID, + $username, + $languageID = null, + $metaData = '' + ) { + $this->set( + $objectType, + $objectID, + $message, + $subject, + $time, + $userID, + $username, + $languageID, + $metaData + ); } /** -- 2.20.1