bug fix for dump when data directoryis not exist (#1025)
This commit is contained in:
parent
2f7dc28b22
commit
341b3a0349
|
@ -17,6 +17,7 @@ import (
|
||||||
"code.gitea.io/gitea/models"
|
"code.gitea.io/gitea/models"
|
||||||
"code.gitea.io/gitea/modules/setting"
|
"code.gitea.io/gitea/modules/setting"
|
||||||
"github.com/Unknwon/cae/zip"
|
"github.com/Unknwon/cae/zip"
|
||||||
|
"github.com/Unknwon/com"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -114,7 +115,9 @@ func runDump(ctx *cli.Context) error {
|
||||||
log.Printf("Custom dir %s doesn't exist, skipped", setting.CustomPath)
|
log.Printf("Custom dir %s doesn't exist, skipped", setting.CustomPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if com.IsExist(setting.AppDataPath) {
|
||||||
log.Printf("Packing data directory...%s", setting.AppDataPath)
|
log.Printf("Packing data directory...%s", setting.AppDataPath)
|
||||||
|
|
||||||
var sessionAbsPath string
|
var sessionAbsPath string
|
||||||
if setting.SessionConfig.Provider == "file" {
|
if setting.SessionConfig.Provider == "file" {
|
||||||
if len(setting.SessionConfig.ProviderConfig) == 0 {
|
if len(setting.SessionConfig.ProviderConfig) == 0 {
|
||||||
|
@ -122,10 +125,10 @@ func runDump(ctx *cli.Context) error {
|
||||||
}
|
}
|
||||||
sessionAbsPath, _ = filepath.Abs(setting.SessionConfig.ProviderConfig)
|
sessionAbsPath, _ = filepath.Abs(setting.SessionConfig.ProviderConfig)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := zipAddDirectoryExclude(z, "data", setting.AppDataPath, sessionAbsPath); err != nil {
|
if err := zipAddDirectoryExclude(z, "data", setting.AppDataPath, sessionAbsPath); err != nil {
|
||||||
log.Fatalf("Failed to include data directory: %v", err)
|
log.Fatalf("Failed to include data directory: %v", err)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if err := z.AddDir("log", setting.LogRootPath); err != nil {
|
if err := z.AddDir("log", setting.LogRootPath); err != nil {
|
||||||
log.Fatalf("Failed to include log: %v", err)
|
log.Fatalf("Failed to include log: %v", err)
|
||||||
|
|
Loading…
Reference in New Issue