471cfdd161
- 1 - Add: Gitea now creates timestamped database backup bundles under `[backup].PATH`, exposes the backup schedule in the installer, and surfaces the `database_backup` cron task in admin monitoring. - 2 - Add: installed instances now use `.gitea-installed` and `.gitea-recovery.ini` to enter email-gated recovery instead of falling back to public install mode when configuration or database access is broken. - 3 - Mod: the installer recovery flow now covers backup-bundle restore, bundled or manual `app.ini` reuse, uploaded SQL/GZ database restores, and repository-filesystem recovery with source-specific validation, confirmations, and preserved launcher state. - 4 - Fix: recovery now restores bundled `app.ini` snapshots when needed, discovers backup bundles from both the active backup path and persisted `.gitea-recovery.ini` path, and preserves SMTP and other rebuilt settings correctly when `app.ini` is missing or incomplete. - 5 - Fix: recovery validation and restore handling now accept either a selected backup bundle or an uploaded SQL/GZ dump, keep sensitive secrets and existing `LFS_JWT_SECRET` when appropriate, clear SQLite restore targets before import, and complete the post-install handoff without redirect loops. - 6 - Mod: fresh installs now default recovery email authorization to enabled with first-admin fallback, and the install/recovery UI, styling, and EN/RO wording were refined to match the final launcher behavior. Co-Authored-By: petru @ codex (GPT-5) <codex@openai.com> (cherry picked from commit 9879caf2292691b0cb521d12e6fee924b066bae2)
38 lines
962 B
Go
38 lines
962 B
Go
// Copyright 2026 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package setting
|
|
|
|
import "path/filepath"
|
|
|
|
// start edit/add - by petru @ codex
|
|
var Backup = struct {
|
|
Path string
|
|
RetentionCount int
|
|
Compress bool
|
|
IncludeAppINISnapshot bool
|
|
}{
|
|
RetentionCount: 7,
|
|
Compress: true,
|
|
IncludeAppINISnapshot: true,
|
|
}
|
|
|
|
func loadBackupFrom(rootCfg ConfigProvider) {
|
|
sec := rootCfg.Section("backup")
|
|
|
|
Backup.Path = sec.Key("PATH").MustString(filepath.Join(AppDataPath, "backups", "db"))
|
|
if !filepath.IsAbs(Backup.Path) {
|
|
Backup.Path = filepath.Join(AppWorkPath, Backup.Path)
|
|
}
|
|
|
|
Backup.RetentionCount = sec.Key("RETENTION_COUNT").MustInt(7)
|
|
if Backup.RetentionCount < 0 {
|
|
Backup.RetentionCount = 0
|
|
}
|
|
|
|
Backup.Compress = sec.Key("COMPRESS").MustBool(true)
|
|
Backup.IncludeAppINISnapshot = sec.Key("INCLUDE_APP_INI_SNAPSHOT").MustBool(true)
|
|
}
|
|
|
|
// end edit/add - by petru @ codex
|