remove einterface gets (#7455)
Этот коммит содержится в:
@@ -3,7 +3,6 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/mattermost/mattermost-server/einterfaces"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
@@ -27,11 +26,12 @@ func init() {
|
||||
}
|
||||
|
||||
func ldapSyncCmdF(cmd *cobra.Command, args []string) error {
|
||||
if _, err := initDBCommandContextCobra(cmd); err != nil {
|
||||
a, err := initDBCommandContextCobra(cmd)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if ldapI := einterfaces.GetLdapInterface(); ldapI != nil {
|
||||
if ldapI := a.Ldap; ldapI != nil {
|
||||
if err := ldapI.Syncronize(); err != nil {
|
||||
CommandPrintErrorln("ERROR: AD/LDAP Synchronization Failed")
|
||||
} else {
|
||||
|
||||
@@ -13,7 +13,6 @@ import (
|
||||
"github.com/mattermost/mattermost-server/api"
|
||||
"github.com/mattermost/mattermost-server/api4"
|
||||
"github.com/mattermost/mattermost-server/app"
|
||||
"github.com/mattermost/mattermost-server/einterfaces"
|
||||
"github.com/mattermost/mattermost-server/jobs"
|
||||
"github.com/mattermost/mattermost-server/manualtesting"
|
||||
"github.com/mattermost/mattermost-server/model"
|
||||
@@ -96,7 +95,7 @@ func runServer(configFileLocation string) {
|
||||
utils.Cfg.TeamSettings.MaxNotificationsPerChannel = &MaxNotificationsPerChannelDefault
|
||||
}
|
||||
|
||||
app.ReloadConfig()
|
||||
a.ReloadConfig()
|
||||
|
||||
// Enable developer settings if this is a "dev" build
|
||||
if model.BuildNumber == "dev" {
|
||||
@@ -120,21 +119,21 @@ func runServer(configFileLocation string) {
|
||||
go runTokenCleanupJob(a)
|
||||
go runCommandWebhookCleanupJob(a)
|
||||
|
||||
if complianceI := einterfaces.GetComplianceInterface(); complianceI != nil {
|
||||
if complianceI := a.Compliance; complianceI != nil {
|
||||
complianceI.StartComplianceDailyJob()
|
||||
}
|
||||
|
||||
if einterfaces.GetClusterInterface() != nil {
|
||||
if a.Cluster != nil {
|
||||
a.RegisterAllClusterMessageHandlers()
|
||||
einterfaces.GetClusterInterface().StartInterNodeCommunication()
|
||||
a.Cluster.StartInterNodeCommunication()
|
||||
}
|
||||
|
||||
if einterfaces.GetMetricsInterface() != nil {
|
||||
einterfaces.GetMetricsInterface().StartServer()
|
||||
if a.Metrics != nil {
|
||||
a.Metrics.StartServer()
|
||||
}
|
||||
|
||||
if einterfaces.GetElasticsearchInterface() != nil {
|
||||
if err := einterfaces.GetElasticsearchInterface().Start(); err != nil {
|
||||
if a.Elasticsearch != nil {
|
||||
if err := a.Elasticsearch.Start(); err != nil {
|
||||
l4g.Error(err.Error())
|
||||
}
|
||||
}
|
||||
@@ -153,12 +152,12 @@ func runServer(configFileLocation string) {
|
||||
signal.Notify(c, os.Interrupt, syscall.SIGINT, syscall.SIGTERM)
|
||||
<-c
|
||||
|
||||
if einterfaces.GetClusterInterface() != nil {
|
||||
einterfaces.GetClusterInterface().StopInterNodeCommunication()
|
||||
if a.Cluster != nil {
|
||||
a.Cluster.StopInterNodeCommunication()
|
||||
}
|
||||
|
||||
if einterfaces.GetMetricsInterface() != nil {
|
||||
einterfaces.GetMetricsInterface().StopServer()
|
||||
if a.Metrics != nil {
|
||||
a.Metrics.StopServer()
|
||||
}
|
||||
|
||||
jobs.Srv.StopSchedulers()
|
||||
|
||||
@@ -7,7 +7,6 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/mattermost/mattermost-server/app"
|
||||
"github.com/mattermost/mattermost-server/einterfaces"
|
||||
"github.com/mattermost/mattermost-server/model"
|
||||
"github.com/mattermost/mattermost-server/utils"
|
||||
"github.com/spf13/cobra"
|
||||
@@ -320,7 +319,7 @@ func resetUserPasswordCmdF(cmd *cobra.Command, args []string) error {
|
||||
}
|
||||
|
||||
func resetUserMfaCmdF(cmd *cobra.Command, args []string) error {
|
||||
_, err := initDBCommandContextCobra(cmd)
|
||||
a, err := initDBCommandContextCobra(cmd)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -336,7 +335,7 @@ func resetUserMfaCmdF(cmd *cobra.Command, args []string) error {
|
||||
return errors.New("Unable to find user '" + args[i] + "'")
|
||||
}
|
||||
|
||||
if err := app.DeactivateMfa(user.Id); err != nil {
|
||||
if err := a.DeactivateMfa(user.Id); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
@@ -420,7 +419,7 @@ func deleteAllUsersCommandF(cmd *cobra.Command, args []string) error {
|
||||
}
|
||||
|
||||
func migrateAuthCmdF(cmd *cobra.Command, args []string) error {
|
||||
_, err := initDBCommandContextCobra(cmd)
|
||||
a, err := initDBCommandContextCobra(cmd)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -452,7 +451,7 @@ func migrateAuthCmdF(cmd *cobra.Command, args []string) error {
|
||||
|
||||
forceFlag, _ := cmd.Flags().GetBool("force")
|
||||
|
||||
if migrate := einterfaces.GetAccountMigrationInterface(); migrate != nil {
|
||||
if migrate := a.AccountMigration; migrate != nil {
|
||||
if err := migrate.MigrateToLdap(fromAuth, matchField, forceFlag); err != nil {
|
||||
return errors.New("Error while migrating users: " + err.Error())
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user