You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
655 B

  1. // Copyright 2017 The Gitea 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 private
  5. import (
  6. "code.gitea.io/gitea/models"
  7. macaron "gopkg.in/macaron.v1"
  8. )
  9. // InitWiki initilizes wiki via repo id
  10. func InitWiki(ctx *macaron.Context) {
  11. repoID := ctx.ParamsInt64("repoid")
  12. repo, err := models.GetRepositoryByID(repoID)
  13. if err != nil {
  14. ctx.JSON(500, map[string]interface{}{
  15. "err": err.Error(),
  16. })
  17. return
  18. }
  19. err = repo.InitWiki()
  20. if err != nil {
  21. ctx.JSON(500, map[string]interface{}{
  22. "err": err.Error(),
  23. })
  24. return
  25. }
  26. ctx.Status(202)
  27. }