25 lines
504 B
Go
25 lines
504 B
Go
package controllers
|
|
|
|
import (
|
|
"log"
|
|
"main/config"
|
|
"main/mvc/models"
|
|
"net/http"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
// Отстукивает в ТГ
|
|
func Backup(tmplname string, group *gin.RouterGroup, s *models.Site) {
|
|
group.POST(tmplname, func(c *gin.Context) {
|
|
|
|
go func() {
|
|
if err := s.Bot.Backup(config.Cfg.DBPath, s.LogEntries, s.Cache); err != nil {
|
|
log.Println("s.Bot.Backup() error: ", err)
|
|
}
|
|
}()
|
|
|
|
c.Redirect(http.StatusFound, "/adm/1?Отстук инициирован")
|
|
})
|
|
}
|