‪TYPO3CMS  ‪main
ReferenceIndexUpdatedPrerequisite.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
20 use Symfony\Component\Console\Input\ArrayInput;
21 use Symfony\Component\Console\Output\OutputInterface;
22 use Symfony\Component\Console\Style\SymfonyStyle;
26 
35 {
36  protected OutputInterface ‪$output;
37 
38  public function ‪__construct(
39  private readonly ‪ReferenceIndex $referenceIndex,
40  ) {}
41 
42  public function ‪getTitle(): string
43  {
44  return 'Reference Index Up-to-Date';
45  }
46 
50  public function ‪ensure(): bool
51  {
52  $this->output->writeln('Reference Index is being updated');
53  $progressListener = GeneralUtility::makeInstance(ReferenceIndexProgressListener::class);
54  $progressListener->initialize(new SymfonyStyle(new ArrayInput([]), $this->output));
55  $result = $this->referenceIndex->updateIndex(false, $progressListener);
56  return empty($result['errors']);
57  }
58 
62  public function ‪isFulfilled(): bool
63  {
64  $result = $this->referenceIndex->updateIndex(true);
65  return empty($result['errors']);
66  }
67 
68  public function ‪setOutput(OutputInterface ‪$output): void
69  {
70  $this->output = ‪$output;
71  }
72 }
‪TYPO3\CMS\Backend\Command\ProgressListener\ReferenceIndexProgressListener
Definition: ReferenceIndexProgressListener.php:30
‪TYPO3\CMS\Core\Database\ReferenceIndex
Definition: ReferenceIndex.php:40
‪TYPO3\CMS\Install\Updates\ChattyInterface
Definition: ChattyInterface.php:26
‪TYPO3\CMS\Install\Updates\ReferenceIndexUpdatedPrerequisite\isFulfilled
‪isFulfilled()
Definition: ReferenceIndexUpdatedPrerequisite.php:62
‪TYPO3\CMS\Install\Updates\ReferenceIndexUpdatedPrerequisite\ensure
‪ensure()
Definition: ReferenceIndexUpdatedPrerequisite.php:50
‪TYPO3\CMS\Install\Updates
Definition: LegacyClassesForIde.php:22
‪TYPO3\CMS\Install\Updates\ReferenceIndexUpdatedPrerequisite\getTitle
‪getTitle()
Definition: ReferenceIndexUpdatedPrerequisite.php:42
‪TYPO3\CMS\Install\Updates\ReferenceIndexUpdatedPrerequisite\__construct
‪__construct(private readonly ReferenceIndex $referenceIndex,)
Definition: ReferenceIndexUpdatedPrerequisite.php:38
‪TYPO3\CMS\Install\Updates\PrerequisiteInterface
Definition: PrerequisiteInterface.php:24
‪TYPO3\CMS\Install\Updates\ReferenceIndexUpdatedPrerequisite\$output
‪OutputInterface $output
Definition: ReferenceIndexUpdatedPrerequisite.php:36
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:52
‪TYPO3\CMS\Install\Updates\ReferenceIndexUpdatedPrerequisite
Definition: ReferenceIndexUpdatedPrerequisite.php:35
‪TYPO3\CMS\Install\Updates\ReferenceIndexUpdatedPrerequisite\setOutput
‪setOutput(OutputInterface $output)
Definition: ReferenceIndexUpdatedPrerequisite.php:68