From 725ad3f6d9313ee94c7e50a5e69b4be2556dc01a Mon Sep 17 00:00:00 2001 From: ssongliu <73214554+ssongliu@users.noreply.github.com> Date: Wed, 31 Jan 2024 15:08:34 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=9A=82=E6=97=B6=E7=A7=BB=E9=99=A4?= =?UTF-8?q?=E7=BD=91=E7=AB=99=E5=A4=87=E4=BB=BD=E8=A7=84=E5=88=99=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=20(#3764)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/service/backup_website.go | 10 +++++----- backend/app/service/cronjob_backup.go | 2 +- frontend/src/views/cronjob/operate/index.vue | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/backend/app/service/backup_website.go b/backend/app/service/backup_website.go index 9c6f16d77..7ec91e8a7 100644 --- a/backend/app/service/backup_website.go +++ b/backend/app/service/backup_website.go @@ -34,7 +34,7 @@ func (u *BackupService) WebsiteBackup(req dto.CommonBackup) error { itemDir := fmt.Sprintf("website/%s", req.Name) backupDir := path.Join(localDir, itemDir) fileName := fmt.Sprintf("%s_%s.tar.gz", website.PrimaryDomain, timeNow) - if err := handleWebsiteBackup(&website, backupDir, fileName, ""); err != nil { + if err := handleWebsiteBackup(&website, backupDir, fileName); err != nil { return err } @@ -106,7 +106,7 @@ func handleWebsiteRecover(website *model.Website, recoverFile string, isRollback isOk := false if !isRollback { rollbackFile := path.Join(global.CONF.System.TmpDir, fmt.Sprintf("website/%s_%s.tar.gz", website.Alias, time.Now().Format("20060102150405"))) - if err := handleWebsiteBackup(website, path.Dir(rollbackFile), path.Base(rollbackFile), ""); err != nil { + if err := handleWebsiteBackup(website, path.Dir(rollbackFile), path.Base(rollbackFile)); err != nil { return fmt.Errorf("backup website %s for rollback before recover failed, err: %v", website.Alias, err) } defer func() { @@ -181,7 +181,7 @@ func handleWebsiteRecover(website *model.Website, recoverFile string, isRollback return nil } -func handleWebsiteBackup(website *model.Website, backupDir, fileName, exclusionRules string) error { +func handleWebsiteBackup(website *model.Website, backupDir, fileName string) error { fileOp := files.NewFileOp() tmpDir := fmt.Sprintf("%s/%s", backupDir, strings.ReplaceAll(fileName, ".tar.gz", "")) if !fileOp.Stat(tmpDir) { @@ -233,11 +233,11 @@ func handleWebsiteBackup(website *model.Website, backupDir, fileName, exclusionR } websiteDir := fmt.Sprintf("%s/openresty/%s/www/sites/%s", constant.AppInstallDir, nginxInfo.Name, website.Alias) - if err := handleTar(websiteDir, tmpDir, fmt.Sprintf("%s.web.tar.gz", website.Alias), exclusionRules); err != nil { + if err := handleTar(websiteDir, tmpDir, fmt.Sprintf("%s.web.tar.gz", website.Alias), ""); err != nil { return err } global.LOG.Info("put web.tar.gz into tmp dir successful, now start to tar tmp dir") - if err := handleTar(tmpDir, backupDir, fileName, exclusionRules); err != nil { + if err := handleTar(tmpDir, backupDir, fileName, ""); err != nil { return err } diff --git a/backend/app/service/cronjob_backup.go b/backend/app/service/cronjob_backup.go index 7da0accb4..a016bbb4f 100644 --- a/backend/app/service/cronjob_backup.go +++ b/backend/app/service/cronjob_backup.go @@ -73,7 +73,7 @@ func (u *CronjobService) handleWebsite(cronjob model.Cronjob, startTime time.Tim record.Source, record.BackupType = loadRecordPath(cronjob, accountMap) backupDir := path.Join(global.CONF.System.TmpDir, fmt.Sprintf("website/%s", web.PrimaryDomain)) record.FileName = fmt.Sprintf("website_%s_%s.tar.gz", web.PrimaryDomain, startTime.Format("20060102150405")) - if err := handleWebsiteBackup(&web, backupDir, record.FileName, cronjob.ExclusionRules); err != nil { + if err := handleWebsiteBackup(&web, backupDir, record.FileName); err != nil { return err } downloadPath, err := u.uploadCronjobBackFile(cronjob, accountMap, path.Join(backupDir, record.FileName)) diff --git a/frontend/src/views/cronjob/operate/index.vue b/frontend/src/views/cronjob/operate/index.vue index 6c2a60a33..b5d24fbd8 100644 --- a/frontend/src/views/cronjob/operate/index.vue +++ b/frontend/src/views/cronjob/operate/index.vue @@ -297,7 +297,7 @@