|
|
@ -46,6 +46,7 @@ func WikiPath(userName, repoName string) string { |
|
|
|
return filepath.Join(UserPath(userName), strings.ToLower(repoName)+".wiki.git") |
|
|
|
return filepath.Join(UserPath(userName), strings.ToLower(repoName)+".wiki.git") |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// WikiPath returns wiki data path for given repository.
|
|
|
|
func (repo *Repository) WikiPath() string { |
|
|
|
func (repo *Repository) WikiPath() string { |
|
|
|
return WikiPath(repo.MustOwner().Name, repo.Name) |
|
|
|
return WikiPath(repo.MustOwner().Name, repo.Name) |
|
|
|
} |
|
|
|
} |
|
|
@ -70,6 +71,7 @@ func (repo *Repository) InitWiki() error { |
|
|
|
return nil |
|
|
|
return nil |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// LocalWikiPath returns the path to the local wiki repository (?).
|
|
|
|
func (repo *Repository) LocalWikiPath() string { |
|
|
|
func (repo *Repository) LocalWikiPath() string { |
|
|
|
return path.Join(setting.AppDataPath, "tmp/local-wiki", com.ToStr(repo.ID)) |
|
|
|
return path.Join(setting.AppDataPath, "tmp/local-wiki", com.ToStr(repo.ID)) |
|
|
|
} |
|
|
|
} |
|
|
@ -141,14 +143,18 @@ func (repo *Repository) updateWikiPage(doer *User, oldTitle, title, content, mes |
|
|
|
return nil |
|
|
|
return nil |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// AddWikiPage adds a new wiki page with a given title.
|
|
|
|
func (repo *Repository) AddWikiPage(doer *User, title, content, message string) error { |
|
|
|
func (repo *Repository) AddWikiPage(doer *User, title, content, message string) error { |
|
|
|
return repo.updateWikiPage(doer, "", title, content, message, true) |
|
|
|
return repo.updateWikiPage(doer, "", title, content, message, true) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// EditWikiPage updates a wiki page identified by its title,
|
|
|
|
|
|
|
|
// optionally also changing title.
|
|
|
|
func (repo *Repository) EditWikiPage(doer *User, oldTitle, title, content, message string) error { |
|
|
|
func (repo *Repository) EditWikiPage(doer *User, oldTitle, title, content, message string) error { |
|
|
|
return repo.updateWikiPage(doer, oldTitle, title, content, message, false) |
|
|
|
return repo.updateWikiPage(doer, oldTitle, title, content, message, false) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// DeleteWikiPage deletes a wiki page identified by its title.
|
|
|
|
func (repo *Repository) DeleteWikiPage(doer *User, title string) (err error) { |
|
|
|
func (repo *Repository) DeleteWikiPage(doer *User, title string) (err error) { |
|
|
|
wikiWorkingPool.CheckIn(com.ToStr(repo.ID)) |
|
|
|
wikiWorkingPool.CheckIn(com.ToStr(repo.ID)) |
|
|
|
defer wikiWorkingPool.CheckOut(com.ToStr(repo.ID)) |
|
|
|
defer wikiWorkingPool.CheckOut(com.ToStr(repo.ID)) |
|
|
|