Interfaccia, parte 2: Attività, Impostazioni, collegamento, Importa, doppioni, primo avvio ed errori di configurazione
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Mzbb6zeFTjT6Rp8b92AVkA
This commit is contained in:
90 files changed
+7825
-49
No files matched your search
@@ -64,6 +64,35 @@ public sealed partial class DailyBackup(IDatabaseMaintenance database, IClock cl
|
||||
return new BackupResult(created, ApplyRetention(today));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// «Fai una copia adesso» (Impostazioni, Dati): a fresh copy of the database now. It becomes today's copy, replacing
|
||||
/// the one made earlier today only after the new one is complete (one copy per day, as the retention expects).
|
||||
/// Then the retention is applied.
|
||||
/// </summary>
|
||||
public async Task<BackupResult> RunNowAsync(CancellationToken ct = default)
|
||||
{
|
||||
Directory.CreateDirectory(Folder);
|
||||
var today = LocalCalendar.Today(clock.Now, clock.LocalZone);
|
||||
var target = Path.Combine(Folder, FileNameFor(today));
|
||||
var part = target + "." + Guid.NewGuid().ToString("N")[..8] + PartSuffix;
|
||||
BackupFile created;
|
||||
try
|
||||
{
|
||||
await database.BackupToAsync(part, ct).ConfigureAwait(false);
|
||||
File.Move(part, target, overwrite: true);
|
||||
created = new BackupFile(today, target, new FileInfo(target).Length);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (File.Exists(part))
|
||||
{
|
||||
File.Delete(part);
|
||||
}
|
||||
}
|
||||
|
||||
return new BackupResult(created, ApplyRetention(today));
|
||||
}
|
||||
|
||||
/// <summary>The copies present, newest first.</summary>
|
||||
public IReadOnlyList<BackupFile> List()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user