1
1
// Copyright 2014 The Gogs Authors. All rights reserved.
2
+ // Copyright 2021 The Gitea Authors. All rights reserved.
2
3
// Use of this source code is governed by a MIT-style
3
4
// license that can be found in the LICENSE file.
4
5
5
6
package install
6
7
7
8
import (
8
- std_context "context"
9
9
"fmt"
10
10
"net/http"
11
11
"os"
@@ -21,14 +21,12 @@ import (
21
21
"code.gitea.io/gitea/modules/graceful"
22
22
"code.gitea.io/gitea/modules/log"
23
23
"code.gitea.io/gitea/modules/setting"
24
- "code.gitea.io/gitea/modules/svg"
25
24
"code.gitea.io/gitea/modules/templates"
26
25
"code.gitea.io/gitea/modules/translation"
27
26
"code.gitea.io/gitea/modules/user"
28
27
"code.gitea.io/gitea/modules/util"
29
28
"code.gitea.io/gitea/modules/web"
30
29
"code.gitea.io/gitea/modules/web/middleware"
31
- "code.gitea.io/gitea/routers/common"
32
30
"code.gitea.io/gitea/services/forms"
33
31
34
32
"gitea.com/go-chi/session"
@@ -86,40 +84,6 @@ func Init(next http.Handler) http.Handler {
86
84
})
87
85
}
88
86
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
-
123
87
// Install render installation page
124
88
func Install (ctx * context.Context ) {
125
89
form := forms.InstallForm {}
@@ -446,7 +410,7 @@ func SubmitInstall(ctx *context.Context) {
446
410
}
447
411
448
412
// Re-read settings
449
- PostInit (ctx )
413
+ ReloadSettings (ctx )
450
414
451
415
// Create admin account
452
416
if len (form .AdminName ) > 0 {
0 commit comments