Fix archive reindex and add target dedup
This commit is contained in:
parent
e612896e06
commit
b16deffa25
9 changed files with 798 additions and 6 deletions
22
main.go
22
main.go
|
|
@ -23,6 +23,9 @@ func main() {
|
|||
watchInterval := flag.Duration("watch-interval", 60*time.Second, "Pause zwischen Watch-Durchlaeufen")
|
||||
seedAccount := flag.String("seed-account", "", "Konto aus lokaler JSON-Datei in die DB schreiben (nur CLI/Test)")
|
||||
checkAccount := flag.String("check-account", "", "Konto-Logins pruefen und INBOX zaehlen, ohne zu kopieren")
|
||||
reindex := flag.String("reindex", "", "Archiv-mbox-Index fuer Konto/Archiv oder 'all' neu aufbauen")
|
||||
dedupTarget := flag.String("dedup-target", "", "Ziel-Postfach nach Message-ID-Dubletten scannen (Dry-Run ohne --apply)")
|
||||
apply := flag.Bool("apply", false, "Scharfe Ausfuehrung fuer riskante Wartungsbefehle wie --dedup-target")
|
||||
initDB := flag.Bool("init-db", false, "SQLite-DB neu anlegen, falls db_path noch nicht existiert")
|
||||
flag.Parse()
|
||||
|
||||
|
|
@ -44,6 +47,18 @@ func main() {
|
|||
must(backend.CheckAccount(*checkAccount))
|
||||
return
|
||||
}
|
||||
if *reindex != "" {
|
||||
must(backend.ReindexArchives(*reindex))
|
||||
return
|
||||
}
|
||||
if *dedupTarget != "" {
|
||||
report, err := backend.DedupTarget(*dedupTarget, splitOptionalList(*runFolders), *apply)
|
||||
if err != nil {
|
||||
must(err)
|
||||
}
|
||||
backend.LogTargetDedupReport(report)
|
||||
return
|
||||
}
|
||||
|
||||
// CLI-Modus: ohne Web laufen lassen (Cronjob / Cutover).
|
||||
if *runOnce != "" {
|
||||
|
|
@ -78,3 +93,10 @@ func must(err error) {
|
|||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
func splitOptionalList(value string) []string {
|
||||
if strings.TrimSpace(value) == "" {
|
||||
return nil
|
||||
}
|
||||
return strings.Split(value, ",")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue