mirror of https://github.com/go-gitea/gitea.git
Backport #30613 by @kemzeb Attempts to resolve #28720. Co-authored-by: Kemal Zebari <60799661+kemzeb@users.noreply.github.com>
This commit is contained in:
parent
fc376c863a
commit
5dbe7496c7
10
cmd/dump.go
10
cmd/dump.go
|
@ -87,6 +87,10 @@ var CmdDump = &cli.Command{
|
||||||
Name: "skip-index",
|
Name: "skip-index",
|
||||||
Usage: "Skip bleve index data",
|
Usage: "Skip bleve index data",
|
||||||
},
|
},
|
||||||
|
&cli.BoolFlag{
|
||||||
|
Name: "skip-db",
|
||||||
|
Usage: "Skip database",
|
||||||
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "type",
|
Name: "type",
|
||||||
Usage: fmt.Sprintf(`Dump output format, default to "zip", supported types: %s`, strings.Join(dump.SupportedOutputTypes, ", ")),
|
Usage: fmt.Sprintf(`Dump output format, default to "zip", supported types: %s`, strings.Join(dump.SupportedOutputTypes, ", ")),
|
||||||
|
@ -185,6 +189,11 @@ func runDump(ctx *cli.Context) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ctx.Bool("skip-db") {
|
||||||
|
// Ensure that we don't dump the database file that may reside in setting.AppDataPath or elsewhere.
|
||||||
|
dumper.GlobalExcludeAbsPath(setting.Database.Path)
|
||||||
|
log.Info("Skipping database")
|
||||||
|
} else {
|
||||||
tmpDir := ctx.String("tempdir")
|
tmpDir := ctx.String("tempdir")
|
||||||
if _, err := os.Stat(tmpDir); os.IsNotExist(err) {
|
if _, err := os.Stat(tmpDir); os.IsNotExist(err) {
|
||||||
fatal("Path does not exist: %s", tmpDir)
|
fatal("Path does not exist: %s", tmpDir)
|
||||||
|
@ -215,6 +224,7 @@ func runDump(ctx *cli.Context) error {
|
||||||
if err = dumper.AddFile("gitea-db.sql", dbDump.Name()); err != nil {
|
if err = dumper.AddFile("gitea-db.sql", dbDump.Name()); err != nil {
|
||||||
fatal("Failed to include gitea-db.sql: %v", err)
|
fatal("Failed to include gitea-db.sql: %v", err)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
log.Info("Adding custom configuration file from %s", setting.CustomConf)
|
log.Info("Adding custom configuration file from %s", setting.CustomConf)
|
||||||
if err = dumper.AddFile("app.ini", setting.CustomConf); err != nil {
|
if err = dumper.AddFile("app.ini", setting.CustomConf); err != nil {
|
||||||
|
|
Loading…
Reference in New Issue