[TASK] Use fully qualified name resolution in PHP 5.5
[Packages/TYPO3.CMS.git] / typo3 / sysext / install / Classes / Controller / Action / Tool / Configuration.php
1 <?php
2 namespace TYPO3\CMS\Install\Controller\Action\Tool;
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\Install\Controller\Action;
18
19 /**
20 * Show configuration features and handle presets
21 */
22 class Configuration extends Action\AbstractAction {
23
24 /**
25 * @var \TYPO3\CMS\Install\Configuration\FeatureManager
26 * @inject
27 */
28 protected $featureManager;
29
30 /**
31 * @var \TYPO3\CMS\Core\Configuration\ConfigurationManager
32 * @inject
33 */
34 protected $configurationManager = NULL;
35
36 /**
37 * Executes the tool
38 *
39 * @return string Rendered content
40 */
41 protected function executeAction() {
42 $actionMessages = array();
43 if (isset($this->postValues['set']['activate'])) {
44 $actionMessages[] = $this->activate();
45 $this->activate();
46 }
47 $this->view->assign('actionMessages', $actionMessages);
48
49 $postValues = is_array($this->postValues['values']) ? $this->postValues['values'] : array();
50 $this->view->assign('features', $this->featureManager->getInitializedFeatures($postValues));
51
52 return $this->view->render();
53 }
54
55 /**
56 * Configure selected feature presets to be active
57 *
58 * @return \TYPO3\CMS\Install\Status\StatusInterface
59 */
60 protected function activate() {
61 $configurationValues = $this->featureManager->getConfigurationForSelectedFeaturePresets($this->postValues['values']);
62
63 if (count($configurationValues) > 0) {
64 $this->configurationManager->setLocalConfigurationValuesByPathValuePairs($configurationValues);
65 /** @var $message \TYPO3\CMS\Install\Status\StatusInterface */
66 $message = $this->objectManager->get(\TYPO3\CMS\Install\Status\OkStatus::class);
67 $message->setTitle('Configuration written');
68 $messageBody = array();
69 foreach ($configurationValues as $configurationKey => $configurationValue) {
70 $messageBody[] = '\'' . $configurationKey . '\' => \'' . $configurationValue . '\'';
71 }
72 $message->setMessage(implode(LF, $messageBody));
73 } else {
74 /** @var $message \TYPO3\CMS\Install\Status\StatusInterface */
75 $message = $this->objectManager->get(\TYPO3\CMS\Install\Status\InfoStatus::class);
76 $message->setTitle('No configuration change selected');
77 }
78 return $message;
79 }
80 }