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.
40 lines
1.1 KiB
40 lines
1.1 KiB
9 years ago
|
// Copyright 2015 The Gogs Authors. All rights reserved.
|
||
5 years ago
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||
9 years ago
|
// Use of this source code is governed by a MIT-style
|
||
|
// license that can be found in the LICENSE file.
|
||
|
|
||
3 years ago
|
package repo
|
||
9 years ago
|
|
||
|
import (
|
||
|
"path/filepath"
|
||
|
"strings"
|
||
9 years ago
|
|
||
3 years ago
|
user_model "code.gitea.io/gitea/models/user"
|
||
4 years ago
|
"code.gitea.io/gitea/modules/log"
|
||
|
"code.gitea.io/gitea/modules/util"
|
||
9 years ago
|
)
|
||
|
|
||
9 years ago
|
// WikiCloneLink returns clone URLs of repository wiki.
|
||
8 years ago
|
func (repo *Repository) WikiCloneLink() *CloneLink {
|
||
5 years ago
|
return repo.cloneLink(true)
|
||
9 years ago
|
}
|
||
|
|
||
9 years ago
|
// WikiPath returns wiki data path by given user and repository name.
|
||
|
func WikiPath(userName, repoName string) string {
|
||
3 years ago
|
return filepath.Join(user_model.UserPath(userName), strings.ToLower(repoName)+".wiki.git")
|
||
9 years ago
|
}
|
||
|
|
||
8 years ago
|
// WikiPath returns wiki data path for given repository.
|
||
9 years ago
|
func (repo *Repository) WikiPath() string {
|
||
5 years ago
|
return WikiPath(repo.OwnerName, repo.Name)
|
||
9 years ago
|
}
|
||
|
|
||
|
// HasWiki returns true if repository has wiki.
|
||
|
func (repo *Repository) HasWiki() bool {
|
||
4 years ago
|
isDir, err := util.IsDir(repo.WikiPath())
|
||
|
if err != nil {
|
||
|
log.Error("Unable to check if %s is a directory: %v", repo.WikiPath(), err)
|
||
|
}
|
||
|
return isDir
|
||
9 years ago
|
}
|