‪TYPO3CMS  9.5
WizardDoneToRegistry.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
17 use TYPO3\CMS\Core\Configuration\ConfigurationManager;
21 
27 {
31  public function ‪getIdentifier(): string
32  {
33  return 'wizardDoneToRegistry';
34  }
35 
39  public function ‪getTitle(): string
40  {
41  return 'Move "wizard done" flags from LocalConfiguration.php to system registry';
42  }
43 
47  public function ‪getDescription(): string
48  {
49  return 'Moves all "wizard done" flags from LocalConfiguration.php to system registry.';
50  }
51 
57  public function ‪updateNecessary(): bool
58  {
59  $result = false;
60  try {
61  $wizardsDone = GeneralUtility::makeInstance(ConfigurationManager::class)
62  ->getLocalConfigurationValueByPath('INSTALL/wizardDone');
63  if (!empty($wizardsDone)) {
64  $result = true;
65  }
66  } catch (‪MissingArrayPathException $e) {
67  // Result stays false with broken path
68  }
69  return $result;
70  }
71 
75  public function ‪getPrerequisites(): array
76  {
77  return [
78  DatabaseUpdatedPrerequisite::class
79  ];
80  }
81 
87  public function ‪executeUpdate(): bool
88  {
89  $configurationManager = GeneralUtility::makeInstance(ConfigurationManager::class);
90  $registry = GeneralUtility::makeInstance(Registry::class);
91  $wizardsDone = $configurationManager->getLocalConfigurationValueByPath('INSTALL/wizardDone');
92  $configurationKeysToRemove = [];
93  foreach ($wizardsDone as $wizardClassName => $value) {
94  $registry->set('installUpdate', $wizardClassName, $value);
95  $configurationKeysToRemove[] = 'INSTALL/wizardDone/' . $wizardClassName;
96  }
97  $configurationKeysToRemove[] = 'INSTALL/wizardDone';
98  $configurationManager->removeLocalConfigurationKeysByPath($configurationKeysToRemove);
99  return true;
100  }
101 }
‪TYPO3\CMS\Install\Updates\WizardDoneToRegistry\updateNecessary
‪bool updateNecessary()
Definition: WizardDoneToRegistry.php:57
‪TYPO3\CMS\Install\Updates\WizardDoneToRegistry\getIdentifier
‪string getIdentifier()
Definition: WizardDoneToRegistry.php:31
‪TYPO3\CMS\Core\Utility\Exception\MissingArrayPathException
Definition: MissingArrayPathException.php:26
‪TYPO3\CMS\Core\Registry
Definition: Registry.php:32
‪TYPO3\CMS\Install\Updates
Definition: AbstractDownloadExtensionUpdate.php:3
‪TYPO3\CMS\Install\Updates\WizardDoneToRegistry
Definition: WizardDoneToRegistry.php:27
‪TYPO3\CMS\Install\Updates\WizardDoneToRegistry\getDescription
‪string getDescription()
Definition: WizardDoneToRegistry.php:47
‪TYPO3\CMS\Install\Updates\WizardDoneToRegistry\executeUpdate
‪bool executeUpdate()
Definition: WizardDoneToRegistry.php:87
‪TYPO3\CMS\Install\Updates\WizardDoneToRegistry\getPrerequisites
‪string[] getPrerequisites()
Definition: WizardDoneToRegistry.php:75
‪TYPO3\CMS\Install\Updates\UpgradeWizardInterface
Definition: UpgradeWizardInterface.php:22
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:45
‪TYPO3\CMS\Install\Updates\WizardDoneToRegistry\getTitle
‪string getTitle()
Definition: WizardDoneToRegistry.php:39