Mono repo -> Master (#22553)
Combines the following repositories into one: https://github.com/mattermost/mattermost-server https://github.com/mattermost/mattermost-webapp https://github.com/mattermost/focalboard https://github.com/mattermost/mattermost-plugin-playbooks
Этот коммит содержится в:
62
server/channels/app/searchengine.go
Обычный файл
62
server/channels/app/searchengine.go
Обычный файл
@@ -0,0 +1,62 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
package app
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/mattermost/mattermost-server/v6/model"
|
||||
"github.com/mattermost/mattermost-server/v6/server/platform/services/searchengine"
|
||||
)
|
||||
|
||||
func (a *App) TestElasticsearch(cfg *model.Config) *model.AppError {
|
||||
if *cfg.ElasticsearchSettings.Password == model.FakeSetting {
|
||||
if *cfg.ElasticsearchSettings.ConnectionURL == *a.Config().ElasticsearchSettings.ConnectionURL && *cfg.ElasticsearchSettings.Username == *a.Config().ElasticsearchSettings.Username {
|
||||
*cfg.ElasticsearchSettings.Password = *a.Config().ElasticsearchSettings.Password
|
||||
} else {
|
||||
return model.NewAppError("TestElasticsearch", "ent.elasticsearch.test_config.reenter_password", nil, "", http.StatusBadRequest)
|
||||
}
|
||||
}
|
||||
|
||||
seI := a.SearchEngine().ElasticsearchEngine
|
||||
if seI == nil {
|
||||
err := model.NewAppError("TestElasticsearch", "ent.elasticsearch.test_config.license.error", nil, "", http.StatusNotImplemented)
|
||||
return err
|
||||
}
|
||||
if err := seI.TestConfig(cfg); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a *App) SetSearchEngine(se *searchengine.Broker) {
|
||||
a.ch.srv.platform.SearchEngine = se
|
||||
}
|
||||
|
||||
func (a *App) PurgeElasticsearchIndexes() *model.AppError {
|
||||
engine := a.SearchEngine().ElasticsearchEngine
|
||||
if engine == nil {
|
||||
err := model.NewAppError("PurgeElasticsearchIndexes", "ent.elasticsearch.test_config.license.error", nil, "", http.StatusNotImplemented)
|
||||
return err
|
||||
}
|
||||
|
||||
if err := engine.PurgeIndexes(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a *App) PurgeBleveIndexes() *model.AppError {
|
||||
engine := a.SearchEngine().BleveEngine
|
||||
if engine == nil {
|
||||
err := model.NewAppError("PurgeBleveIndexes", "searchengine.bleve.disabled.error", nil, "", http.StatusNotImplemented)
|
||||
return err
|
||||
}
|
||||
if err := engine.PurgeIndexes(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Ссылка в новой задаче
Block a user