setDescription('Lock the TYPO3 Backend') ->addArgument( 'redirect', InputArgument::OPTIONAL, 'If set, then the TYPO3 Backend will redirect to the locking state (only used when locking the TYPO3 Backend' ); } /** * Executes the command for adding the lock file * * @param InputInterface $input * @param OutputInterface $output */ protected function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output); $io->title($this->getDescription()); $lockFile = $this->getLockFileName(); if (@is_file($lockFile)) { $io->note('A lock file already exists. Overwriting it.'); } $output = 'Wrote lock file to "' . $lockFile . '"'; if ($input->getArgument('redirect')) { $lockFileContent = $input->getArgument('redirect'); $output .= LF . 'with content "' . $lockFileContent . '".'; } else { $lockFileContent = ''; $output .= '.'; } GeneralUtility::writeFile($lockFile, $lockFileContent); $io->success($output); } /** * Location of the file name * * @return string */ protected function getLockFileName() { return Environment::getLegacyConfigPath() . '/LOCK_BACKEND'; } }