#[Package('system-settings')]
class DeleteExpiredFilesService{ public function __construct(private readonly EntityRepository
$fileRepository) { } public function countFiles(Context
$context): int
{ $criteria =
$this->
buildCriteria();
$criteria->
setLimit(1
);
$criteria->
setTotalCountMode(Criteria::TOTAL_COUNT_MODE_EXACT
);
return $this->fileRepository->
search($criteria,
$context)->
getTotal();
} public function deleteFiles(Context
$context): void
{ $criteria =
$this->
buildCriteria();
$ids =
$this->fileRepository->
searchIds($criteria,
$context)->
getIds();