TYPO3 CMS  TYPO3_8-7
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 
20 
25 {
29  protected $title = 'Move "wizard done" flags from LocalConfiguration.php to system registry';
30 
37  public function checkForUpdate(&$description)
38  {
39  $result = false;
40  $description = 'Moves all "wizard done" flags from LocalConfiguration.php to system registry.';
41 
42  try {
43  $wizardsDone = GeneralUtility::makeInstance(ConfigurationManager::class)->getLocalConfigurationValueByPath('INSTALL/wizardDone');
44 
45  if (!empty($wizardsDone)) {
46  $result = true;
47  }
48  } catch (\RuntimeException $e) {
49  }
50 
51  return $result;
52  }
53 
61  public function performUpdate(array &$dbQueries, &$customMessage)
62  {
63  $configurationManager = GeneralUtility::makeInstance(ConfigurationManager::class);
64  $registry = GeneralUtility::makeInstance(Registry::class);
65  $wizardsDone = $configurationManager->getLocalConfigurationValueByPath('INSTALL/wizardDone');
66  $configurationKeysToRemove = [];
67 
68  foreach ($wizardsDone as $wizardClassName => $value) {
69  $registry->set('installUpdate', $wizardClassName, $value);
70  $configurationKeysToRemove[] = 'INSTALL/wizardDone/' . $wizardClassName;
71  }
72 
73  $configurationKeysToRemove[] = 'INSTALL/wizardDone';
74 
75  $configurationManager->removeLocalConfigurationKeysByPath($configurationKeysToRemove);
76 
77  $this->markWizardAsDone();
78  return true;
79  }
80 }
static makeInstance($className,... $constructorArguments)
performUpdate(array &$dbQueries, &$customMessage)