TYPO3 CMS  TYPO3_8-7
Configuration.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 
21 
26 {
30  protected $featureManager;
31 
36 
42  {
43  $this->featureManager = $featureManager ?: GeneralUtility::makeInstance(FeatureManager::class);
44  $this->configurationManager = $configurationManager ?: GeneralUtility::makeInstance(ConfigurationManager::class);
45  }
46 
52  protected function executeAction()
53  {
54  $actionMessages = [];
55  if (isset($this->postValues['set']['activate'])) {
56  $actionMessages[] = $this->activate();
57  $this->activate();
58  }
59  $this->view->assign('actionMessages', $actionMessages);
60 
61  $postValues = is_array($this->postValues['values']) ? $this->postValues['values'] : [];
62  $this->view->assign('features', $this->featureManager->getInitializedFeatures($postValues));
63 
64  return $this->view->render();
65  }
66 
72  protected function activate()
73  {
74  $configurationValues = $this->featureManager->getConfigurationForSelectedFeaturePresets($this->postValues['values']);
75 
76  if (!empty($configurationValues)) {
77  $this->configurationManager->setLocalConfigurationValuesByPathValuePairs($configurationValues);
79  $message = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\OkStatus::class);
80  $message->setTitle('Configuration written');
81  $messageBody = [];
82  foreach ($configurationValues as $configurationKey => $configurationValue) {
83  $messageBody[] = '\'' . $configurationKey . '\' => \'' . $configurationValue . '\'';
84  }
85  $message->setMessage(implode(LF, $messageBody));
86  } else {
88  $message = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\InfoStatus::class);
89  $message->setTitle('No configuration change selected');
90  }
91  return $message;
92  }
93 }
static makeInstance($className,... $constructorArguments)
__construct(FeatureManager $featureManager=null, ConfigurationManager $configurationManager=null)