install.go 727 B

12345678910111213141516171819202122232425262728293031
  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["PageIsInstall"] = true
  21. if ctx.Req.Method == "GET" {
  22. ctx.HTML(200, "install")
  23. return
  24. }
  25. }