2 declare(strict_types = 1);
18 use Symfony\Component\Console\Command\Command;
19 use Symfony\Component\Console\Input\InputInterface;
20 use Symfony\Component\Console\Output\OutputInterface;
21 use Symfony\Component\Console\Style\SymfonyStyle;
37 ->setDescription(
'Clean up expired preview links from shared workspace previews.')
38 ->setHelp(
'Look for preview links within the database table "sys_preview" that have been expired and and remove them. This command should be called regularly when working with workspaces.');
49 $io =
new SymfonyStyle($input,
$output);
51 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable(
'sys_preview');
52 $affectedRows = $queryBuilder
53 ->delete(
'sys_preview')
55 $queryBuilder->expr()->lt(
57 $queryBuilder->createNamedParameter(
$GLOBALS[
'EXEC_TIME'], \PDO::PARAM_INT)
62 if ($affectedRows > 0) {
63 $io->success(
'Cleaned up ' . $affectedRows .
' preview links.');
65 $io->note(
'No expired preview links found. All done.');