2
0
mirror of https://github.com/acepanel/panel.git synced 2026-02-05 14:53:19 +08:00

refactor: 重构 tools.Chmod 函数

This commit is contained in:
耗子
2023-11-12 03:12:35 +08:00
parent 4c41ec036c
commit edd526d3b8
6 changed files with 18 additions and 16 deletions

View File

@@ -114,7 +114,9 @@ func (s *BackupImpl) WebsiteRestore(website models.Website, backupFile string) e
tools.Exec(`rm -rf '` + website.Path + `/*'`)
tools.Exec(`unzip -o '` + backupFile + `' -d '` + website.Path + `' 2>&1`)
tools.Chmod(website.Path, 0755)
if err := tools.Chmod(website.Path, 0755); err != nil {
return err
}
tools.Chown(website.Path, "www", "www")
return nil

View File

@@ -282,8 +282,12 @@ server
return models.Website{}, err
}
tools.Chmod(r.setting.Get(models.SettingKeyWebsitePath), 0755)
tools.Chmod(website.Path, 0755)
if err := tools.Chmod(r.setting.Get(models.SettingKeyWebsitePath), 0755); err != nil {
return models.Website{}, err
}
if err := tools.Chmod(website.Path, 0755); err != nil {
return models.Website{}, err
}
tools.Chown(r.setting.Get(models.SettingKeyWebsitePath), "www", "www")
tools.Chown(website.Path, "www", "www")