hikan.ru/mvc/controllers/backup.go

25 lines
507 B
Go
Raw Normal View History

2025-02-02 16:43:55 +03:00
package controllers
import (
"log"
2025-02-02 16:43:55 +03:00
"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.BackupAll(config.Cfg.DBPath, s.LogEntries, s.Cache); err != nil {
log.Println("s.Bot.Backup() error: ", err)
}
}()
2025-02-02 16:43:55 +03:00
c.Redirect(http.StatusFound, "/adm/1?Отстук инициирован")
})
}