Add Turnstile protection and harden export workflow
This commit is contained in:
+27
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
if (PHP_SAPI !== 'cli') {
|
||||
http_response_code(404);
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once __DIR__ . '/app.php';
|
||||
|
||||
$downloadRetention = app_env_int('DOWNLOAD_RETENTION_HOURS', 48, 1, 720) * 3600;
|
||||
$staleTaskRetention = app_env_int('STALE_TASK_RETENTION_HOURS', 168, 24, 2160) * 3600;
|
||||
|
||||
$migrated = app_migrate_legacy_tasks();
|
||||
$downloads = app_cleanup_directory(app_download_dir(), $downloadRetention, 'csv');
|
||||
$legacyDownloads = app_cleanup_directory(__DIR__ . DIRECTORY_SEPARATOR . 'download', $downloadRetention, 'csv');
|
||||
$tasks = app_cleanup_directory(app_task_dir(), $staleTaskRetention, 'json');
|
||||
$rateLimits = app_cleanup_directory(app_rate_limit_dir(), 8 * 86400, 'json');
|
||||
|
||||
fwrite(STDOUT, sprintf(
|
||||
"Cleanup complete: %d tasks migrated; %d downloads, %d legacy downloads, %d stale tasks and %d rate-limit files deleted.\n",
|
||||
$migrated,
|
||||
$downloads,
|
||||
$legacyDownloads,
|
||||
$tasks,
|
||||
$rateLimits
|
||||
));
|
||||
Reference in New Issue
Block a user