addArgument( 'redirect', InputArgument::OPTIONAL, 'If set, a locked TYPO3 Backend will redirect to URI specified with this argument. The URI is saved as a string in the lockfile that is specified in the system configuration.', '' ); } /** * Executes the command for adding the lock file */ protected function execute(InputInterface $input, OutputInterface $output): int { $io = new SymfonyStyle($input, $output); $io->title($this->getDescription()); if ($this->lockService->isLocked()) { $io->note('A lock file already exists. Overwriting it.'); } $lockFile = $this->lockService->getAbsolutePathToLockFile(); $redirectUriFromLockFileContent = $input->getArgument('redirect'); if ($redirectUriFromLockFileContent) { $redirectUriFromLockFileContent = is_string($redirectUriFromLockFileContent) ? $redirectUriFromLockFileContent : ''; } if (!$this->lockService->lockBackend($redirectUriFromLockFileContent)) { $io->error('Failed to create lock file "' . $lockFile . '".'); return Command::FAILURE; } $message = 'Wrote lock file to "' . $lockFile . '"'; if ($redirectUriFromLockFileContent !== '') { $message .= LF . 'with target URI "' . $redirectUriFromLockFileContent . '".'; } $io->success($message); return Command::SUCCESS; } }