From 6684bf457030f46825b785a18d0029d2fccd0f87 Mon Sep 17 00:00:00 2001 From: Maxence Lange Date: Wed, 10 Apr 2019 11:46:20 -0100 Subject: [PATCH] +isAvailable() Signed-off-by: Maxence Lange --- .../FullTextSearch/FullTextSearchManager.php | 15 +++++++++++++++ .../FullTextSearch/IFullTextSearchManager.php | 10 ++++++++++ 2 files changed, 25 insertions(+) diff --git a/lib/private/FullTextSearch/FullTextSearchManager.php b/lib/private/FullTextSearch/FullTextSearchManager.php index 444774fb4a..8ab1af05b0 100644 --- a/lib/private/FullTextSearch/FullTextSearchManager.php +++ b/lib/private/FullTextSearch/FullTextSearchManager.php @@ -85,6 +85,21 @@ class FullTextSearchManager implements IFullTextSearchManager { $this->searchService = $searchService; } + /** + * @since 16.0.0 + * + * @return bool + */ + public function isAvailable(): bool { + if ($this->indexService === null || + $this->providerService === null || + $this->searchService === null) { + return false; + } + + return true; + } + /** * @return IProviderService diff --git a/lib/public/FullTextSearch/IFullTextSearchManager.php b/lib/public/FullTextSearch/IFullTextSearchManager.php index 1027f7ade7..3c2aa6324d 100644 --- a/lib/public/FullTextSearch/IFullTextSearchManager.php +++ b/lib/public/FullTextSearch/IFullTextSearchManager.php @@ -78,6 +78,16 @@ interface IFullTextSearchManager { */ public function registerSearchService(ISearchService $searchService); + /** + * returns true is Full Text Search is available (app is present and Service + * are registered) + * + * @since 16.0.0 + * + * @return bool + */ + public function isAvailable(): bool; + /** * Add the Javascript API in the navigation page of an app.