@ -42,20 +42,18 @@ const (
tplPostInstall base . TplName = "post-install"
)
var supportedDbTypeNames [ ] map [ string ] string // use a slice to keep order
func getDbTypeNames ( ) [ ] map [ string ] string {
if supportedDbTypeNames == nil {
// getSupportedDbTypeNames returns a slice for supported database types and names. The slice is used to keep the order
func getSupportedDbTypeNames ( ) ( dbTypeNames [ ] map [ string ] string ) {
for _ , t := range setting . SupportedDatabaseTypes {
supporte dD bTypeNames = append ( supporte dD bTypeNames, map [ string ] string { "type" : t , "name" : setting . DatabaseTypeNames [ t ] } )
dbTypeNames = append ( dbTypeNames , map [ string ] string { "type" : t , "name" : setting . DatabaseTypeNames [ t ] } )
}
}
return supportedDbTypeNames
return dbTypeNames
}
// Init prepare for rendering installation page
func Init ( next http . Handler ) http . Handler {
rnd := templates . HTMLRenderer ( )
dbTypeNames := getSupportedDbTypeNames ( )
return http . HandlerFunc ( func ( resp http . ResponseWriter , req * http . Request ) {
if setting . InstallLock {
resp . Header ( ) . Add ( "Refresh" , "1; url=" + setting . AppURL + "user/login" )
@ -74,7 +72,7 @@ func Init(next http.Handler) http.Handler {
"i18n" : locale ,
"Title" : locale . Tr ( "install.install" ) ,
"PageIsInstall" : true ,
"DbTypeNames" : getDbTypeNames ( ) ,
"DbTypeNames" : dbTypeNames ,
"AllLangs" : translation . AllLangs ( ) ,
"PageStartTime" : startTime ,