11// Copyright 2014 The Gogs Authors. All rights reserved.
2+ // Copyright 2021 The Gitea Authors. All rights reserved.
23// Use of this source code is governed by a MIT-style
34// license that can be found in the LICENSE file.
45
56package install
67
78import (
8- std_context "context"
99 "fmt"
1010 "net/http"
1111 "os"
@@ -21,14 +21,12 @@ import (
2121 "code.gitea.io/gitea/modules/graceful"
2222 "code.gitea.io/gitea/modules/log"
2323 "code.gitea.io/gitea/modules/setting"
24- "code.gitea.io/gitea/modules/svg"
2524 "code.gitea.io/gitea/modules/templates"
2625 "code.gitea.io/gitea/modules/translation"
2726 "code.gitea.io/gitea/modules/user"
2827 "code.gitea.io/gitea/modules/util"
2928 "code.gitea.io/gitea/modules/web"
3029 "code.gitea.io/gitea/modules/web/middleware"
31- "code.gitea.io/gitea/routers/common"
3230 "code.gitea.io/gitea/services/forms"
3331
3432 "gitea.com/go-chi/session"
@@ -86,40 +84,6 @@ func Init(next http.Handler) http.Handler {
8684 })
8785}
8886
89- // PreInit preloads the configuration to check if we need to run install
90- func PreInit (ctx std_context.Context ) bool {
91- setting .NewContext ()
92- if ! setting .InstallLock {
93- log .Trace ("AppPath: %s" , setting .AppPath )
94- log .Trace ("AppWorkPath: %s" , setting .AppWorkPath )
95- log .Trace ("Custom path: %s" , setting .CustomPath )
96- log .Trace ("Log path: %s" , setting .LogRootPath )
97- log .Trace ("Preparing to run install page" )
98- translation .InitLocales ()
99- if setting .EnableSQLite3 {
100- log .Info ("SQLite3 Supported" )
101- }
102- setting .InitDBConfig ()
103- svg .Init ()
104- }
105-
106- return ! setting .InstallLock
107- }
108-
109- // PostInit rereads the settings and starts up the database
110- func PostInit (ctx std_context.Context ) {
111- setting .NewContext ()
112- setting .InitDBConfig ()
113- if setting .InstallLock {
114- if err := common .InitDBEngine (ctx ); err == nil {
115- log .Info ("ORM engine initialization successful!" )
116- } else {
117- log .Fatal ("ORM engine initialization failed: %v" , err )
118- }
119- svg .Init ()
120- }
121- }
122-
12387// Install render installation page
12488func Install (ctx * context.Context ) {
12589 form := forms.InstallForm {}
@@ -446,7 +410,7 @@ func SubmitInstall(ctx *context.Context) {
446410 }
447411
448412 // Re-read settings
449- PostInit (ctx )
413+ ReloadSettings (ctx )
450414
451415 // Create admin account
452416 if len (form .AdminName ) > 0 {
0 commit comments