‪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\Command\Command;
19 use Symfony\Component\Console\Input\InputInterface;
20 use Symfony\Component\Console\Output\OutputInterface;
21 use Symfony\Component\Console\Style\SymfonyStyle;
23 
27 class ‪UnlockBackendCommand extends Command
28 {
32  protected function ‪execute(InputInterface $input, OutputInterface ‪$output): int
33  {
34  $io = new SymfonyStyle($input, ‪$output);
35  $io->title($this->getDescription());
36  $lockFile = $this->‪getLockFileName();
37  if (@is_file($lockFile)) {
38  unlink($lockFile);
39  if (@is_file($lockFile)) {
40  $io->caution('Could not remove lock file "' . $lockFile . '"!');
41  return Command::FAILURE;
42  }
43  $io->success('Removed lock file "' . $lockFile . '".');
44  } else {
45  $io->note('No lock file "' . $lockFile . '" was found.' . LF . 'Hence no lock can be removed.');
46  }
47  return Command::SUCCESS;
48  }
49 
55  protected function ‪getLockFileName()
56  {
57  return ‪Environment::getLegacyConfigPath() . '/LOCK_BACKEND';
58  }
59 }
‪TYPO3\CMS\Backend\Command\UnlockBackendCommand\execute
‪execute(InputInterface $input, OutputInterface $output)
Definition: UnlockBackendCommand.php:32
‪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:28
‪$output
‪$output
Definition: annotationChecker.php:119
‪TYPO3\CMS\Backend\Command\UnlockBackendCommand\getLockFileName
‪string getLockFileName()
Definition: UnlockBackendCommand.php:55
‪TYPO3\CMS\Core\Core\Environment
Definition: Environment.php:41