23 lines
670 B
PHP
23 lines
670 B
PHP
<?php
|
|
namespace EEPROM;
|
|
|
|
$cronPath = sys_get_temp_dir() . '/eeprom-cron-' . hash('sha256', __DIR__) . '.lock';
|
|
if(is_file($cronPath))
|
|
die('EEPROM cron script is already running.' . PHP_EOL);
|
|
|
|
touch($cronPath);
|
|
try {
|
|
require_once __DIR__ . '/eeprom.php';
|
|
|
|
$eeprom->uploadsCtx->uploadsData->deleteExpiredUploads();
|
|
|
|
$records = $eeprom->storageCtx->records->getFiles(orphaned: true);
|
|
foreach($records as $record)
|
|
$eeprom->storageCtx->deleteFile($record);
|
|
|
|
$records = $eeprom->storageCtx->records->getFiles(denied: true);
|
|
foreach($records as $record)
|
|
$eeprom->storageCtx->deleteFile($record);
|
|
} finally {
|
|
unlink($cronPath);
|
|
}
|