mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 21:28:11 +09:00 
			
		
		
		
	cmd: dump: add an -L/--skip-log option (#11253)
Not all dumps need to include the logs, in a similar vain to not all dumps needing to include repositories; these may be subject to different backup mechanisms/constraints. Add a simple option to let them be excluded from the dump to simplify workflows that need to exclude them or not collect in the first place. Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: zeripath <art27@cantab.net>
This commit is contained in:
		
							
								
								
									
										11
									
								
								cmd/dump.go
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								cmd/dump.go
									
									
									
									
									
								
							| @@ -52,6 +52,10 @@ It can be used for backup and capture Gitea server image to send to maintainer`, | ||||
| 			Name:  "skip-repository, R", | ||||
| 			Usage: "Skip the repository dumping", | ||||
| 		}, | ||||
| 		cli.BoolFlag{ | ||||
| 			Name:  "skip-log, L", | ||||
| 			Usage: "Skip the log dumping", | ||||
| 		}, | ||||
| 	}, | ||||
| } | ||||
|  | ||||
| @@ -151,7 +155,12 @@ func runDump(ctx *cli.Context) error { | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	if com.IsExist(setting.LogRootPath) { | ||||
| 	// Doesn't check if LogRootPath exists before processing --skip-log intentionally, | ||||
| 	// ensuring that it's clear the dump is skipped whether the directory's initialized | ||||
| 	// yet or not. | ||||
| 	if ctx.IsSet("skip-log") && ctx.Bool("skip-log") { | ||||
| 		log.Info("Skip dumping log files") | ||||
| 	} else if com.IsExist(setting.LogRootPath) { | ||||
| 		if err := z.AddDir("log", setting.LogRootPath); err != nil { | ||||
| 			fatal("Failed to include log: %v", err) | ||||
| 		} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user