‪TYPO3CMS  ‪main
DatabaseUpdatedPrerequisite.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\Output\OutputInterface;
21 use TYPO3\CMS\Install\Service\DatabaseUpgradeWizardsService;
22 
29 {
30  protected OutputInterface ‪$output;
31 
32  public function ‪__construct(
33  private readonly DatabaseUpgradeWizardsService $databaseUpgradeWizardsService,
34  ) {}
35 
36  public function ‪getTitle(): string
37  {
38  return 'Database Up-to-Date';
39  }
40 
41  public function ‪ensure(): bool
42  {
43  $adds = $this->databaseUpgradeWizardsService->getBlockingDatabaseAdds();
44  // Nothing to add, early return
45  if ($adds === []) {
46  return true;
47  }
48 
49  $this->output->writeln('Performing ' . count($adds) . ' database operations.');
50  // remove potentially empty error messages
51  $errorMessages = array_filter($this->databaseUpgradeWizardsService->addMissingTablesAndFields());
52 
53  return $errorMessages === [];
54  }
55 
56  public function ‪isFulfilled(): bool
57  {
58  $adds = $this->databaseUpgradeWizardsService->getBlockingDatabaseAdds();
59  return count($adds) === 0;
60  }
61 
62  public function ‪setOutput(OutputInterface ‪$output): void
63  {
64  $this->output = ‪$output;
65  }
66 }
‪TYPO3\CMS\Install\Updates\DatabaseUpdatedPrerequisite\ensure
‪ensure()
Definition: DatabaseUpdatedPrerequisite.php:41
‪TYPO3\CMS\Install\Updates\ChattyInterface
Definition: ChattyInterface.php:26
‪TYPO3\CMS\Install\Updates\DatabaseUpdatedPrerequisite
Definition: DatabaseUpdatedPrerequisite.php:29
‪TYPO3\CMS\Install\Updates
Definition: LegacyClassesForIde.php:22
‪TYPO3\CMS\Install\Updates\DatabaseUpdatedPrerequisite\$output
‪OutputInterface $output
Definition: DatabaseUpdatedPrerequisite.php:30
‪TYPO3\CMS\Install\Updates\DatabaseUpdatedPrerequisite\__construct
‪__construct(private readonly DatabaseUpgradeWizardsService $databaseUpgradeWizardsService,)
Definition: DatabaseUpdatedPrerequisite.php:32
‪TYPO3\CMS\Install\Updates\DatabaseUpdatedPrerequisite\getTitle
‪getTitle()
Definition: DatabaseUpdatedPrerequisite.php:36
‪TYPO3\CMS\Install\Updates\PrerequisiteInterface
Definition: PrerequisiteInterface.php:24
‪TYPO3\CMS\Install\Updates\DatabaseUpdatedPrerequisite\setOutput
‪setOutput(OutputInterface $output)
Definition: DatabaseUpdatedPrerequisite.php:62
‪TYPO3\CMS\Install\Updates\DatabaseUpdatedPrerequisite\isFulfilled
‪isFulfilled()
Definition: DatabaseUpdatedPrerequisite.php:56