‪TYPO3CMS  11.5
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;
22 
29 {
33  protected ‪$upgradeWizardsService;
37  protected ‪$output;
38 
39  public function ‪__construct()
40  {
41  $this->upgradeWizardsService = new ‪UpgradeWizardsService();
42  }
43 
47  public function ‪getTitle(): string
48  {
49  return 'Database Up-to-Date';
50  }
51 
52  public function ‪ensure(): bool
53  {
54  $adds = $this->upgradeWizardsService->getBlockingDatabaseAdds();
55  // Nothing to add, early return
56  if ($adds === []) {
57  return true;
58  }
59 
60  $this->output->writeln('Performing ' . count($adds) . ' database operations.');
61  // remove potentially empty error messages
62  $errorMessages = array_filter($this->upgradeWizardsService->addMissingTablesAndFields());
63 
64  return $errorMessages === [];
65  }
66 
70  public function ‪isFulfilled(): bool
71  {
72  $adds = $this->upgradeWizardsService->getBlockingDatabaseAdds();
73  return count($adds) === 0;
74  }
75 
79  public function ‪setOutput(OutputInterface ‪$output): void
80  {
81  $this->output = ‪$output;
82  }
83 }
‪TYPO3\CMS\Install\Updates\DatabaseUpdatedPrerequisite\$upgradeWizardsService
‪UpgradeWizardsService $upgradeWizardsService
Definition: DatabaseUpdatedPrerequisite.php:32
‪TYPO3\CMS\Install\Updates\DatabaseUpdatedPrerequisite\ensure
‪ensure()
Definition: DatabaseUpdatedPrerequisite.php:50
‪TYPO3\CMS\Install\Updates\ChattyInterface
Definition: ChattyInterface.php:26
‪TYPO3\CMS\Install\Updates\DatabaseUpdatedPrerequisite
Definition: DatabaseUpdatedPrerequisite.php:29
‪TYPO3\CMS\Install\Service\UpgradeWizardsService
Definition: UpgradeWizardsService.php:44
‪TYPO3\CMS\Install\Updates
Definition: AbstractDownloadExtensionUpdate.php:16
‪TYPO3\CMS\Install\Updates\DatabaseUpdatedPrerequisite\$output
‪OutputInterface $output
Definition: DatabaseUpdatedPrerequisite.php:35
‪TYPO3\CMS\Install\Updates\DatabaseUpdatedPrerequisite\isFulfilled
‪bool isFulfilled()
Definition: DatabaseUpdatedPrerequisite.php:68
‪TYPO3\CMS\Install\Updates\PrerequisiteInterface
Definition: PrerequisiteInterface.php:24
‪TYPO3\CMS\Install\Updates\DatabaseUpdatedPrerequisite\__construct
‪__construct()
Definition: DatabaseUpdatedPrerequisite.php:37
‪TYPO3\CMS\Install\Updates\DatabaseUpdatedPrerequisite\setOutput
‪setOutput(OutputInterface $output)
Definition: DatabaseUpdatedPrerequisite.php:77
‪TYPO3\CMS\Install\Updates\DatabaseUpdatedPrerequisite\getTitle
‪string getTitle()
Definition: DatabaseUpdatedPrerequisite.php:45