Refactors migrations check. (#8814)
Этот коммит содержится в:
коммит произвёл
Jesús Espino
родитель
c6ba5c32d6
Коммит
eb78d273f3
13
app/app.go
13
app/app.go
@@ -92,6 +92,8 @@ type App struct {
|
||||
clientConfig map[string]string
|
||||
clientConfigHash string
|
||||
diagnosticId string
|
||||
|
||||
phase2PermissionsMigrationComplete bool
|
||||
}
|
||||
|
||||
var appCount = 0
|
||||
@@ -588,3 +590,14 @@ func (a *App) DoAdvancedPermissionsMigration() {
|
||||
mlog.Critical(fmt.Sprint(result.Err))
|
||||
}
|
||||
}
|
||||
|
||||
func (a *App) SetPhase2PermissionsMigrationStatus(isComplete bool) error {
|
||||
if !isComplete {
|
||||
res := <-a.Srv.Store.System().PermanentDeleteByName(model.MIGRATION_KEY_ADVANCED_PERMISSIONS_PHASE_2)
|
||||
if res.Err != nil {
|
||||
return res.Err
|
||||
}
|
||||
}
|
||||
a.phase2PermissionsMigrationComplete = isComplete
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -142,10 +142,16 @@ func (a *App) GetChannelsForScheme(scheme *model.Scheme, offset int, limit int)
|
||||
}
|
||||
|
||||
func (a *App) IsPhase2MigrationCompleted() *model.AppError {
|
||||
if a.phase2PermissionsMigrationComplete {
|
||||
return nil
|
||||
}
|
||||
|
||||
if result := <-a.Srv.Store.System().GetByName(model.MIGRATION_KEY_ADVANCED_PERMISSIONS_PHASE_2); result.Err != nil {
|
||||
return model.NewAppError("App.IsPhase2MigrationCompleted", "app.schemes.is_phase_2_migration_completed.not_completed.app_error", nil, result.Err.Error(), http.StatusNotImplemented)
|
||||
}
|
||||
|
||||
a.phase2PermissionsMigrationComplete = true
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user