first commit

This commit is contained in:
salam committed 2026-10-19 08:18:39 +02:00
commit 1218dd1517
12716 files changed
+989233

No files matched your search

@@ -0,0 +1,78 @@
<?php
namespace TYPO3\CMS\Backend\Command;
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use TYPO3\CMS\Core\Core\Environment;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* Core function for locking the TYPO3 Backend
*/
class LockBackendCommand extends Command
{
/**
* Configure the command by defining the name, options and arguments
*/
protected function configure()
{
$this
->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';
}
}
@@ -0,0 +1,62 @@
<?php
namespace TYPO3\CMS\Backend\Command;
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use TYPO3\CMS\Core\Core\Bootstrap;
use TYPO3\CMS\Core\Database\ReferenceIndex;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* Core function to check/update the Reference Index
*/
class ReferenceIndexUpdateCommand extends Command
{
/**
* Configure the command by defining the name, options and arguments
*/
public function configure()
{
$this->setDescription('Update the reference index of TYPO3')
->addOption(
'check',
'c',
InputOption::VALUE_NONE,
'Only check the reference index of TYPO3'
);
}
/**
* Executes the command for adding or removing the lock file
*
* @param InputInterface $input
* @param OutputInterface $output
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
Bootstrap::initializeBackendAuthentication();
$isTestOnly = $input->getOption('check');
$isSilent = $output->getVerbosity() !== OutputInterface::VERBOSITY_QUIET;
/** @var ReferenceIndex $referenceIndex */
$referenceIndex = GeneralUtility::makeInstance(ReferenceIndex::class);
$referenceIndex->enableRuntimeCache();
$referenceIndex->updateIndex($isTestOnly, $isSilent);
}
}
@@ -0,0 +1,67 @@
<?php
namespace TYPO3\CMS\Backend\Command;
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use TYPO3\CMS\Core\Core\Environment;
/**
* Core function for unlocking the TYPO3 Backend
*/
class UnlockBackendCommand extends Command
{
/**
* Configure the command by defining the name, options and arguments
*/
protected function configure()
{
$this->setDescription('Unlock the TYPO3 Backend');
}
/**
* Executes the command for removing 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)) {
unlink($lockFile);
if (@is_file($lockFile)) {
$io->caution('Could not remove lock file "' . $lockFile . '"!');
} else {
$io->success('Removed lock file "' . $lockFile . '".');
}
} else {
$io->note('No lock file "' . $lockFile . '" was found.' . LF . 'Hence no lock can be removed.');
}
}
/**
* Location of the file name
*
* @return string
*/
protected function getLockFileName()
{
return Environment::getLegacyConfigPath() . '/LOCK_BACKEND';
}
}