‪TYPO3CMS  ‪main
ReferenceIndexUpdateCommand.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\Input\InputOption;
22 use Symfony\Component\Console\Output\OutputInterface;
23 use Symfony\Component\Console\Style\SymfonyStyle;
28 
32 #[AsCommand('referenceindex:update', 'Update the reference index of TYPO3')]
33 class ‪ReferenceIndexUpdateCommand extends Command
34 {
38  public function ‪configure()
39  {
40  $this->addOption(
41  'check',
42  'c',
43  InputOption::VALUE_NONE,
44  'Only check the reference index of TYPO3'
45  );
46  }
47 
51  protected function ‪execute(InputInterface $input, OutputInterface ‪$output): int
52  {
54  $io = new SymfonyStyle($input, ‪$output);
55 
56  $isTestOnly = (bool)$input->getOption('check');
57 
58  $progressListener = GeneralUtility::makeInstance(ReferenceIndexProgressListener::class);
59  $progressListener->initialize($io);
60  $referenceIndex = GeneralUtility::makeInstance(ReferenceIndex::class);
61  if ($isTestOnly) {
62  $io->section('Reference Index being TESTED (nothing written, remove the "--check" argument)');
63  } else {
64  $io->section('Reference Index is now being updated');
65  }
66  $referenceIndex->updateIndex($isTestOnly, $progressListener);
67  return Command::SUCCESS;
68  }
69 }
‪TYPO3\CMS\Backend\Command\ProgressListener\ReferenceIndexProgressListener
Definition: ReferenceIndexProgressListener.php:30
‪TYPO3\CMS\Core\Database\ReferenceIndex
Definition: ReferenceIndex.php:40
‪TYPO3\CMS\Backend\Command
Definition: CreateBackendUserCommand.php:18
‪$output
‪$output
Definition: annotationChecker.php:114
‪TYPO3\CMS\Backend\Command\ReferenceIndexUpdateCommand\execute
‪execute(InputInterface $input, OutputInterface $output)
Definition: ReferenceIndexUpdateCommand.php:51
‪TYPO3\CMS\Core\Core\Bootstrap
Definition: Bootstrap.php:62
‪TYPO3\CMS\Backend\Command\ReferenceIndexUpdateCommand\configure
‪configure()
Definition: ReferenceIndexUpdateCommand.php:38
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:52
‪TYPO3\CMS\Backend\Command\ReferenceIndexUpdateCommand
Definition: ReferenceIndexUpdateCommand.php:34
‪TYPO3\CMS\Core\Core\Bootstrap\initializeBackendAuthentication
‪static initializeBackendAuthentication()
Definition: Bootstrap.php:527