| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- <?php
- namespace Opentalent\OtAdmin\Command;
- use Opentalent\OtAdmin\Controller\SiteController;
- use Symfony\Component\Console\Command\Command;
- use Symfony\Component\Console\Input\InputArgument;
- use Symfony\Component\Console\Input\InputInterface;
- use Symfony\Component\Console\Input\InputOption;
- use Symfony\Component\Console\Output\OutputInterface;
- use Symfony\Component\Console\Style\SymfonyStyle;
- /**
- * This CLI command clears the cache of an existing organization's website
- *
- * By default, this command will only clear the frontend cache.
- * Pass the '-a / --all' option to clear all of the typo3 caches.
- *
- * @package Opentalent\OtAdmin\Command
- */
- class ClearSiteCacheCommand extends Command
- {
- /**
- * -- This method is expected by Typo3, do not rename ou remove --
- *
- * Allows to configure the command.
- * Allows to add a description, a help text, and / or define arguments.
- *
- */
- protected function configure()
- {
- $this
- ->setName("ot:site:clear-cache")
- ->setDescription("Clear the cache of an organization website")
- ->setHelp("This CLI command clears the cache of an existing organization's website")
- ->addArgument(
- 'organization_id',
- InputArgument::REQUIRED,
- "The organization's id in the opentalent DB"
- )->addOption(
- 'all',
- 'a',
- InputOption::VALUE_NONE,
- 'Use this option to clear all the typo3 caches, and not only the frontend one'
- );
- }
- /**
- * -- This method is expected by Typo3, do not rename ou remove --
- *
- * Executes the command for clearing the cache of the organization's website
- *
- * @param InputInterface $input
- * @param OutputInterface $output
- * @throws \Exception
- */
- protected function execute(InputInterface $input, OutputInterface $output)
- {
- $org_id = $input->getArgument('organization_id');
- $clearAll = $input->getOption('all');
- $io = new SymfonyStyle($input, $output);
- $siteController = new SiteController();
- $rootUid = $siteController->clearSiteCacheAction($org_id, $clearAll);
- $io->success(sprintf("The cache has been cleared for the website with root uid " . $rootUid . ""));
- }
- }
|