2020-05-08 22:53:21 +00:00
|
|
|
<?php
|
|
|
|
namespace EEPROM;
|
|
|
|
|
|
|
|
if(!defined('EEPROM_SEM_NAME'))
|
|
|
|
define('EEPROM_SEM_NAME', 'c');
|
|
|
|
if(!defined('EEPROM_SFM_PATH'))
|
|
|
|
define('EEPROM_SFM_PATH', sys_get_temp_dir() . DIRECTORY_SEPARATOR . '{6bf19abb-ae7e-4a1d-85f9-00dfb7c90264}');
|
|
|
|
|
|
|
|
if(!is_file(EEPROM_SFM_PATH))
|
|
|
|
touch(EEPROM_SFM_PATH);
|
|
|
|
|
|
|
|
$ftok = ftok(EEPROM_SFM_PATH, EEPROM_SEM_NAME);
|
|
|
|
$semaphore = sem_get($ftok, 1);
|
|
|
|
if(!sem_acquire($semaphore))
|
|
|
|
die('Failed to acquire semaphore.' . PHP_EOL);
|
|
|
|
|
2023-11-09 18:56:48 +00:00
|
|
|
try {
|
|
|
|
require_once __DIR__ . '/eeprom.php';
|
2020-05-08 22:53:21 +00:00
|
|
|
|
2023-11-09 18:56:48 +00:00
|
|
|
// Mark expired as deleted
|
2024-12-20 03:17:58 +00:00
|
|
|
$expired = $eeprom->uploadsCtx->uploadsData->getUploads(expired: true, deleted: false);
|
2023-11-09 18:56:48 +00:00
|
|
|
foreach($expired as $uploadInfo)
|
2024-12-20 03:17:58 +00:00
|
|
|
$eeprom->uploadsCtx->uploadsData->deleteUpload($uploadInfo);
|
2020-05-08 22:53:21 +00:00
|
|
|
|
2023-11-09 18:56:48 +00:00
|
|
|
// Hard delete soft deleted files
|
2024-12-20 03:17:58 +00:00
|
|
|
$deleted = $eeprom->uploadsCtx->uploadsData->getUploads(deleted: true);
|
2023-11-09 18:56:48 +00:00
|
|
|
foreach($deleted as $uploadInfo) {
|
2024-12-20 03:17:58 +00:00
|
|
|
$eeprom->uploadsCtx->deleteUploadData($uploadInfo);
|
|
|
|
$eeprom->uploadsCtx->uploadsData->nukeUpload($uploadInfo);
|
2023-11-09 18:56:48 +00:00
|
|
|
}
|
2023-11-09 20:29:57 +00:00
|
|
|
|
2023-11-11 02:00:01 +00:00
|
|
|
// new storage format should store by hashes again, ensure blacklisted data is no longer saved
|
2023-11-09 18:56:48 +00:00
|
|
|
} finally {
|
|
|
|
sem_release($semaphore);
|
|
|
|
}
|