setName("ot:site:delete-user-created-pages") ->setDescription("Delete all the pages created by the users, leaving only the starting mandatory pages.") ->setHelp("This CLI command provoke the definitive deletion of all the pages created by the users, leaving only the starting mandatory pages. /!\ Warning: this is a destructive operation.") ->addArgument( 'organization-id', InputArgument::OPTIONAL, "The organization's id in the opentalent DB" ); } /** * -- This method is expected by Typo3, do not rename ou remove -- * * @param InputInterface $input * @param OutputInterface $output * @return int * @throws \Exception */ protected function execute(InputInterface $input, OutputInterface $output): int { $org_id = $input->getArgument('organization-id'); $io = new SymfonyStyle($input, $output); if ( !$io->confirm("Are you sure you want to delete all the pages created " . "by the users? (organization id: " . $org_id . ")") ) { $io->error("Aborting."); return 1; } $rootUid = $this->siteController->deleteUserCreatedPagesAction($org_id); $io->success(sprintf("The website with root uid " . $rootUid . " had its user-created pages deleted.")); return 0; } }