-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathyedek-indir.php
More file actions
33 lines (26 loc) · 982 Bytes
/
Copy pathyedek-indir.php
File metadata and controls
33 lines (26 loc) · 982 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
declare(strict_types=1);
require_once __DIR__ . '/uygulama/baslat.php';
Auth::requireSuperAdmin();
$pdo = Database::getInstance()->getConnection();
$id = (int)($_GET['id'] ?? 0);
$stmt = $pdo->prepare("SELECT * FROM system_backups WHERE id = :id AND status = 'success' LIMIT 1");
$stmt->execute([':id' => $id]);
$backup = $stmt->fetch();
if (!$backup) {
http_response_code(404);
exit('Yedek bulunamadı.');
}
$path = V2::storagePath((string)$backup['storage_path']);
if (!is_file($path)) {
http_response_code(404);
exit('Yedek dosyası bulunamadı.');
}
AuditLog::log($pdo, 'export', 'system_backups', $id, null, ['filename' => $backup['filename']]);
header_remove('X-Powered-By');
header('Content-Type: application/sql; charset=UTF-8');
header('Content-Length: ' . filesize($path));
header('X-Content-Type-Options: nosniff');
header('Content-Disposition: attachment; filename="' . addslashes((string)$backup['filename']) . '"');
readfile($path);
exit;