‪TYPO3CMS  10.4
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 {
39  private ‪$referenceIndex;
43  protected ‪$output;
44 
48  public function ‪__construct()
49  {
50  $this->referenceIndex = GeneralUtility::makeInstance(ReferenceIndex::class);
51  }
52 
56  public function ‪getTitle(): string
57  {
58  return 'Reference Index Up-to-Date';
59  }
60 
66  public function ‪ensure(): bool
67  {
68  $this->output->writeln('Reference Index is being updated');
69  $progressListener = GeneralUtility::makeInstance(ReferenceIndexProgressListener::class);
70  $progressListener->initialize(new SymfonyStyle(new ArrayInput([]), $this->output));
71  $this->referenceIndex->enableRuntimeCache();
72  $result = $this->referenceIndex->updateIndex(false, $progressListener);
73  return count($result[3]) === 0;
74  }
75 
81  public function ‪isFulfilled(): bool
82  {
83  $this->referenceIndex->enableRuntimeCache();
84  $result = $this->referenceIndex->updateIndex(true);
85  return count($result[3]) === 0;
86  }
87 
91  public function ‪setOutput(OutputInterface ‪$output): void
92  {
93  $this->output = ‪$output;
94  }
95 }
‪TYPO3\CMS\Install\Updates\ReferenceIndexUpdatedPrerequisite\$referenceIndex
‪object TYPO3 CMS Core Database ReferenceIndex $referenceIndex
Definition: ReferenceIndexUpdatedPrerequisite.php:38
‪TYPO3\CMS\Backend\Command\ProgressListener\ReferenceIndexProgressListener
Definition: ReferenceIndexProgressListener.php:30
‪TYPO3\CMS\Install\Updates\ReferenceIndexUpdatedPrerequisite\__construct
‪__construct()
Definition: ReferenceIndexUpdatedPrerequisite.php:46
‪TYPO3\CMS\Install\Updates\ReferenceIndexUpdatedPrerequisite\ensure
‪bool ensure()
Definition: ReferenceIndexUpdatedPrerequisite.php:64
‪TYPO3\CMS\Core\Database\ReferenceIndex
Definition: ReferenceIndex.php:48
‪TYPO3\CMS\Install\Updates\ChattyInterface
Definition: ChattyInterface.php:26
‪TYPO3\CMS\Install\Updates
Definition: AbstractDownloadExtensionUpdate.php:16
‪TYPO3\CMS\Install\Updates\ReferenceIndexUpdatedPrerequisite\isFulfilled
‪bool isFulfilled()
Definition: ReferenceIndexUpdatedPrerequisite.php:79
‪TYPO3\CMS\Install\Updates\ReferenceIndexUpdatedPrerequisite\getTitle
‪getTitle()
Definition: ReferenceIndexUpdatedPrerequisite.php:54
‪TYPO3\CMS\Install\Updates\PrerequisiteInterface
Definition: PrerequisiteInterface.php:24
‪TYPO3\CMS\Install\Updates\ReferenceIndexUpdatedPrerequisite\$output
‪OutputInterface $output
Definition: ReferenceIndexUpdatedPrerequisite.php:41
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:46
‪TYPO3\CMS\Install\Updates\ReferenceIndexUpdatedPrerequisite
Definition: ReferenceIndexUpdatedPrerequisite.php:35
‪TYPO3\CMS\Install\Updates\ReferenceIndexUpdatedPrerequisite\setOutput
‪setOutput(OutputInterface $output)
Definition: ReferenceIndexUpdatedPrerequisite.php:89