1
0
Fork 0

Remove traces of embedded TiDB (#4906)

Fix #3357
This commit is contained in:
techknowlogick 2018-09-11 10:42:40 -04:00 committed by GitHub
parent 8ee9922fe6
commit f1ad4bb3d5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 19 deletions

View file

@ -80,7 +80,7 @@ loading = Loading…
install = Installation install = Installation
title = Initial Configuration title = Initial Configuration
docker_helper = If you run Gitea inside Docker, please read the <a target="_blank" rel="noopener noreferrer" href="%s">documentation</a> before changing any settings. docker_helper = If you run Gitea inside Docker, please read the <a target="_blank" rel="noopener noreferrer" href="%s">documentation</a> before changing any settings.
requite_db_desc = Gitea requires MySQL, PostgreSQL, MSSQL, SQLite3 or TiDB. requite_db_desc = Gitea requires MySQL, PostgreSQL, MSSQL, or SQLite3.
db_title = Database Settings db_title = Database Settings
db_type = Database Type db_type = Database Type
host = Host host = Host
@ -90,9 +90,8 @@ db_name = Database Name
db_helper = Note to MySQL users: please use the InnoDB storage engine and the 'utf8_general_ci' character set. db_helper = Note to MySQL users: please use the InnoDB storage engine and the 'utf8_general_ci' character set.
ssl_mode = SSL ssl_mode = SSL
path = Path path = Path
sqlite_helper = File path for the SQLite3 or TiDB database.<br>Enter an absolute path if you run Gitea as a service. sqlite_helper = File path for the SQLite3 database.<br>Enter an absolute path if you run Gitea as a service.
err_empty_db_path = The SQLite3 or TiDB database path cannot be empty. err_empty_db_path = The SQLite3 database path cannot be empty.
err_invalid_tidb_name = The TiDB database name cannot contain the '.' and '-' characters.
no_admin_and_disable_registration = You cannot disable user self-registration without creating an administrator account. no_admin_and_disable_registration = You cannot disable user self-registration without creating an administrator account.
err_empty_admin_password = The administrator password cannot be empty. err_empty_admin_password = The administrator password cannot be empty.

View file

@ -8,7 +8,6 @@ import (
"errors" "errors"
"os" "os"
"os/exec" "os/exec"
"path"
"path/filepath" "path/filepath"
"strings" "strings"
@ -45,9 +44,6 @@ func InstallInit(ctx *context.Context) {
if models.EnableSQLite3 { if models.EnableSQLite3 {
dbOpts = append(dbOpts, "SQLite3") dbOpts = append(dbOpts, "SQLite3")
} }
if models.EnableTiDB {
dbOpts = append(dbOpts, "TiDB")
}
ctx.Data["DbOptions"] = dbOpts ctx.Data["DbOptions"] = dbOpts
} }
@ -72,10 +68,6 @@ func Install(ctx *context.Context) {
if models.EnableSQLite3 { if models.EnableSQLite3 {
ctx.Data["CurDbOption"] = "SQLite3" ctx.Data["CurDbOption"] = "SQLite3"
} }
case "tidb":
if models.EnableTiDB {
ctx.Data["CurDbOption"] = "TiDB"
}
} }
// Application general settings // Application general settings
@ -151,7 +143,7 @@ func InstallPost(ctx *context.Context, form auth.InstallForm) {
// Pass basic check, now test configuration. // Pass basic check, now test configuration.
// Test database setting. // Test database setting.
dbTypes := map[string]string{"MySQL": "mysql", "PostgreSQL": "postgres", "MSSQL": "mssql", "SQLite3": "sqlite3", "TiDB": "tidb"} dbTypes := map[string]string{"MySQL": "mysql", "PostgreSQL": "postgres", "MSSQL": "mssql", "SQLite3": "sqlite3"}
models.DbCfg.Type = dbTypes[form.DbType] models.DbCfg.Type = dbTypes[form.DbType]
models.DbCfg.Host = form.DbHost models.DbCfg.Host = form.DbHost
models.DbCfg.User = form.DbUser models.DbCfg.User = form.DbUser
@ -160,16 +152,11 @@ func InstallPost(ctx *context.Context, form auth.InstallForm) {
models.DbCfg.SSLMode = form.SSLMode models.DbCfg.SSLMode = form.SSLMode
models.DbCfg.Path = form.DbPath models.DbCfg.Path = form.DbPath
if (models.DbCfg.Type == "sqlite3" || models.DbCfg.Type == "tidb") && if (models.DbCfg.Type == "sqlite3") &&
len(models.DbCfg.Path) == 0 { len(models.DbCfg.Path) == 0 {
ctx.Data["Err_DbPath"] = true ctx.Data["Err_DbPath"] = true
ctx.RenderWithErr(ctx.Tr("install.err_empty_db_path"), tplInstall, &form) ctx.RenderWithErr(ctx.Tr("install.err_empty_db_path"), tplInstall, &form)
return return
} else if models.DbCfg.Type == "tidb" &&
strings.ContainsAny(path.Base(models.DbCfg.Path), ".-") {
ctx.Data["Err_DbPath"] = true
ctx.RenderWithErr(ctx.Tr("install.err_invalid_tidb_name"), tplInstall, &form)
return
} }
// Set test engine. // Set test engine.