up
This commit is contained in:
@@ -63,7 +63,7 @@ func Run(ctx context.Context, dbConn *sql.DB, dbPath, folder string, rotation in
|
||||
}
|
||||
|
||||
stamp := time.Now().Format("2006-01-02")
|
||||
base := fmt.Sprintf("hamlog-%s", stamp)
|
||||
base := fmt.Sprintf("opslog-%s", stamp)
|
||||
var dstPath string
|
||||
if doZip {
|
||||
dstPath = filepath.Join(folder, base+".db.zip")
|
||||
@@ -141,7 +141,7 @@ func copyZipped(src, dst string) error {
|
||||
}
|
||||
|
||||
// rotate keeps the most recent `keep` backups in folder and deletes the
|
||||
// rest. Only files matching the hamlog-*.db / hamlog-*.db.zip pattern
|
||||
// rest. Only files matching the opslog-*.db / opslog-*.db.zip pattern
|
||||
// are touched — never user files that happen to live in the same folder.
|
||||
func rotate(folder string, keep int) error {
|
||||
entries, err := os.ReadDir(folder)
|
||||
@@ -158,7 +158,7 @@ func rotate(folder string, keep int) error {
|
||||
continue
|
||||
}
|
||||
name := e.Name()
|
||||
if !strings.HasPrefix(name, "hamlog-") {
|
||||
if !strings.HasPrefix(name, "opslog-") {
|
||||
continue
|
||||
}
|
||||
if !(strings.HasSuffix(name, ".db") || strings.HasSuffix(name, ".db.zip")) {
|
||||
@@ -192,7 +192,7 @@ func HasBackupToday(folder string) bool {
|
||||
}
|
||||
stamp := time.Now().Format("2006-01-02")
|
||||
for _, ext := range []string{".db", ".db.zip"} {
|
||||
if _, err := os.Stat(filepath.Join(folder, "hamlog-"+stamp+ext)); err == nil {
|
||||
if _, err := os.Stat(filepath.Join(folder, "opslog-"+stamp+ext)); err == nil {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user