RegenConfigFilesCommand.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. namespace Opentalent\OtAdmin\Command;
  3. use Opentalent\OtAdmin\Controller\SiteController;
  4. use Opentalent\OtCore\Exception\NoSuchOrganizationException;
  5. use Symfony\Component\Console\Command\Command;
  6. use Symfony\Component\Console\Input\InputArgument;
  7. use Symfony\Component\Console\Input\InputInterface;
  8. use Symfony\Component\Console\Input\InputOption;
  9. use Symfony\Component\Console\Output\OutputInterface;
  10. use Symfony\Component\Console\Style\SymfonyStyle;
  11. use TYPO3\CMS\Core\Database\ConnectionPool;
  12. use TYPO3\CMS\Core\Utility\GeneralUtility;
  13. use TYPO3\CMS\Extbase\Object\ObjectManager;
  14. /**
  15. * This CLI command create or update the organization config file, and update the identifier field in ot_websites table
  16. * This is a light alternative to the update command, designed to be executed on a development env, just after
  17. * the databases cloning.
  18. *
  19. * @package Opentalent\OtAdmin\Command
  20. */
  21. class RegenConfigFilesCommand extends Command
  22. {
  23. /**
  24. * -- This method is expected by Typo3, do not rename ou remove --
  25. *
  26. * Allows to configure the command.
  27. * Allows to add a description, a help text, and / or define arguments.
  28. *
  29. */
  30. protected function configure()
  31. {
  32. $this
  33. ->setName("ot:regen-config-files")
  34. ->setDescription("Recreate all of the website config files with the Db data");
  35. }
  36. /**
  37. * -- This method is expected by Typo3, do not rename ou remove --
  38. *
  39. * @param InputInterface $input
  40. * @param OutputInterface $output
  41. * @throws \Exception
  42. */
  43. protected function execute(InputInterface $input, OutputInterface $output)
  44. {
  45. $io = new SymfonyStyle($input, $output);
  46. $siteController = GeneralUtility::makeInstance(ObjectManager::class)->get(SiteController::class);
  47. $siteController->regenConfigFilesAction();
  48. $io->success(sprintf("The config files were recreated"));
  49. }
  50. }