<?php
require_once __DIR__ . '/../../app/includes/auth.php';
require_auth();
require_admin();
verify_csrf();
require_once __DIR__ . '/../../app/services/DatabaseBackupService.php';
try {
    $filename = DatabaseBackupService::create(db());
    log_activity('database_backup_created', 'Created database backup ' . $filename);
    flash('success', 'Database backup created successfully.');
} catch (Throwable $e) {
    flash('error', $e->getMessage());
}
redirect('/backups/index.php');
