Skip to content

Commit

Permalink
fix(website): fix issue with backup failed in websites (#8068)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhengkunwang223 authored Mar 5, 2025
1 parent a37fa5c commit 53a9940
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
6 changes: 3 additions & 3 deletions agent/app/service/backup_website.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand All @@ -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,
Expand Down Expand Up @@ -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
}
Expand Down
3 changes: 3 additions & 0 deletions agent/app/service/website_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -1161,6 +1161,7 @@ const (
SiteErrorLog = "error.log"
WebsiteRootDir = "WebsiteRootDir"
SiteDir = "SiteDir"
SitesDir = "SitesDir"
SiteIndexDir = "SiteIndexDir"
SiteProxyDir = "SiteProxyDir"
SiteSSLDir = "SiteSSLDir"
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/views/website/website/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 53a9940

Please sign in to comment.