mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-11-11 12:10:45 +08:00
fix(website): fix issue with backup failed in websites (#8068)
This commit is contained in:
parent
a37fa5c77c
commit
53a99400c0
3 changed files with 7 additions and 4 deletions
|
|
@ -33,7 +33,7 @@ func (u *BackupService) WebsiteBackup(req dto.CommonBackup) error {
|
|||
}
|
||||
|
||||
timeNow := time.Now().Format(constant.DateTimeSlimLayout)
|
||||
itemDir := fmt.Sprintf("website/%s", req.Name)
|
||||
itemDir := fmt.Sprintf("website/%s", website.Alias)
|
||||
backupDir := path.Join(global.Dir.LocalBackupDir, itemDir)
|
||||
fileName := fmt.Sprintf("%s_%s.tar.gz", website.Alias, timeNow+common.RandStrAndNum(5))
|
||||
|
||||
|
|
@ -45,7 +45,7 @@ func (u *BackupService) WebsiteBackup(req dto.CommonBackup) error {
|
|||
record := &model.BackupRecord{
|
||||
Type: "website",
|
||||
Name: website.Alias,
|
||||
DetailName: req.DetailName,
|
||||
DetailName: website.Alias,
|
||||
SourceAccountIDs: "1",
|
||||
DownloadAccountID: 1,
|
||||
FileDir: itemDir,
|
||||
|
|
@ -184,7 +184,7 @@ func handleWebsiteRecover(website *model.Website, recoverFile string, isRollback
|
|||
}
|
||||
taskName := i18n.GetMsgByKey("TaskRecover") + i18n.GetMsgByKey("websiteDir")
|
||||
t.Log(taskName)
|
||||
if err = fileOp.TarGzExtractPro(fmt.Sprintf("%s/%s.web.tar.gz", tmpPath, website.Alias), GetSitePath(*website, SiteDir), ""); err != nil {
|
||||
if err = fileOp.TarGzExtractPro(fmt.Sprintf("%s/%s.web.tar.gz", tmpPath, website.Alias), GetSitePath(*website, SitesDir), secret); err != nil {
|
||||
t.LogFailedWithErr(taskName, err)
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1161,6 +1161,7 @@ const (
|
|||
SiteErrorLog = "error.log"
|
||||
WebsiteRootDir = "WebsiteRootDir"
|
||||
SiteDir = "SiteDir"
|
||||
SitesDir = "SitesDir"
|
||||
SiteIndexDir = "SiteIndexDir"
|
||||
SiteProxyDir = "SiteProxyDir"
|
||||
SiteSSLDir = "SiteSSLDir"
|
||||
|
|
@ -1185,6 +1186,8 @@ func GetSitePath(website model.Website, confType string) string {
|
|||
return path.Join(GteSiteDir(website.Alias), "log", "error.log")
|
||||
case SiteDir:
|
||||
return GteSiteDir(website.Alias)
|
||||
case SitesDir:
|
||||
return path.Join(GetWebSiteRootDir(), "sites")
|
||||
case SiteIndexDir:
|
||||
return path.Join(GteSiteDir(website.Alias), "index")
|
||||
case SiteCacheDir:
|
||||
|
|
|
|||
|
|
@ -466,7 +466,7 @@ const buttons = [
|
|||
click: (row: Website.Website) => {
|
||||
let params = {
|
||||
type: 'website',
|
||||
name: row.primaryDomain,
|
||||
name: row.alias,
|
||||
detailName: row.alias,
|
||||
};
|
||||
dialogBackupRef.value!.acceptParams(params);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue