mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Add gitea manager reload-templates command (#24843)
This can be useful to update custom templates in production mode, when they are updated frequently and a full Gitea restart each time is disruptive.
This commit is contained in:
committed by
GitHub
parent
922c83eea3
commit
3588edbb08
@@ -15,9 +15,22 @@ import (
|
||||
"code.gitea.io/gitea/modules/private"
|
||||
"code.gitea.io/gitea/modules/queue"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
"code.gitea.io/gitea/modules/templates"
|
||||
"code.gitea.io/gitea/modules/web"
|
||||
)
|
||||
|
||||
// ReloadTemplates reloads all the templates
|
||||
func ReloadTemplates(ctx *context.PrivateContext) {
|
||||
err := templates.ReloadHTMLTemplates()
|
||||
if err != nil {
|
||||
ctx.JSON(http.StatusInternalServerError, private.Response{
|
||||
UserMsg: fmt.Sprintf("Template error: %v", err),
|
||||
})
|
||||
return
|
||||
}
|
||||
ctx.PlainText(http.StatusOK, "success")
|
||||
}
|
||||
|
||||
// FlushQueues flushes all the Queues
|
||||
func FlushQueues(ctx *context.PrivateContext) {
|
||||
opts := web.GetForm(ctx).(*private.FlushOptions)
|
||||
|
Reference in New Issue
Block a user