diff options
author | guillep2k <18600385+guillep2k@users.noreply.github.com> | 2020-01-31 10:42:45 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-31 21:42:45 +0800 |
commit | d816f7018b0726f868fa0cddf02ffae184601395 (patch) | |
tree | ff1a08e7dab91a45afef0e53a5d006f074613987 /models/migrations/v13.go | |
parent | b3d8e2d4f7a0ebf768ab6bcb102755839a6b9311 (diff) | |
download | gitea-d816f7018b0726f868fa0cddf02ffae184601395.tar.gz gitea-d816f7018b0726f868fa0cddf02ffae184601395.zip |
Remove migration support from versions earlier than 1.6.0 (#10026)
* Remove migration support from versions earlier than 1.6.0
* Remove unused functions
* Update gogs upgrade instructions
* Improve "latest" link as per @jolheiser
Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'models/migrations/v13.go')
-rw-r--r-- | models/migrations/v13.go | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/models/migrations/v13.go b/models/migrations/v13.go deleted file mode 100644 index 3c35b66ab9..0000000000 --- a/models/migrations/v13.go +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2016 The Gogs Authors. All rights reserved. -// Use of this source code is governed by a MIT-style -// license that can be found in the LICENSE file. - -package migrations - -import ( - "encoding/json" - "fmt" - "strings" - - "github.com/unknwon/com" - "xorm.io/xorm" -) - -func ldapUseSSLToSecurityProtocol(x *xorm.Engine) error { - results, err := x.Query("SELECT `id`,`cfg` FROM `login_source` WHERE `type` = 2 OR `type` = 5") - if err != nil { - if strings.Contains(err.Error(), "no such column") { - return nil - } - return fmt.Errorf("select LDAP login sources: %v", err) - } - - sess := x.NewSession() - defer sess.Close() - if err = sess.Begin(); err != nil { - return err - } - - for _, result := range results { - cfg := map[string]interface{}{} - if err = json.Unmarshal(result["cfg"], &cfg); err != nil { - return fmt.Errorf("decode JSON config: %v", err) - } - if com.ToStr(cfg["UseSSL"]) == "true" { - cfg["SecurityProtocol"] = 1 // LDAPS - } - delete(cfg, "UseSSL") - - data, err := json.Marshal(&cfg) - if err != nil { - return fmt.Errorf("encode JSON config: %v", err) - } - - if _, err = sess.Exec("UPDATE `login_source` SET `cfg`=? WHERE `id`=?", - string(data), com.StrTo(result["id"]).MustInt64()); err != nil { - return fmt.Errorf("update config column: %v", err) - } - } - return sess.Commit() -} |