diff options
author | Unknwon <u@gogs.io> | 2015-03-25 19:51:22 -0400 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2015-03-25 19:51:22 -0400 |
commit | 99b774e741a1d222d42518c276987e689a6a490a (patch) | |
tree | 362a264d9b1d5420d2e3934ebea2dc3914b29dd5 /models/migrations | |
parent | f2b851388b09ed4f47c17b950abd31f30256f32d (diff) | |
download | gitea-99b774e741a1d222d42518c276987e689a6a490a.tar.gz gitea-99b774e741a1d222d42518c276987e689a6a490a.zip |
auto fix locale file name change
Diffstat (limited to 'models/migrations')
-rw-r--r-- | models/migrations/migrations.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/models/migrations/migrations.go b/models/migrations/migrations.go index 94cab453f6..7ad0cbdd12 100644 --- a/models/migrations/migrations.go +++ b/models/migrations/migrations.go @@ -11,6 +11,7 @@ import ( "github.com/Unknwon/com" "github.com/go-xorm/xorm" + "gopkg.in/ini.v1" "github.com/gogits/gogs/modules/log" "github.com/gogits/gogs/modules/setting" @@ -54,6 +55,7 @@ var migrations = []Migration{ NewMigration("make authorize 4 if team is owners", ownerTeamUpdate), // V1 -> V2:v0.5.13 NewMigration("refactor access table to use id's", accessRefactor), // V2 -> V3:v0.5.13 NewMigration("generate team-repo from team", teamToTeamRepo), // V3 -> V4:v0.5.13 + NewMigration("fix locale file load panic", fixLocaleFileLoadPanic), // V4 -> V5:v0.6.0 } // Migrate database to current version @@ -372,3 +374,18 @@ func teamToTeamRepo(x *xorm.Engine) error { return sess.Commit() } + +func fixLocaleFileLoadPanic(_ *xorm.Engine) error { + cfg, err := ini.Load(setting.CustomConf) + if err != nil { + return fmt.Errorf("load custom config: %v", err) + } + + cfg.DeleteSection("i18n") + if err = cfg.SaveTo(setting.CustomConf); err != nil { + return fmt.Errorf("save custom config: %v", err) + } + + setting.Langs = strings.Split(strings.Replace(strings.Join(setting.Langs, ","), "fr-CA", "fr-FR", 1), ",") + return nil +} |