‪TYPO3CMS  ‪main
UnlockBackendCommand.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
18 use Symfony\Component\Console\Attribute\AsCommand;
19 use Symfony\Component\Console\Command\Command;
20 use Symfony\Component\Console\Input\InputInterface;
21 use Symfony\Component\Console\Output\OutputInterface;
22 use Symfony\Component\Console\Style\SymfonyStyle;
24 
28 #[AsCommand('backend:unlock', 'Unlock the TYPO3 Backend')]
29 class ‪UnlockBackendCommand extends Command
30 {
34  protected function ‪execute(InputInterface $input, OutputInterface ‪$output): int
35  {
36  $io = new SymfonyStyle($input, ‪$output);
37  $io->title($this->getDescription());
38  $lockFile = $this->‪getLockFileName();
39  if (@is_file($lockFile)) {
40  unlink($lockFile);
41  if (@is_file($lockFile)) {
42  $io->caution('Could not remove lock file "' . $lockFile . '"!');
43  return Command::FAILURE;
44  }
45  $io->success('Removed lock file "' . $lockFile . '".');
46  } else {
47  $io->note('No lock file "' . $lockFile . '" was found.' . LF . 'Hence no lock can be removed.');
48  }
49  return Command::SUCCESS;
50  }
51 
57  protected function ‪getLockFileName()
58  {
59  return ‪Environment::getLegacyConfigPath() . '/LOCK_BACKEND';
60  }
61 }
‪TYPO3\CMS\Backend\Command\UnlockBackendCommand\execute
‪execute(InputInterface $input, OutputInterface $output)
Definition: UnlockBackendCommand.php:34
‪TYPO3\CMS\Core\Core\Environment\getLegacyConfigPath
‪static getLegacyConfigPath()
Definition: Environment.php:268
‪TYPO3\CMS\Backend\Command
Definition: CreateBackendUserCommand.php:18
‪TYPO3\CMS\Backend\Command\UnlockBackendCommand
Definition: UnlockBackendCommand.php:30
‪$output
‪$output
Definition: annotationChecker.php:114
‪TYPO3\CMS\Backend\Command\UnlockBackendCommand\getLockFileName
‪string getLockFileName()
Definition: UnlockBackendCommand.php:57
‪TYPO3\CMS\Core\Core\Environment
Definition: Environment.php:41