diff options
author | Unknwon <u@gogs.io> | 2016-03-03 23:04:35 -0500 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2016-03-03 23:04:35 -0500 |
commit | 1cbc5b49e3d6f072c9f78a4708c77b7f4f279108 (patch) | |
tree | 4e23d990586b5f91f9f3e46ad6742d755b589c2c /models | |
parent | f946040fa94a3acb3b1f54873e6f95766595829c (diff) | |
parent | f3358f5927c7947c90b921371e589cb73c70e1cc (diff) |
Merge pull request #2745 from joshfng/delete-wiki-option
Repo setting to delete and disable wiki
Diffstat (limited to 'models')
-rw-r--r-- | models/repo.go | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/models/repo.go b/models/repo.go index 22336d3c..4d37c6e9 100644 --- a/models/repo.go +++ b/models/repo.go @@ -241,6 +241,17 @@ func (repo *Repository) ComposeMetas() map[string]string { return repo.ExternalMetas } +func DeleteWiki(repo *Repository) { + repo.DeleteWiki() +} + +func (repo *Repository) DeleteWiki() { + wikiPaths := []string{repo.WikiPath(), repo.LocalWikiPath()} + for _, wikiPath := range wikiPaths { + RemoveAllWithNotice("Delete repository wiki", wikiPath) + } +} + // GetAssignees returns all users that have write access of repository. func (repo *Repository) GetAssignees() (_ []*User, err error) { if err = repo.GetOwner(); err != nil { @@ -1335,10 +1346,7 @@ func DeleteRepository(uid, repoID int64) error { repoPath := repo.repoPath(sess) RemoveAllWithNotice("Delete repository files", repoPath) - wikiPaths := []string{repo.WikiPath(), repo.LocalWikiPath()} - for _, wikiPath := range wikiPaths { - RemoveAllWithNotice("Delete repository wiki", wikiPath) - } + repo.DeleteWiki() // Remove attachment files. for i := range attachmentPaths { |