TYPO3 CMS  TYPO3_8-7
AccessRightParametersUpdate.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 
19 
24 {
28  protected $title = 'Move access right parameters configuration to "SYS" section';
29 
34  'BE/fileCreateMask' => 'SYS/fileCreateMask',
35  'BE/folderCreateMask' => 'SYS/folderCreateMask',
36  'BE/createGroup' => 'SYS/createGroup',
37  ];
38 
45  public function checkForUpdate(&$description)
46  {
47  $updateNeeded = false;
48 
50  $configurationManager = GeneralUtility::makeInstance(ConfigurationManager::class);
51 
52  // If the local configuration path can be accessed, the path is valid and the update wizard has to be executed
53  foreach ($this->movedAccessRightConfigurationSettings as $oldPath => $newPath) {
54  try {
55  $configurationManager->getLocalConfigurationValueByPath($oldPath);
56  $updateNeeded = true;
57  break;
58  } catch (\RuntimeException $e) {
59  }
60  }
61 
62  $description = 'Some access right parameters were moved from the "BE" to the "SYS" configuration section. ' .
63  'The update wizards moves the settings to the new configuration destination.';
64 
65  return $updateNeeded;
66  }
67 
75  public function performUpdate(array &$databaseQueries, &$customMessage)
76  {
78  $configurationManager = GeneralUtility::makeInstance(ConfigurationManager::class);
79  foreach ($this->movedAccessRightConfigurationSettings as $oldPath => $newPath) {
80  try {
81  $value = $configurationManager->getLocalConfigurationValueByPath($oldPath);
82  $configurationManager->setLocalConfigurationValueByPath($newPath, $value);
83  } catch (\RuntimeException $e) {
84  }
85  }
86  $configurationManager->removeLocalConfigurationKeysByPath(array_keys($this->movedAccessRightConfigurationSettings));
87 
88  $this->markWizardAsDone();
89  return true;
90  }
91 }
performUpdate(array &$dbQueries, &$customMessage)
static makeInstance($className,... $constructorArguments)