Files
deskhub/DeskHub-Webseite/staff/update_download.php
T
2026-10-16 19:12:24 +00:00

25 lines
799 B
PHP

<?php
require_once __DIR__ . '/../includes/bootstrap.php';
$staff = require_admin();
$zipName = $_SESSION['update_zip'] ?? '';
if (!$zipName || !preg_match('/^deskhub-update-[\w\.\-]+\.zip$/', $zipName)) {
http_response_code(400); die('Kein Update-ZIP vorhanden.');
}
$zipPath = realpath(__DIR__ . '/../downloads') . '/' . $zipName;
if (!file_exists($zipPath)) {
http_response_code(404); die('Datei nicht gefunden.');
}
header('Content-Type: application/zip');
header('Content-Disposition: attachment; filename="' . $zipName . '"');
header('Content-Length: ' . filesize($zipPath));
header('Cache-Control: private, no-cache');
readfile($zipPath);
// Nach Download aufräumen
unlink($zipPath);
unset($_SESSION['update_zip'], $_SESSION['update_version'], $_SESSION['update_backup']);
exit;