install.go 761 B

1234567891011121314151617181920212223242526272829303132
  1. // Copyright 2014 The Gogs Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package routers
  5. import (
  6. "errors"
  7. "github.com/gogits/gogs/models"
  8. "github.com/gogits/gogs/modules/base"
  9. "github.com/gogits/gogs/modules/middleware"
  10. )
  11. func Install(ctx *middleware.Context) {
  12. if base.InstallLock {
  13. ctx.Handle(404, "install.Install", errors.New("Installation is prohibited"))
  14. return
  15. }
  16. ctx.Data["Title"] = "Install"
  17. ctx.Data["DbCfg"] = models.DbCfg
  18. ctx.Data["RepoRootPath"] = base.RepoRootPath
  19. ctx.Data["RunUser"] = base.RunUser
  20. ctx.Data["AppUrl"] = base.AppUrl
  21. ctx.Data["PageIsInstall"] = true
  22. if ctx.Req.Method == "GET" {
  23. ctx.HTML(200, "install")
  24. return
  25. }
  26. }