From f1ad4bb3d5bc67c07a1ea51cfd7f7783483b49fd Mon Sep 17 00:00:00 2001 From: techknowlogick Date: Tue, 11 Sep 2018 10:42:40 -0400 Subject: [PATCH] Remove traces of embedded TiDB (#4906) Fix #3357 --- options/locale/locale_en-US.ini | 7 +++---- routers/install.go | 17 ++--------------- 2 files changed, 5 insertions(+), 19 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index b2d9114e95..c20b6624b0 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -80,7 +80,7 @@ loading = Loading… install = Installation title = Initial Configuration docker_helper = If you run Gitea inside Docker, please read the documentation 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_type = Database Type 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. ssl_mode = SSL path = Path -sqlite_helper = File path for the SQLite3 or TiDB database.
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_invalid_tidb_name = The TiDB database name cannot contain the '.' and '-' characters. +sqlite_helper = File path for the SQLite3 database.
Enter an absolute path if you run Gitea as a service. +err_empty_db_path = The SQLite3 database path cannot be empty. 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. diff --git a/routers/install.go b/routers/install.go index 03b8d68165..5e97bcc93c 100644 --- a/routers/install.go +++ b/routers/install.go @@ -8,7 +8,6 @@ import ( "errors" "os" "os/exec" - "path" "path/filepath" "strings" @@ -45,9 +44,6 @@ func InstallInit(ctx *context.Context) { if models.EnableSQLite3 { dbOpts = append(dbOpts, "SQLite3") } - if models.EnableTiDB { - dbOpts = append(dbOpts, "TiDB") - } ctx.Data["DbOptions"] = dbOpts } @@ -72,10 +68,6 @@ func Install(ctx *context.Context) { if models.EnableSQLite3 { ctx.Data["CurDbOption"] = "SQLite3" } - case "tidb": - if models.EnableTiDB { - ctx.Data["CurDbOption"] = "TiDB" - } } // Application general settings @@ -151,7 +143,7 @@ func InstallPost(ctx *context.Context, form auth.InstallForm) { // Pass basic check, now test configuration. // 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.Host = form.DbHost models.DbCfg.User = form.DbUser @@ -160,16 +152,11 @@ func InstallPost(ctx *context.Context, form auth.InstallForm) { models.DbCfg.SSLMode = form.SSLMode models.DbCfg.Path = form.DbPath - if (models.DbCfg.Type == "sqlite3" || models.DbCfg.Type == "tidb") && + if (models.DbCfg.Type == "sqlite3") && len(models.DbCfg.Path) == 0 { ctx.Data["Err_DbPath"] = true ctx.RenderWithErr(ctx.Tr("install.err_empty_db_path"), tplInstall, &form) 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.