24 lines
537 B
PHP
24 lines
537 B
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
if (PHP_SAPI !== 'cli') {
|
|
http_response_code(404);
|
|
exit;
|
|
}
|
|
|
|
require_once __DIR__ . '/app.php';
|
|
|
|
if (($argv[1] ?? '') !== '--confirm') {
|
|
fwrite(STDERR, "This command deletes every pending export task. Run: php deleteFiles.php --confirm\n");
|
|
exit(2);
|
|
}
|
|
|
|
$deleted = 0;
|
|
foreach (glob(app_task_dir() . DIRECTORY_SEPARATOR . '*.json') ?: [] as $filename) {
|
|
if (is_file($filename) && unlink($filename)) {
|
|
$deleted++;
|
|
}
|
|
}
|
|
|
|
fwrite(STDOUT, $deleted . " pending task(s) deleted.\n");
|