From 92e5e6c5c6fcb49ba49209afb91bd2592b5ba93d Mon Sep 17 00:00:00 2001 From: Christian Kuhn <lolli@schwarzbu.ch> Date: Mon, 12 Aug 2013 17:57:03 +0200 Subject: [PATCH] [TASK] Install tool configuration system The patch implements a "configuration system" to the install tool that bundles several settings to enable them on click depending on system capabilities. A "feature" is represented by a set of configuration options that are filled by different presets. Presets have a priority, the best preset is the first one. Presets can be available or not available and active or not. For example the "image handling" feature has the presets "GraphicsMagick" and "ImageMagick 6" and a "Custom" preset if the others do not fit. This first patch implements "Charset conversion", "Image handling", "Development / Production" and "Extbase object cache" settings. During installation the available preset with highest priority are configured. Change-Id: I7304ef001717989720924e7ae03951eb3874adfd Resolves: #51454 Releases: 6.2 Reviewed-on: https://review.typo3.org/23321 Reviewed-by: Wouter Wolters Tested-by: Wouter Wolters Reviewed-by: Jigal van Hemert Tested-by: Jigal van Hemert Reviewed-by: Christian Kuhn Tested-by: Christian Kuhn --- .../Configuration/ConfigurationManager.php | 7 +- .../Configuration/DefaultConfiguration.php | 3 +- .../Configuration/AbstractCustomPreset.php | 104 +++++++++++ .../Classes/Configuration/AbstractFeature.php | 143 +++++++++++++++ .../Classes/Configuration/AbstractPreset.php | 143 +++++++++++++++ .../Configuration/Charset/CharsetFeature.php | 49 ++++++ .../Charset/CoreInternalPreset.php | 61 +++++++ .../Configuration/Charset/CustomPreset.php | 42 +++++ .../Configuration/Charset/IconvPreset.php | 65 +++++++ .../Configuration/Charset/MbstringPreset.php | 65 +++++++ .../Configuration/Context/ContextFeature.php | 48 +++++ .../Configuration/Context/CustomPreset.php | 47 +++++ .../Context/DevelopmentPreset.php | 81 +++++++++ .../Context/ProductionPreset.php | 81 +++++++++ .../Configuration/CustomPresetInterface.php | 51 ++++++ .../Classes/Configuration/Exception.php | 33 ++++ .../ExtbaseObjectCache/ApcPreset.php | 75 ++++++++ .../ExtbaseObjectCache/DatabasePreset.php | 60 +++++++ .../ExtbaseObjectCacheFeature.php | 47 +++++ .../Configuration/FeatureInterface.php | 54 ++++++ .../Classes/Configuration/FeatureManager.php | 136 +++++++++++++++ .../Image/AbstractImagePreset.php | 165 ++++++++++++++++++ .../Configuration/Image/CustomPreset.php | 52 ++++++ .../Image/GraphicsMagickPreset.php | 102 +++++++++++ .../Configuration/Image/ImageFeature.php | 62 +++++++ .../Image/ImageMagick6Preset.php | 109 ++++++++++++ .../Classes/Configuration/PresetInterface.php | 94 ++++++++++ .../Action/Step/DefaultConfiguration.php | 10 +- .../Controller/Action/Tool/Configuration.php | 93 ++++++++++ .../Classes/Controller/ToolController.php | 1 + .../Private/Partials/Action/Common/Left.html | 5 + .../Action/Tool/Configuration/Charset.html | 20 +++ .../Configuration/Charset/CoreInternal.html | 29 +++ .../Tool/Configuration/Charset/Custom.html | 43 +++++ .../Tool/Configuration/Charset/Iconv.html | 29 +++ .../Tool/Configuration/Charset/Mbstring.html | 28 +++ .../Action/Tool/Configuration/Context.html | 26 +++ .../Tool/Configuration/Context/Custom.html | 40 +++++ .../Configuration/Context/Development.html | 28 +++ .../Configuration/Context/Production.html | 28 +++ .../Configuration/ExtbaseObjectCache.html | 24 +++ .../Configuration/ExtbaseObjectCache/Apc.html | 38 ++++ .../ExtbaseObjectCache/Database.html | 28 +++ .../Action/Tool/Configuration/Image.html | 37 ++++ .../Tool/Configuration/Image/Custom.html | 40 +++++ .../Configuration/Image/GraphicsMagick.html | 37 ++++ .../Configuration/Image/ImageMagick6.html | 37 ++++ .../Templates/Action/Tool/Configuration.html | 28 +++ .../Public/Images/Menu/Configuration.png | Bin 0 -> 859 bytes .../Stylesheets/Action/Common/Install.css | 13 +- 50 files changed, 2634 insertions(+), 7 deletions(-) create mode 100644 typo3/sysext/install/Classes/Configuration/AbstractCustomPreset.php create mode 100644 typo3/sysext/install/Classes/Configuration/AbstractFeature.php create mode 100644 typo3/sysext/install/Classes/Configuration/AbstractPreset.php create mode 100644 typo3/sysext/install/Classes/Configuration/Charset/CharsetFeature.php create mode 100644 typo3/sysext/install/Classes/Configuration/Charset/CoreInternalPreset.php create mode 100644 typo3/sysext/install/Classes/Configuration/Charset/CustomPreset.php create mode 100644 typo3/sysext/install/Classes/Configuration/Charset/IconvPreset.php create mode 100644 typo3/sysext/install/Classes/Configuration/Charset/MbstringPreset.php create mode 100644 typo3/sysext/install/Classes/Configuration/Context/ContextFeature.php create mode 100644 typo3/sysext/install/Classes/Configuration/Context/CustomPreset.php create mode 100644 typo3/sysext/install/Classes/Configuration/Context/DevelopmentPreset.php create mode 100644 typo3/sysext/install/Classes/Configuration/Context/ProductionPreset.php create mode 100644 typo3/sysext/install/Classes/Configuration/CustomPresetInterface.php create mode 100644 typo3/sysext/install/Classes/Configuration/Exception.php create mode 100644 typo3/sysext/install/Classes/Configuration/ExtbaseObjectCache/ApcPreset.php create mode 100644 typo3/sysext/install/Classes/Configuration/ExtbaseObjectCache/DatabasePreset.php create mode 100644 typo3/sysext/install/Classes/Configuration/ExtbaseObjectCache/ExtbaseObjectCacheFeature.php create mode 100644 typo3/sysext/install/Classes/Configuration/FeatureInterface.php create mode 100644 typo3/sysext/install/Classes/Configuration/FeatureManager.php create mode 100644 typo3/sysext/install/Classes/Configuration/Image/AbstractImagePreset.php create mode 100644 typo3/sysext/install/Classes/Configuration/Image/CustomPreset.php create mode 100644 typo3/sysext/install/Classes/Configuration/Image/GraphicsMagickPreset.php create mode 100644 typo3/sysext/install/Classes/Configuration/Image/ImageFeature.php create mode 100644 typo3/sysext/install/Classes/Configuration/Image/ImageMagick6Preset.php create mode 100644 typo3/sysext/install/Classes/Configuration/PresetInterface.php create mode 100644 typo3/sysext/install/Classes/Controller/Action/Tool/Configuration.php create mode 100644 typo3/sysext/install/Resources/Private/Partials/Action/Tool/Configuration/Charset.html create mode 100644 typo3/sysext/install/Resources/Private/Partials/Action/Tool/Configuration/Charset/CoreInternal.html create mode 100644 typo3/sysext/install/Resources/Private/Partials/Action/Tool/Configuration/Charset/Custom.html create mode 100644 typo3/sysext/install/Resources/Private/Partials/Action/Tool/Configuration/Charset/Iconv.html create mode 100644 typo3/sysext/install/Resources/Private/Partials/Action/Tool/Configuration/Charset/Mbstring.html create mode 100644 typo3/sysext/install/Resources/Private/Partials/Action/Tool/Configuration/Context.html create mode 100644 typo3/sysext/install/Resources/Private/Partials/Action/Tool/Configuration/Context/Custom.html create mode 100644 typo3/sysext/install/Resources/Private/Partials/Action/Tool/Configuration/Context/Development.html create mode 100644 typo3/sysext/install/Resources/Private/Partials/Action/Tool/Configuration/Context/Production.html create mode 100644 typo3/sysext/install/Resources/Private/Partials/Action/Tool/Configuration/ExtbaseObjectCache.html create mode 100644 typo3/sysext/install/Resources/Private/Partials/Action/Tool/Configuration/ExtbaseObjectCache/Apc.html create mode 100644 typo3/sysext/install/Resources/Private/Partials/Action/Tool/Configuration/ExtbaseObjectCache/Database.html create mode 100644 typo3/sysext/install/Resources/Private/Partials/Action/Tool/Configuration/Image.html create mode 100644 typo3/sysext/install/Resources/Private/Partials/Action/Tool/Configuration/Image/Custom.html create mode 100644 typo3/sysext/install/Resources/Private/Partials/Action/Tool/Configuration/Image/GraphicsMagick.html create mode 100644 typo3/sysext/install/Resources/Private/Partials/Action/Tool/Configuration/Image/ImageMagick6.html create mode 100644 typo3/sysext/install/Resources/Private/Templates/Action/Tool/Configuration.html create mode 100644 typo3/sysext/install/Resources/Public/Images/Menu/Configuration.png diff --git a/typo3/sysext/core/Classes/Configuration/ConfigurationManager.php b/typo3/sysext/core/Classes/Configuration/ConfigurationManager.php index 7333f4d9d648..4f3cc11d6e7c 100644 --- a/typo3/sysext/core/Classes/Configuration/ConfigurationManager.php +++ b/typo3/sysext/core/Classes/Configuration/ConfigurationManager.php @@ -1,6 +1,5 @@ <?php namespace TYPO3\CMS\Core\Configuration; -use TYPO3\CMS\Core\Utility; /*************************************************************** * Copyright notice @@ -24,6 +23,9 @@ use TYPO3\CMS\Core\Utility; * * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ + +use TYPO3\CMS\Core\Utility; + /** * Handle loading and writing of global and local (instance specific) * configuration. @@ -78,7 +80,8 @@ class ConfigurationManager { 'EXT/extConf', 'EXTCONF', 'INSTALL/wizardDone', - 'DB' + 'DB', + 'SYS/caching/cacheConfigurations', ); /** diff --git a/typo3/sysext/core/Configuration/DefaultConfiguration.php b/typo3/sysext/core/Configuration/DefaultConfiguration.php index 601c93c4e356..2970f68fa281 100644 --- a/typo3/sysext/core/Configuration/DefaultConfiguration.php +++ b/typo3/sysext/core/Configuration/DefaultConfiguration.php @@ -21,6 +21,7 @@ * * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ + /** * This file contains the default array definition that is * later populated as $GLOBALS['TYPO3_CONF_VARS'] @@ -756,4 +757,4 @@ return array( ), 'SVCONF' => array() ); -?> \ No newline at end of file +?> diff --git a/typo3/sysext/install/Classes/Configuration/AbstractCustomPreset.php b/typo3/sysext/install/Classes/Configuration/AbstractCustomPreset.php new file mode 100644 index 000000000000..21629a4b72cc --- /dev/null +++ b/typo3/sysext/install/Classes/Configuration/AbstractCustomPreset.php @@ -0,0 +1,104 @@ +<?php +namespace TYPO3\CMS\Install\Configuration; + +/*************************************************************** + * Copyright notice + * + * (c) 2013 Christian Kuhn <lolli@schwarzbu.ch> + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ + +use TYPO3\CMS\Core\Utility\GeneralUtility; + +/** + * Abstract custom preset class implements common preset code + */ +abstract class AbstractCustomPreset extends AbstractPreset { + + /** + * @var string Name of preset, always set to "Custom" + */ + protected $name = 'Custom'; + + /** + * @var boolean TRUE if custom preset is active + */ + protected $isActive = FALSE; + + /** + * @var integer Priority of custom prefix is usually the lowest + */ + protected $priority = 10; + + /** + * Whether custom preset is active is set by feature + * + * @return boolean TRUE if custom preset is active + */ + public function isActive() { + return $this->isActive; + } + + /** + * Mark preset as active. + * The custom features do not know by itself if they are + * active or not since the configuration options may overlay + * with other presets. + * Marking the custom preset as active is therefor taken care + * off by the feature itself if no other preset is active. + * + * @return void + */ + public function setActive() { + $this->isActive = TRUE; + } + + /** + * Custom configuration is always available + * + * @return boolean TRUE + */ + public function isAvailable() { + return TRUE; + } + + /** + * Get configuration values is used in fluid to show configuration options. + * They are fetched from LocalConfiguration / DefaultConfiguration and + * merged with given $postValues. + * + * @return array Configuration values needed to activate prefix + */ + public function getConfigurationValues() { + $configurationValues = array(); + foreach ($this->configurationValues as $configurationKey => $configurationValue) { + if (isset($this->postValues['enable']) + && $this->postValues['enable'] === $this->name + && isset($this->postValues[$this->name][$configurationKey]) + ) { + $currentValue = $this->postValues[$this->name][$configurationKey]; + } else { + $currentValue = $this->configurationManager->getConfigurationValueByPath($configurationKey); + } + $configurationValues[$configurationKey] = $currentValue; + } + return $configurationValues; + } +} +?> \ No newline at end of file diff --git a/typo3/sysext/install/Classes/Configuration/AbstractFeature.php b/typo3/sysext/install/Classes/Configuration/AbstractFeature.php new file mode 100644 index 000000000000..5e2ae57060d5 --- /dev/null +++ b/typo3/sysext/install/Classes/Configuration/AbstractFeature.php @@ -0,0 +1,143 @@ +<?php +namespace TYPO3\CMS\Install\Configuration; + +/*************************************************************** + * Copyright notice + * + * (c) 2013 Christian Kuhn <lolli@schwarzbu.ch> + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ + +/** + * Abstract feature class implements common code + */ +abstract class AbstractFeature { + + /** + * @var \TYPO3\CMS\Extbase\Object\ObjectManager + * @inject + */ + protected $objectManager = NULL; + + /** + * @var string Name of feature + */ + protected $name = ''; + + /** + * @var array List of preset classes + */ + protected $presetRegistry = array(); + + /** + * @var array Holds instances of presets + */ + protected $presetInstances = array(); + + /** + * @var array List of $POST values + */ + protected $postValues = array(); + + /** + * Initialize presets of feature + * + * @param array $postValues List of $POST values of this feature + * @return void + * @throws Exception + */ + public function initializePresets(array $postValues) { + // Give feature sub array of $POST values to preset and set to own property + $featurePostValues = array(); + if (!empty($postValues[$this->name])) { + $featurePostValues = $postValues[$this->name]; + } + $this->postValues = $featurePostValues; + + $isNonCustomPresetActive = FALSE; + $customPresetFound = FALSE; + foreach ($this->presetRegistry as $presetClass) { + /** @var PresetInterface $presetInstance */ + $presetInstance = $this->objectManager->get($presetClass); + if (!($presetInstance instanceof PresetInterface)) { + throw new Exception( + 'Preset ' . $presetClass . ' does not implement PresetInterface', + 1378644821 + ); + } + + $presetInstance->setPostValues($featurePostValues); + + // Custom preset is set active if no preset before is active + if ($presetInstance->isActive()) { + $isNonCustomPresetActive = TRUE; + } + if ($presetInstance instanceof CustomPresetInterface + && !$isNonCustomPresetActive + ) { + // Throw Exception if two custom presets are registered + if ($customPresetFound === TRUE) { + throw new Exception( + 'Preset ' . $presetClass . ' implements CustomPresetInterface, but another' + . ' custom preset is already registered', + 1378645039 + ); + } + + /** @var CustomPresetInterface $presetInstance */ + $presetInstance->setActive(); + $customPresetFound = TRUE; + } + + $this->presetInstances[] = $presetInstance; + } + } + + /** + * Return presets ordered by priority + * + * @return array<PresetInterface> + * @throws Exception + */ + public function getPresetsOrderedByPriority() { + if (empty($this->presetInstances)) { + throw new Exception( + 'Presets not initialized', + 1378645155 + ); + } + $orderedPresets = array(); + foreach ($this->presetInstances as $presetInstance) { + /** @var PresetInterface $presetInstance */ + $orderedPresets[$presetInstance->getPriority()] = $presetInstance; + } + krsort($orderedPresets, SORT_NUMERIC); + return $orderedPresets; + } + + /** + * Return name of feature + * + * @return string Name of feature + */ + public function getName() { + return $this->name; + } +} +?> \ No newline at end of file diff --git a/typo3/sysext/install/Classes/Configuration/AbstractPreset.php b/typo3/sysext/install/Classes/Configuration/AbstractPreset.php new file mode 100644 index 000000000000..a275a34abb7d --- /dev/null +++ b/typo3/sysext/install/Classes/Configuration/AbstractPreset.php @@ -0,0 +1,143 @@ +<?php +namespace TYPO3\CMS\Install\Configuration; + +/*************************************************************** + * Copyright notice + * + * (c) 2013 Christian Kuhn <lolli@schwarzbu.ch> + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ + +use TYPO3\CMS\Core\Utility\GeneralUtility; + +/** + * Abstract preset class implements common preset code + */ +abstract class AbstractPreset { + + /** + * @var \TYPO3\CMS\Core\Configuration\ConfigurationManager + * @inject + */ + protected $configurationManager = NULL; + + /** + * @var string Name of preset, must be set by extending classes + */ + protected $name = ''; + + /** + * @var integer Default priority of preset + */ + protected $priority = 50; + + /** + * @var array Configuration values handled by this preset + */ + protected $configurationValues = array(); + + /** + * @var array List of $POST values + */ + protected $postValues = array(); + + /** + * Set POST values + * + * @param array $postValues Post values of feature + * @return mixed + */ + public function setPostValues(array $postValues) { + $this->postValues = $postValues; + } + + /** + * Check if preset is available on the system + * + * @return boolean TRUE if preset is available + */ + abstract public function isAvailable(); + + /** + * Wrapper for isAvailable, used in fluid + * + * @return boolean TRUE if preset is available + */ + public function getIsAvailable() { + return $this->isAvailable(); + } + + /** + * Check is preset is currently active on the system + * + * @return boolean TRUE if preset is active + */ + public function isActive() { + $isActive = TRUE; + foreach ($this->configurationValues as $configurationKey => $configurationValue) { + try { + $currentValue = $this->configurationManager->getConfigurationValueByPath($configurationKey); + } catch (\RuntimeException $e) { + $currentValue = NULL; + } + if ($currentValue !== $configurationValue) { + $isActive = FALSE; + break; + } + } + return $isActive; + } + + /** + * Wrapper for isActive, used in fluid + * + * @return boolean TRUE if preset is active + */ + public function getIsActive() { + return $this->isActive(); + } + + /** + * Get name of preset + * + * @return string Name + */ + public function getName() { + return $this->name; + } + + /** + * Get priority of preset + * + * @return integer Priority, usually between 0 and 100 + */ + public function getPriority() { + return $this->priority; + } + + /** + * Get configuration values to activate prefix + * + * @return array Configuration values needed to activate prefix + */ + public function getConfigurationValues() { + return $this->configurationValues; + } +} +?> \ No newline at end of file diff --git a/typo3/sysext/install/Classes/Configuration/Charset/CharsetFeature.php b/typo3/sysext/install/Classes/Configuration/Charset/CharsetFeature.php new file mode 100644 index 000000000000..78ee68025f78 --- /dev/null +++ b/typo3/sysext/install/Classes/Configuration/Charset/CharsetFeature.php @@ -0,0 +1,49 @@ +<?php +namespace TYPO3\CMS\Install\Configuration\Charset; + +/*************************************************************** + * Copyright notice + * + * (c) 2013 Christian Kuhn <lolli@schwarzbu.ch> + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ + +use TYPO3\CMS\Install\Configuration; + +/** + * Charset conversion feature + */ +class CharsetFeature extends Configuration\AbstractFeature implements Configuration\FeatureInterface { + + /** + * @var string Name of feature + */ + protected $name = 'Charset'; + + /** + * @var array List of preset classes + */ + protected $presetRegistry = array( + 'TYPO3\\CMS\\Install\\Configuration\\Charset\\MbstringPreset', + 'TYPO3\\CMS\\Install\\Configuration\\Charset\\IconvPreset', + 'TYPO3\\CMS\\Install\\Configuration\\Charset\\CoreInternalPreset', + 'TYPO3\\CMS\\Install\\Configuration\\Charset\\CustomPreset', + ); +} +?> \ No newline at end of file diff --git a/typo3/sysext/install/Classes/Configuration/Charset/CoreInternalPreset.php b/typo3/sysext/install/Classes/Configuration/Charset/CoreInternalPreset.php new file mode 100644 index 000000000000..e18db84f3c07 --- /dev/null +++ b/typo3/sysext/install/Classes/Configuration/Charset/CoreInternalPreset.php @@ -0,0 +1,61 @@ +<?php +namespace TYPO3\CMS\Install\Configuration\Charset; + +/*************************************************************** + * Copyright notice + * + * (c) 2013 Christian Kuhn <lolli@schwarzbu.ch> + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ + +use TYPO3\CMS\Install\Configuration; + +/** + * Internal core charset handling preset + */ +class CoreInternalPreset extends Configuration\AbstractPreset implements Configuration\PresetInterface { + + /** + * @var string Name of preset + */ + protected $name = 'CoreInternal'; + + /** + * @var integer Priority of preset + */ + protected $priority = 20; + + /** + * @var array Configuration values handled by this preset + */ + protected $configurationValues = array( + 'SYS/t3lib_cs_convMethod' => '', + 'SYS/t3lib_cs_utils' => '', + ); + + /** + * Internal core handling is always available + * + * @return boolean TRUE + */ + public function isAvailable() { + return TRUE; + } +} +?> \ No newline at end of file diff --git a/typo3/sysext/install/Classes/Configuration/Charset/CustomPreset.php b/typo3/sysext/install/Classes/Configuration/Charset/CustomPreset.php new file mode 100644 index 000000000000..03596073ed5c --- /dev/null +++ b/typo3/sysext/install/Classes/Configuration/Charset/CustomPreset.php @@ -0,0 +1,42 @@ +<?php +namespace TYPO3\CMS\Install\Configuration\Charset; + +/*************************************************************** + * Copyright notice + * + * (c) 2013 Christian Kuhn <lolli@schwarzbu.ch> + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ + +use TYPO3\CMS\Install\Configuration; + +/** + * Custom preset is a fallback if no other preset fits + */ +class CustomPreset extends Configuration\AbstractCustomPreset implements Configuration\CustomPresetInterface { + + /** + * @var array Configuration values handled by this preset + */ + protected $configurationValues = array( + 'SYS/t3lib_cs_convMethod' => '', + 'SYS/t3lib_cs_utils' => '', + ); +} +?> \ No newline at end of file diff --git a/typo3/sysext/install/Classes/Configuration/Charset/IconvPreset.php b/typo3/sysext/install/Classes/Configuration/Charset/IconvPreset.php new file mode 100644 index 000000000000..bc45a1a465c3 --- /dev/null +++ b/typo3/sysext/install/Classes/Configuration/Charset/IconvPreset.php @@ -0,0 +1,65 @@ +<?php +namespace TYPO3\CMS\Install\Configuration\Charset; + +/*************************************************************** + * Copyright notice + * + * (c) 2013 Christian Kuhn <lolli@schwarzbu.ch> + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ + +use TYPO3\CMS\Install\Configuration; + +/** + * Iconv charset preset + */ +class IconvPreset extends Configuration\AbstractPreset implements Configuration\PresetInterface { + + /** + * @var string Name of preset + */ + protected $name = 'Iconv'; + + /** + * @var integer Priority of preset + */ + protected $priority = 80; + + /** + * @var array Configuration values handled by this preset + */ + protected $configurationValues = array( + 'SYS/t3lib_cs_convMethod' => 'iconv', + 'SYS/t3lib_cs_utils' => 'iconv', + ); + + /** + * Check if iconv PHP module is loaded + * + * @return boolean TRUE if iconv PHP module is loaded + */ + public function isAvailable() { + $result = FALSE; + if (extension_loaded('iconv')) { + $result = TRUE; + } + return $result; + } +} +?> \ No newline at end of file diff --git a/typo3/sysext/install/Classes/Configuration/Charset/MbstringPreset.php b/typo3/sysext/install/Classes/Configuration/Charset/MbstringPreset.php new file mode 100644 index 000000000000..678ebf9fb393 --- /dev/null +++ b/typo3/sysext/install/Classes/Configuration/Charset/MbstringPreset.php @@ -0,0 +1,65 @@ +<?php +namespace TYPO3\CMS\Install\Configuration\Charset; + +/*************************************************************** + * Copyright notice + * + * (c) 2013 Christian Kuhn <lolli@schwarzbu.ch> + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ + +use TYPO3\CMS\Install\Configuration; + +/** + * Mbstring charset preset + */ +class MbstringPreset extends Configuration\AbstractPreset implements Configuration\PresetInterface { + + /** + * @var string Name of preset + */ + protected $name = 'Mbstring'; + + /** + * @var integer Priority of preset + */ + protected $priority = 90; + + /** + * @var array Configuration values handled by this preset + */ + protected $configurationValues = array( + 'SYS/t3lib_cs_convMethod' => 'mbstring', + 'SYS/t3lib_cs_utils' => 'mbstring', + ); + + /** + * Check if mbstring PHP module is loaded + * + * @return boolean TRUE if mbstring PHP module is loaded + */ + public function isAvailable() { + $result = FALSE; + if (extension_loaded('mbstring')) { + $result = TRUE; + } + return $result; + } +} +?> \ No newline at end of file diff --git a/typo3/sysext/install/Classes/Configuration/Context/ContextFeature.php b/typo3/sysext/install/Classes/Configuration/Context/ContextFeature.php new file mode 100644 index 000000000000..9745883d0141 --- /dev/null +++ b/typo3/sysext/install/Classes/Configuration/Context/ContextFeature.php @@ -0,0 +1,48 @@ +<?php +namespace TYPO3\CMS\Install\Configuration\Context; + +/*************************************************************** + * Copyright notice + * + * (c) 2013 Christian Kuhn <lolli@schwarzbu.ch> + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ + +use TYPO3\CMS\Install\Configuration; + +/** + * Context feature sets development / production settings + */ +class ContextFeature extends Configuration\AbstractFeature implements Configuration\FeatureInterface { + + /** + * @var string Name of feature + */ + protected $name = 'Context'; + + /** + * @var array List of preset classes + */ + protected $presetRegistry = array( + 'TYPO3\\CMS\\Install\\Configuration\\Context\\ProductionPreset', + 'TYPO3\\CMS\\Install\\Configuration\\Context\\DevelopmentPreset', + 'TYPO3\\CMS\\Install\\Configuration\\Context\\CustomPreset', + ); +} +?> \ No newline at end of file diff --git a/typo3/sysext/install/Classes/Configuration/Context/CustomPreset.php b/typo3/sysext/install/Classes/Configuration/Context/CustomPreset.php new file mode 100644 index 000000000000..a8fad1d0e466 --- /dev/null +++ b/typo3/sysext/install/Classes/Configuration/Context/CustomPreset.php @@ -0,0 +1,47 @@ +<?php +namespace TYPO3\CMS\Install\Configuration\Context; + +/*************************************************************** + * Copyright notice + * + * (c) 2013 Christian Kuhn <lolli@schwarzbu.ch> + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ + +use TYPO3\CMS\Install\Configuration; + +/** + * Custom preset is a fallback if no other preset fits + */ +class CustomPreset extends Configuration\AbstractCustomPreset implements Configuration\CustomPresetInterface { + + /** + * @var array Configuration values handled by this preset + */ + protected $configurationValues = array( + 'BE/debug' => '', + 'FE/debug' => '', + 'SYS/devIPmask' => '', + 'SYS/displayErrors' => '', + 'SYS/enableDeprecationLog' => '', + 'SYS/sqlDebug' => '', + 'SYS/systemLogLevel' => '', + ); +} +?> \ No newline at end of file diff --git a/typo3/sysext/install/Classes/Configuration/Context/DevelopmentPreset.php b/typo3/sysext/install/Classes/Configuration/Context/DevelopmentPreset.php new file mode 100644 index 000000000000..09e18356102e --- /dev/null +++ b/typo3/sysext/install/Classes/Configuration/Context/DevelopmentPreset.php @@ -0,0 +1,81 @@ +<?php +namespace TYPO3\CMS\Install\Configuration\Context; + +/*************************************************************** + * Copyright notice + * + * (c) 2013 Christian Kuhn <lolli@schwarzbu.ch> + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ + +use TYPO3\CMS\Install\Configuration; + +/** + * Development preset + */ +class DevelopmentPreset extends Configuration\AbstractPreset implements Configuration\PresetInterface { + + /** + * @var string Name of preset + */ + protected $name = 'Development'; + + /** + * @var integer Priority of preset + */ + protected $priority = 50; + + /** + * @var array Configuration values handled by this preset + */ + protected $configurationValues = array( + 'BE/debug' => TRUE, + 'FE/debug' => TRUE, + 'SYS/devIPmask' => '*', + 'SYS/displayErrors' => TRUE, + 'SYS/enableDeprecationLog' => 'file', + 'SYS/sqlDebug' => 1, + 'SYS/systemLogLevel' => 0, + ); + + /** + * Production preset is always available + * + * @return boolean TRUE if mbstring PHP module is loaded + */ + public function isAvailable() { + return TRUE; + } + + /** + * If context is set to production, priority + * of this preset is raised. + * + * @return integer Priority of preset + */ + public function getPriority() { + $context = \TYPO3\CMS\Core\Utility\GeneralUtility::getContext(); + $priority = $this->priority; + if ($context->isDevelopment()) { + $priority = $priority + 20; + } + return $priority; + } +} +?> \ No newline at end of file diff --git a/typo3/sysext/install/Classes/Configuration/Context/ProductionPreset.php b/typo3/sysext/install/Classes/Configuration/Context/ProductionPreset.php new file mode 100644 index 000000000000..8a4c66e0dabd --- /dev/null +++ b/typo3/sysext/install/Classes/Configuration/Context/ProductionPreset.php @@ -0,0 +1,81 @@ +<?php +namespace TYPO3\CMS\Install\Configuration\Context; + +/*************************************************************** + * Copyright notice + * + * (c) 2013 Christian Kuhn <lolli@schwarzbu.ch> + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ + +use TYPO3\CMS\Install\Configuration; + +/** + * Production preset + */ +class ProductionPreset extends Configuration\AbstractPreset implements Configuration\PresetInterface { + + /** + * @var string Name of preset + */ + protected $name = 'Production'; + + /** + * @var integer Priority of preset + */ + protected $priority = 50; + + /** + * @var array Configuration values handled by this preset + */ + protected $configurationValues = array( + 'BE/debug' => FALSE, + 'FE/debug' => FALSE, + 'SYS/devIPmask' => '', + 'SYS/displayErrors' => FALSE, + 'SYS/enableDeprecationLog' => FALSE, + 'SYS/sqlDebug' => 0, + 'SYS/systemLogLevel' => 2, + ); + + /** + * Production preset is always available + * + * @return boolean TRUE if mbstring PHP module is loaded + */ + public function isAvailable() { + return TRUE; + } + + /** + * If context is set to production, priority + * of this preset is raised. + * + * @return integer Priority of preset + */ + public function getPriority() { + $context = \TYPO3\CMS\Core\Utility\GeneralUtility::getContext(); + $priority = $this->priority; + if ($context->isProduction()) { + $priority = $priority + 20; + } + return $priority; + } +} +?> \ No newline at end of file diff --git a/typo3/sysext/install/Classes/Configuration/CustomPresetInterface.php b/typo3/sysext/install/Classes/Configuration/CustomPresetInterface.php new file mode 100644 index 000000000000..78b27b9f588b --- /dev/null +++ b/typo3/sysext/install/Classes/Configuration/CustomPresetInterface.php @@ -0,0 +1,51 @@ +<?php +namespace TYPO3\CMS\Install\Configuration; + +/*************************************************************** + * Copyright notice + * + * (c) 2013 Christian Kuhn <lolli@schwarzbu.ch> + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ + +use TYPO3\CMS\Core\Utility\GeneralUtility; + +/** + * Custom preset interface + * + * Interface for presets not catched by other presets. + * Represents "custom" configuration options of a feature. + * + * There must be only one custom preset per feature! + */ +interface CustomPresetInterface extends PresetInterface { + + /** + * Mark preset as active. + * The custom features do not know by itself if they are + * active or not since the configuration options may overlay + * with other presets. + * Marking the custom preset as active is therefor taken care + * off by the feature itself if no other preset is active. + * + * @return void + */ + public function setActive(); +} +?> \ No newline at end of file diff --git a/typo3/sysext/install/Classes/Configuration/Exception.php b/typo3/sysext/install/Classes/Configuration/Exception.php new file mode 100644 index 000000000000..4328305a0eb3 --- /dev/null +++ b/typo3/sysext/install/Classes/Configuration/Exception.php @@ -0,0 +1,33 @@ +<?php +namespace TYPO3\CMS\Install\Configuration; + +/*************************************************************** + * Copyright notice + * + * (c) 2013 Christian Kuhn <lolli@schwarzbu.ch> + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ + +/** + * A configuration exception + */ +class Exception extends \TYPO3\CMS\Install\Exception { + +} +?> \ No newline at end of file diff --git a/typo3/sysext/install/Classes/Configuration/ExtbaseObjectCache/ApcPreset.php b/typo3/sysext/install/Classes/Configuration/ExtbaseObjectCache/ApcPreset.php new file mode 100644 index 000000000000..0b462ebe7bf6 --- /dev/null +++ b/typo3/sysext/install/Classes/Configuration/ExtbaseObjectCache/ApcPreset.php @@ -0,0 +1,75 @@ +<?php +namespace TYPO3\CMS\Install\Configuration\ExtbaseObjectCache; + +/*************************************************************** + * Copyright notice + * + * (c) 2013 Christian Kuhn <lolli@schwarzbu.ch> + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ + +use TYPO3\CMS\Install\Configuration; + +/** + * APC preset + */ +class ApcPreset extends Configuration\AbstractPreset implements Configuration\PresetInterface { + + /** + * @var string Name of preset + */ + protected $name = 'Apc'; + + /** + * @var integer Priority of preset + */ + protected $priority = 80; + + /** + * @var array Configuration values handled by this preset + */ + protected $configurationValues = array( + 'SYS/caching/cacheConfigurations/extbase_object' => array( + 'backend' => 'TYPO3\CMS\Core\Cache\Backend\ApcBackend', + ), + ); + + /** + * APC preset is available if extension is loaded, if APC has ~100MB + * memory and if ~5MB are free. + * + * @return boolean TRUE + */ + public function isAvailable() { + $result = FALSE; + if (extension_loaded('apc')) { + $memoryInfo = apc_sma_info(); + $totalMemory = $memoryInfo['num_seg'] * $memoryInfo['seg_size']; + $availableMemory = $memoryInfo['avail_mem']; + + // If more than 99MB in total and more than 5MB free + if ($totalMemory > (99 * 1024 * 1024) + && $availableMemory > (5 * 1024 * 1024)) { + $result = TRUE; + } + } + return $result; + } +} +?> \ No newline at end of file diff --git a/typo3/sysext/install/Classes/Configuration/ExtbaseObjectCache/DatabasePreset.php b/typo3/sysext/install/Classes/Configuration/ExtbaseObjectCache/DatabasePreset.php new file mode 100644 index 000000000000..07583a2529ca --- /dev/null +++ b/typo3/sysext/install/Classes/Configuration/ExtbaseObjectCache/DatabasePreset.php @@ -0,0 +1,60 @@ +<?php +namespace TYPO3\CMS\Install\Configuration\ExtbaseObjectCache; + +/*************************************************************** + * Copyright notice + * + * (c) 2013 Christian Kuhn <lolli@schwarzbu.ch> + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ + +use TYPO3\CMS\Install\Configuration; + +/** + * Database preset + */ +class DatabasePreset extends Configuration\AbstractPreset implements Configuration\PresetInterface { + + /** + * @var string Name of preset + */ + protected $name = 'Database'; + + /** + * @var integer Priority of preset + */ + protected $priority = 50; + + /** + * @var array Configuration values handled by this preset + */ + protected $configurationValues = array( + 'SYS/caching/cacheConfigurations/extbase_object' => array(), + ); + + /** + * Database preset is always available + * + * @return boolean TRUE + */ + public function isAvailable() { + return TRUE; + } +} +?> \ No newline at end of file diff --git a/typo3/sysext/install/Classes/Configuration/ExtbaseObjectCache/ExtbaseObjectCacheFeature.php b/typo3/sysext/install/Classes/Configuration/ExtbaseObjectCache/ExtbaseObjectCacheFeature.php new file mode 100644 index 000000000000..f1515a486564 --- /dev/null +++ b/typo3/sysext/install/Classes/Configuration/ExtbaseObjectCache/ExtbaseObjectCacheFeature.php @@ -0,0 +1,47 @@ +<?php +namespace TYPO3\CMS\Install\Configuration\ExtbaseObjectCache; + +/*************************************************************** + * Copyright notice + * + * (c) 2013 Christian Kuhn <lolli@schwarzbu.ch> + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ + +use TYPO3\CMS\Install\Configuration; + +/** + * Extbase object cache configuration + */ +class ExtbaseObjectCacheFeature extends Configuration\AbstractFeature implements Configuration\FeatureInterface { + + /** + * @var string Name of feature + */ + protected $name = 'ExtbaseObjectCache'; + + /** + * @var array List of preset classes + */ + protected $presetRegistry = array( + 'TYPO3\\CMS\\Install\\Configuration\\ExtbaseObjectCache\\DatabasePreset', + 'TYPO3\\CMS\\Install\\Configuration\\ExtbaseObjectCache\\ApcPreset', + ); +} +?> \ No newline at end of file diff --git a/typo3/sysext/install/Classes/Configuration/FeatureInterface.php b/typo3/sysext/install/Classes/Configuration/FeatureInterface.php new file mode 100644 index 000000000000..aff6dc50cb57 --- /dev/null +++ b/typo3/sysext/install/Classes/Configuration/FeatureInterface.php @@ -0,0 +1,54 @@ +<?php +namespace TYPO3\CMS\Install\Configuration; + +/*************************************************************** + * Copyright notice + * + * (c) 2013 Christian Kuhn <lolli@schwarzbu.ch> + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ + +/** + * A feature representation handles preset classes. + */ +interface FeatureInterface { + + /** + * Initialize presets + * + * @param array $postValues List of $POST values of this feature + * @return void + */ + public function initializePresets(array $postValues); + + /** + * Get list of presets ordered by priority + * + * @return array<PresetInterface> + */ + public function getPresetsOrderedByPriority(); + + /** + * Get name of feature + * + * @return string Name + */ + public function getName(); +} +?> \ No newline at end of file diff --git a/typo3/sysext/install/Classes/Configuration/FeatureManager.php b/typo3/sysext/install/Classes/Configuration/FeatureManager.php new file mode 100644 index 000000000000..442d65593f54 --- /dev/null +++ b/typo3/sysext/install/Classes/Configuration/FeatureManager.php @@ -0,0 +1,136 @@ +<?php +namespace TYPO3\CMS\Install\Configuration; + +/*************************************************************** + * Copyright notice + * + * (c) 2013 Christian Kuhn <lolli@schwarzbu.ch> + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ + +/** + * Instantiate and configure all known features and presets + */ +class FeatureManager { + + /** + * @var \TYPO3\CMS\Extbase\Object\ObjectManager + * @inject + */ + protected $objectManager = NULL; + + /** + * @var array List of feature class names + */ + protected $featureRegistry = array( + 'TYPO3\\CMS\\Install\\Configuration\\Charset\\CharsetFeature', + 'TYPO3\\CMS\\Install\\Configuration\\Context\\ContextFeature', + 'TYPO3\\CMS\\Install\\Configuration\\Image\\ImageFeature', + 'TYPO3\\CMS\\Install\\Configuration\\ExtbaseObjectCache\\ExtbaseObjectCacheFeature', + ); + + /** + * Get initialized list of features with possible presets + * + * @param array $postValues List of $POST values + * @return array<FeatureInterface> + * @throws Exception + */ + public function getInitializedFeatures(array $postValues) { + $features = array(); + foreach ($this->featureRegistry as $featureClass) { + /** @var FeatureInterface $featureInstance */ + $featureInstance = $this->objectManager->get($featureClass); + if (!($featureInstance instanceof FeatureInterface)) { + throw new Exception( + 'Feature ' . $featureClass . ' doen not implement FeatureInterface', + 1378644593 + ); + } + $featureInstance->initializePresets($postValues); + $features[] = $featureInstance; + } + return $features; + } + + /** + * Get configuration values to be set to LocalConfiguration from + * list of selected $POST feature presets + * + * @param array $postValues List of $POST values + * @return array List of configuration values + */ + public function getConfigurationForSelectedFeaturePresets(array $postValues) { + $localConfigurationValuesToSet = array(); + $features = $this->getInitializedFeatures($postValues); + foreach ($features as $feature) { + /** @var FeatureInterface $feature */ + $featureName = $feature->getName(); + $presets = $feature->getPresetsOrderedByPriority(); + foreach ($presets as $preset) { + /** @var PresetInterface $preset */ + $presetName = $preset->getName(); + if (!empty($postValues[$featureName]['enable']) + && $postValues[$featureName]['enable'] === $presetName + && (!$preset->isActive() || $preset instanceof CustomPresetInterface) + ) { + $localConfigurationValuesToSet = array_merge( + $localConfigurationValuesToSet, + $preset->getConfigurationValues() + ); + } + } + } + return $localConfigurationValuesToSet; + } + + /** + * Cycle through features and get settings. First matching + * preset (highest priority) will be selected. + * + * @return array Configuration settings + */ + public function getBestMatchingConfigurationForAllFeatures() { + $localConfigurationValuesToSet = array(); + $features = $this->getInitializedFeatures(array()); + foreach ($features as $feature) { + /** @var FeatureInterface $feature */ + $featureName = $feature->getName(); + $presets = $feature->getPresetsOrderedByPriority(); + foreach ($presets as $preset) { + // Only chose "normal" presets, no custom presets + if ($preset instanceof CustomPresetInterface) { + break; + } + + /** @var PresetInterface $preset */ + if ($preset->isAvailable()) { + $localConfigurationValuesToSet = array_merge( + $localConfigurationValuesToSet, + $preset->getConfigurationValues() + ); + // Setting for this feature done, go to next feature + break; + } + } + } + return $localConfigurationValuesToSet; + } +} +?> \ No newline at end of file diff --git a/typo3/sysext/install/Classes/Configuration/Image/AbstractImagePreset.php b/typo3/sysext/install/Classes/Configuration/Image/AbstractImagePreset.php new file mode 100644 index 000000000000..766ab5beb3cf --- /dev/null +++ b/typo3/sysext/install/Classes/Configuration/Image/AbstractImagePreset.php @@ -0,0 +1,165 @@ +<?php +namespace TYPO3\CMS\Install\Configuration\Image; + +/*************************************************************** + * Copyright notice + * + * (c) 2013 Christian Kuhn <lolli@schwarzbu.ch> + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ + +use TYPO3\CMS\Install\Configuration; + +/** + * Abstract class implements common image preset code + */ +abstract class AbstractImagePreset extends Configuration\AbstractPreset { + + /** + * @var array Default paths to search for executable, with trailing slash + */ + protected $defaultExecutableSearchPaths = array( + '/usr/local/bin/', + '/opt/local/bin/', + '/usr/bin/', + '/usr/X11R6/bin/', + '/opt/bin/', + 'C:/php/ImageMagick/', + 'C:/php/GraphicsMagick/', + 'C:/apache/ImageMagick/', + 'C:/apache/GraphicsMagick/', + ); + + /** + * @var string Absolute path with found executable + */ + protected $foundPath = ''; + + /** + * Path where executable was found + * + * @return string Fonud path + */ + public function getFoundPath() { + return $this->foundPath; + } + + /** + * Check is preset is currently active on the system. + * Overwrites parent method to ignore im_path and im_path_lzw settings + * + * @return boolean TRUE if preset is active + */ + public function isActive() { + $isActive = TRUE; + foreach ($this->configurationValues as $configurationKey => $configurationValue) { + if ($configurationKey !== 'GFX/im_path' + && $configurationKey !== 'GFX/im_path_lzw' + ) { + $currentValue = $this->configurationManager->getConfigurationValueByPath($configurationKey); + if ($currentValue !== $configurationValue) { + $isActive = FALSE; + break; + } + } + } + return $isActive; + } + + /** + * Find out if GraphicsMagick is available + * + * @return boolean TRUE if GraphicsMagick executable is found in path + */ + public function isAvailable() { + $searchPaths = $this->getSearchPaths(); + return $this->findExecutableInPath($searchPaths); + } + + /** + * Get configuration values to activate prefix + * + * @return array Configuration values needed to activate prefix + */ + public function getConfigurationValues() { + $this->findExecutableInPath($this->getSearchPaths()); + $configurationValues = $this->configurationValues; + $configurationValues['GFX/im_path'] = $this->getFoundPath(); + $configurationValues['GFX/im_path_lzw'] = $this->getFoundPath(); + return $configurationValues; + } + + /** + * Find executable in path, wrapper for specific ImageMagick/GraphicsMagick find methods. + * + * @param array $searchPaths + * @return mixed + */ + abstract protected function findExecutableInPath(array $searchPaths); + + /** + * Get list of paths to search for image handling executables + * + * @return array List of pathes to search for + */ + protected function getSearchPaths() { + $searchPaths = $this->defaultExecutableSearchPaths; + + // Add configured im_path on top + $imPath = $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_path']; + if (strlen($imPath) && !in_array($imPath, $searchPaths)) { + $path = $this->cleanUpPath($imPath); + array_unshift($searchPaths, $path); + } + + // Add configured im_path_lzw on top + $imLzwSearchPath = $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_path_lzw']; + if (strlen($imLzwSearchPath) && !in_array($imLzwSearchPath, $searchPaths)) { + $path = $this->cleanUpPath($imLzwSearchPath); + array_unshift($searchPaths, $path); + } + + // Add additional search path from form if given + if (isset($this->postValues['additionalSearchPath']) + && strlen($this->postValues['additionalSearchPath']) + && !in_array($this->postValues['additionalSearchPath'], $searchPaths) + ) { + $path = $this->cleanUpPath($this->postValues['additionalSearchPath']); + array_unshift($searchPaths, $path); + } + + return $searchPaths; + } + + /** + * Consolidate between Windows and Unix and add trailing slash im missing + * + * @param string $path Given path + * @return string Cleaned up path + */ + protected function cleanUpPath($path) { + $path = \TYPO3\CMS\Core\Utility\GeneralUtility::fixWindowsFilePath($path); + // Add trailing slash if missing + if (!preg_match('/[\\/]$/', $path)) { + $path .= '/'; + } + return $path; + } +} +?> \ No newline at end of file diff --git a/typo3/sysext/install/Classes/Configuration/Image/CustomPreset.php b/typo3/sysext/install/Classes/Configuration/Image/CustomPreset.php new file mode 100644 index 000000000000..190070f1a247 --- /dev/null +++ b/typo3/sysext/install/Classes/Configuration/Image/CustomPreset.php @@ -0,0 +1,52 @@ +<?php +namespace TYPO3\CMS\Install\Configuration\Image; + +/*************************************************************** + * Copyright notice + * + * (c) 2013 Christian Kuhn <lolli@schwarzbu.ch> + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ + +use TYPO3\CMS\Install\Configuration; + +/** + * Custom preset is a fallback if no other preset fits + */ +class CustomPreset extends Configuration\AbstractCustomPreset implements Configuration\CustomPresetInterface { + + /** + * @var array Configuration values handled by this preset + */ + protected $configurationValues = array( + 'GFX/image_processing' => 0, + 'GFX/im' => 0, + 'GFX/im_path' => '', + 'GFX/im_path_lzw' => '', + 'GFX/im_version_5' => '', + 'GFX/im_negate_mask' => 0, + 'GFX/im_imvMaskState' => 0, + 'GFX/im_no_effects' => 0, + 'GFX/im_v5effects' => 0, + 'GFX/im_mask_temp_ext_gif' => 0, + 'GFX/im_combine_filename' => 'combine', + 'GFX/colorspace' => '', + ); +} +?> \ No newline at end of file diff --git a/typo3/sysext/install/Classes/Configuration/Image/GraphicsMagickPreset.php b/typo3/sysext/install/Classes/Configuration/Image/GraphicsMagickPreset.php new file mode 100644 index 000000000000..a9239b684f21 --- /dev/null +++ b/typo3/sysext/install/Classes/Configuration/Image/GraphicsMagickPreset.php @@ -0,0 +1,102 @@ +<?php +namespace TYPO3\CMS\Install\Configuration\Image; + +/*************************************************************** + * Copyright notice + * + * (c) 2013 Christian Kuhn <lolli@schwarzbu.ch> + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ + +use TYPO3\CMS\Install\Configuration; + +/** + * Preset for GraphicsMagick + */ +class GraphicsMagickPreset extends AbstractImagePreset implements Configuration\PresetInterface { + + /** + * @var string Name of preset + */ + protected $name = 'GraphicsMagick'; + + /** + * @var integer Priority of preset + */ + protected $priority = 80; + + /** + * @var array Configuration values handled by this preset + */ + protected $configurationValues = array( + 'GFX/image_processing' => 1, + 'GFX/im' => 1, + // im_path and im_path_lzw are determined and set by path lookup methods + 'GFX/im_path' => '', + 'GFX/im_path_lzw' => '', + 'GFX/im_version_5' => 'gm', + 'GFX/im_negate_mask' => 0, + 'GFX/im_imvMaskState' => 0, + 'GFX/im_no_effects' => 1, + 'GFX/im_v5effects' => -1, + 'GFX/im_mask_temp_ext_gif' => 1, + 'GFX/colorspace' => 'RGB', + ); + + /** + * Find executable in path, wrapper for specific ImageMagick/GraphicsMagick find methods. + * + * @param array $searchPaths + * @return mixed + */ + protected function findExecutableInPath(array $searchPaths) { + return $this->findGraphicsMagickInPaths($searchPaths); + } + + /** + * Search for GraphicsMagick executables in given paths. + * + * @param array $searchPaths List of pathes to search for + * @return boolean TRUE if graphics magick was found in path + */ + protected function findGraphicsMagickInPaths(array $searchPaths) { + $result = FALSE; + foreach ($searchPaths as $path) { + if (TYPO3_OS === 'WIN') { + $executable = 'gm.exe'; + } else { + $executable = 'gm'; + } + if (@is_dir($path) && @is_file($path . $executable)) { + $command = escapeshellarg($path . $executable) . ' -version'; + $executingResult = FALSE; + \TYPO3\CMS\Core\Utility\CommandUtility::exec($command, $executingResult); + // First line of exec command should contain string GraphicsMagick + $firstResultLine = array_shift($executingResult); + if (strpos($firstResultLine, 'GraphicsMagick') !== FALSE) { + $this->foundPath = $path; + $result = TRUE; + break; + } + } + } + return $result; + } +} +?> \ No newline at end of file diff --git a/typo3/sysext/install/Classes/Configuration/Image/ImageFeature.php b/typo3/sysext/install/Classes/Configuration/Image/ImageFeature.php new file mode 100644 index 000000000000..0890b612f02f --- /dev/null +++ b/typo3/sysext/install/Classes/Configuration/Image/ImageFeature.php @@ -0,0 +1,62 @@ +<?php +namespace TYPO3\CMS\Install\Configuration\Image; + +/*************************************************************** + * Copyright notice + * + * (c) 2013 Christian Kuhn <lolli@schwarzbu.ch> + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ + +use TYPO3\CMS\Install\Configuration; + +/** + * Image feature detects imagemagick / graphicsmagick versions + */ +class ImageFeature extends Configuration\AbstractFeature implements Configuration\FeatureInterface { + + /** + * @var string Name of feature + */ + protected $name = 'Image'; + + /** + * @var array List of preset classes + */ + protected $presetRegistry = array( + 'TYPO3\\CMS\\Install\\Configuration\\Image\\GraphicsMagickPreset', + 'TYPO3\\CMS\\Install\\Configuration\\Image\\ImageMagick6Preset', + 'TYPO3\\CMS\\Install\\Configuration\\Image\\CustomPreset', + ); + + /** + * Image feature can be feeded with an additional path to search for executables, + * this getter returns the given input string (for Fluid) + * + * @return string + */ + public function getAdditionalSearchPath() { + $additionalPath = ''; + if (isset($this->postValues['additionalSearchPath']) && strlen($this->postValues['additionalSearchPath'])) { + $additionalPath = $this->postValues['additionalSearchPath']; + } + return $additionalPath; + } +} +?> \ No newline at end of file diff --git a/typo3/sysext/install/Classes/Configuration/Image/ImageMagick6Preset.php b/typo3/sysext/install/Classes/Configuration/Image/ImageMagick6Preset.php new file mode 100644 index 000000000000..d292f931b693 --- /dev/null +++ b/typo3/sysext/install/Classes/Configuration/Image/ImageMagick6Preset.php @@ -0,0 +1,109 @@ +<?php +namespace TYPO3\CMS\Install\Configuration\Image; + +/*************************************************************** + * Copyright notice + * + * (c) 2013 Christian Kuhn <lolli@schwarzbu.ch> + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ + +use TYPO3\CMS\Install\Configuration; + +/** + * Preset for ImageMagick version 6 or higher + */ +class ImageMagick6Preset extends AbstractImagePreset implements Configuration\PresetInterface { + + /** + * @var string Name of preset + */ + protected $name = 'ImageMagick6'; + + /** + * @var integer Priority of preset + */ + protected $priority = 70; + + /** + * @var array Configuration values handled by this preset + */ + protected $configurationValues = array( + 'GFX/image_processing' => 1, + 'GFX/im' => 1, + // im_path and im_path_lzw are determined and set by path lookup methods + 'GFX/im_path' => '', + 'GFX/im_path_lzw' => '', + 'GFX/im_version_5' => 'im6', + 'GFX/im_negate_mask' => 0, + 'GFX/im_imvMaskState' => 1, + 'GFX/im_no_effects' => 1, + 'GFX/im_v5effects' => 1, + 'GFX/im_mask_temp_ext_gif' => 1, + 'GFX/im_combine_filename' => 'composite', + 'GFX/colorspace' => 'RGB', + ); + + /** + * Find executable in path, wrapper for specific ImageMagick/GraphicsMagick find methods. + * + * @param array $searchPaths + * @return mixed + */ + protected function findExecutableInPath(array $searchPaths) { + return $this->findImageMagick6InPaths($searchPaths); + } + + /** + * Search for GraphicsMagick executables in given paths. + * + * @param array $searchPaths List of paths to search for + * @return boolean TRUE if graphics magick was found in path + */ + protected function findImageMagick6InPaths(array $searchPaths) { + $result = FALSE; + foreach ($searchPaths as $path) { + if (TYPO3_OS === 'WIN') { + $executable = 'identify.exe'; + } else { + $executable = 'identify'; + } + if (@is_dir($path) && @is_file($path . $executable)) { + $command = escapeshellarg($path . $executable) . ' -version'; + $executingResult = FALSE; + \TYPO3\CMS\Core\Utility\CommandUtility::exec($command, $executingResult); + // First line of exec command should contain string GraphicsMagick + $firstResultLine = array_shift($executingResult); + // Example: "Version: ImageMagick 6.6.0-4 2012-05-02 Q16 http://www.imagemagick.org" + if (strpos($firstResultLine, 'ImageMagick') !== FALSE) { + list(,$version) = explode('ImageMagick', $firstResultLine); + // Example: "6.6.0-4" + list($version) = explode(' ',trim($version)); + if (version_compare($version, '6.0.0') >= 0) { + $this->foundPath = $path; + $result = TRUE; + break; + } + } + } + } + return $result; + } +} +?> \ No newline at end of file diff --git a/typo3/sysext/install/Classes/Configuration/PresetInterface.php b/typo3/sysext/install/Classes/Configuration/PresetInterface.php new file mode 100644 index 000000000000..3582841681b6 --- /dev/null +++ b/typo3/sysext/install/Classes/Configuration/PresetInterface.php @@ -0,0 +1,94 @@ +<?php +namespace TYPO3\CMS\Install\Configuration; + +/*************************************************************** + * Copyright notice + * + * (c) 2013 Christian Kuhn <lolli@schwarzbu.ch> + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ + +use TYPO3\CMS\Core\Utility\GeneralUtility; + +/** + * Preset interface + * + * A preset is a class for handling a specific configuration + * set of a feature. + */ +interface PresetInterface { + + /** + * Set POST values + * + * @param array $postValues Post values of feature + * @return mixed + */ + public function setPostValues(array $postValues); + + /** + * Check if preset is available on the system + * + * @return boolean TRUE if preset is available + */ + public function isAvailable(); + + /** + * Wrapper for isAvailable, used in fluid + * + * @return boolean TRUE if preset is available + */ + public function getIsAvailable(); + + /** + * Check is preset is currently active on the system + * + * @return boolean TRUE if preset is active + */ + public function isActive(); + + /** + * Wrapper for isActive, used in fluid + * + * @return boolean TRUE if preset is active + */ + public function getIsActive(); + + /** + * Get name of preset + * + * @return string Name + */ + public function getName(); + + /** + * Get priority of preset + * + * @return integer Priority, usually between 0 and 100 + */ + public function getPriority(); + + /** + * Get configuration values to activate prefix + * + * @return array Configuration values needed to activate prefix + */ + public function getConfigurationValues(); +} +?> \ No newline at end of file diff --git a/typo3/sysext/install/Classes/Controller/Action/Step/DefaultConfiguration.php b/typo3/sysext/install/Classes/Controller/Action/Step/DefaultConfiguration.php index 487f2fb44a1a..f3024b2b525e 100644 --- a/typo3/sysext/install/Classes/Controller/Action/Step/DefaultConfiguration.php +++ b/typo3/sysext/install/Classes/Controller/Action/Step/DefaultConfiguration.php @@ -37,11 +37,17 @@ class DefaultConfiguration extends Action\AbstractAction implements StepInterfac * @return array<\TYPO3\CMS\Install\Status\StatusInterface> */ public function execute() { - // @TODO: Implement "auto configuration" + /** @var \TYPO3\CMS\Install\Configuration\FeatureManager $featureManager */ + $featureManager = $this->objectManager->get('TYPO3\\CMS\\Install\\Configuration\\FeatureManager'); + // Get best matching configuration presets + $configurationValues = $featureManager->getBestMatchingConfigurationForAllFeatures(); + + // Setting SYS/isInitialInstallationInProgress to FALSE marks this instance installation as complete + $configurationValues['SYS/isInitialInstallationInProgress'] = FALSE; /** @var $configurationManager \TYPO3\CMS\Core\Configuration\ConfigurationManager */ $configurationManager = $this->objectManager->get('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager'); - $configurationManager->setLocalConfigurationValueByPath('SYS/isInitialInstallationInProgress', FALSE); + $configurationManager->setLocalConfigurationValuesByPathValuePairs($configurationValues); /** @var \TYPO3\CMS\Install\Service\SessionService $session */ $session = $this->objectManager->get('TYPO3\\CMS\\Install\\Service\\SessionService'); diff --git a/typo3/sysext/install/Classes/Controller/Action/Tool/Configuration.php b/typo3/sysext/install/Classes/Controller/Action/Tool/Configuration.php new file mode 100644 index 000000000000..703524a3a791 --- /dev/null +++ b/typo3/sysext/install/Classes/Controller/Action/Tool/Configuration.php @@ -0,0 +1,93 @@ +<?php +namespace TYPO3\CMS\Install\Controller\Action\Tool; + +/*************************************************************** + * Copyright notice + * + * (c) 2013 Christian Kuhn <lolli@schwarzbu.ch> + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ + +use TYPO3\CMS\Install\Controller\Action; + +/** + * Show configuration features and handle presets + */ +class Configuration extends Action\AbstractAction implements Action\ActionInterface { + + /** + * @var \TYPO3\CMS\Install\Configuration\FeatureManager + * @inject + */ + protected $featureManager; + + /** + * @var \TYPO3\CMS\Core\Configuration\ConfigurationManager + * @inject + */ + protected $configurationManager = NULL; + + /** + * Handle this action + * + * @return string content + */ + public function handle() { + $this->initializeHandle(); + + $actionMessages = array(); + if (isset($this->postValues['set']['activate'])) { + $actionMessages[] = $this->activate(); + $this->activate(); + } + $this->view->assign('actionMessages', $actionMessages); + + $postValues = is_array($this->postValues['values']) ? $this->postValues['values'] : array(); + $this->view->assign('features', $this->featureManager->getInitializedFeatures($postValues)); + + return $this->view->render(); + } + + /** + * Configure selected feature presets to be active + * + * @return \TYPO3\CMS\Install\Status\StatusInterface + */ + protected function activate() { + $configurationValues = $this->featureManager->getConfigurationForSelectedFeaturePresets($this->postValues['values']); + + if (count($configurationValues) > 0) { + $this->configurationManager->setLocalConfigurationValuesByPathValuePairs($configurationValues); + /** @var $message \TYPO3\CMS\Install\Status\StatusInterface */ + $message = $this->objectManager->get('TYPO3\\CMS\\Install\\Status\\OkStatus'); + $message->setTitle('Configuration written'); + $messageBody = array(); + foreach ($configurationValues as $configurationKey => $configurationValue) { + $messageBody[] = '\'' . $configurationKey . '\' => \'' . $configurationValue . '\''; + } + $message->setMessage(implode(LF, $messageBody)); + } else { + /** @var $message \TYPO3\CMS\Install\Status\StatusInterface */ + $message = $this->objectManager->get('TYPO3\\CMS\\Install\\Status\\InfoStatus'); + $message->setTitle('No configuration change selected'); + } + return $message; + } +} +?> diff --git a/typo3/sysext/install/Classes/Controller/ToolController.php b/typo3/sysext/install/Classes/Controller/ToolController.php index 890ff140e5b8..504a8fb0a5eb 100644 --- a/typo3/sysext/install/Classes/Controller/ToolController.php +++ b/typo3/sysext/install/Classes/Controller/ToolController.php @@ -42,6 +42,7 @@ class ToolController extends AbstractController { 'welcome', 'importantActions', 'systemEnvironment', + 'configuration', 'folderStructure', 'testSetup', 'updateWizard', diff --git a/typo3/sysext/install/Resources/Private/Partials/Action/Common/Left.html b/typo3/sysext/install/Resources/Private/Partials/Action/Common/Left.html index e55e545be2ed..283bbd5d353a 100644 --- a/typo3/sysext/install/Resources/Private/Partials/Action/Common/Left.html +++ b/typo3/sysext/install/Resources/Private/Partials/Action/Common/Left.html @@ -18,6 +18,11 @@ </f:if> </a> </li> + <li id="t3-install-menu-configuration" class="{f:if(condition:'{action} == \'configuration\'', then:'act')}"> + <a href="Install.php?install[action]=configuration&install[context]={context}&install[controller]=tool"> + Configuration Presets + </a> + </li> <li id="t3-install-menu-folderStructure" class="{f:if(condition:'{action} == \'folderStructure\'', then:'act')}"> <a href="Install.php?install[action]=folderStructure&install[context]={context}&install[controller]=tool"> Folder structure diff --git a/typo3/sysext/install/Resources/Private/Partials/Action/Tool/Configuration/Charset.html b/typo3/sysext/install/Resources/Private/Partials/Action/Tool/Configuration/Charset.html new file mode 100644 index 000000000000..c80f237322ac --- /dev/null +++ b/typo3/sysext/install/Resources/Private/Partials/Action/Tool/Configuration/Charset.html @@ -0,0 +1,20 @@ +<div class="toggleGroup"> + <div class="toggleButton"> + <h4>Character set conversion settings</h4> + </div> + + <div class="toggleData" style="display:none"> + <p> + Charset conversion is done at various places in the TYPO3 CMS core + and can lead to massive performance problems if not set right. In + general the first available setting should be selected for maximum + performance and least problems. + </p> + + <f:for each="{feature.presetsOrderedByPriority}" as="preset"> + <f:render partial="Action/Tool/Configuration/{feature.name}/{preset.name}" arguments="{_all}" /> + </f:for> + </div> +</div> + +<hr /> \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Private/Partials/Action/Tool/Configuration/Charset/CoreInternal.html b/typo3/sysext/install/Resources/Private/Partials/Action/Tool/Configuration/Charset/CoreInternal.html new file mode 100644 index 000000000000..df14bbe0bbfa --- /dev/null +++ b/typo3/sysext/install/Resources/Private/Partials/Action/Tool/Configuration/Charset/CoreInternal.html @@ -0,0 +1,29 @@ +<div class="typo3-message message-warning"> + <div class="header-container"> + <div class="message-header"> + <input + type="radio" + class="t3-install-tool-configuration-radio" + id="t3-install-tool-configuration-charset-coreinternal" + name="install[values][{feature.name}][enable]" + value="{preset.name}" + {f:if(condition:'{preset.isActive}', then:'checked="checked"')} + /> + <label + for="t3-install-tool-configuration-charset-coreinternal" + class="t3-install-tool-configuration-radio-label" + > + <strong> + Internal core handling + </strong> + {f:if(condition:'{preset.isActive}', then:' [Active]')} + </label> + </div> + </div> + <div class="message-body>"> + Internal core charset handling is a fallback if neither mbstring nor iconv + is available. It is very slow, deprecated and buggy. Use this only if there + is no other option available and upgrade your system to include mbstring soon. + </div> +</div> +<p></p> \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Private/Partials/Action/Tool/Configuration/Charset/Custom.html b/typo3/sysext/install/Resources/Private/Partials/Action/Tool/Configuration/Charset/Custom.html new file mode 100644 index 000000000000..12333118a280 --- /dev/null +++ b/typo3/sysext/install/Resources/Private/Partials/Action/Tool/Configuration/Charset/Custom.html @@ -0,0 +1,43 @@ +<div class="typo3-message message-warning"> + <div class="header-container"> + <div class="message-header"> + <input + type="radio" + class="t3-install-tool-configuration-radio" + id="t3-install-tool-configuration-charset-custom" + name="install[values][{feature.name}][enable]" + value="{preset.name}" + {f:if(condition:'{preset.isActive}', then:'checked="checked"')} + /> + <label + for="t3-install-tool-configuration-charset-custom" + class="t3-install-tool-configuration-radio-label" + > + <strong> + Custom configuration + </strong> + {f:if(condition:'{preset.isActive}', then:' [Active]')} + </label> + </div> + </div> + <div class="message-body>"> + <p> + Custom configuration can be set here. The charset configuration supports + only a limited set of configuration variants. If this preset is activated + it is a sign for a not valid configuration and should be switched to one + of the configurations above. + </p> + + <f:for each="{preset.configurationValues}" as="configurationValue" key="configurationKey"> + <div> + <input + type="input" + name="install[values][{feature.name}][{preset.name}][{configurationKey}]" + value="{configurationValue}" + /> + {configurationKey} + </div> + </f:for> + </div> +</div> +<p></p> \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Private/Partials/Action/Tool/Configuration/Charset/Iconv.html b/typo3/sysext/install/Resources/Private/Partials/Action/Tool/Configuration/Charset/Iconv.html new file mode 100644 index 000000000000..77da924373f5 --- /dev/null +++ b/typo3/sysext/install/Resources/Private/Partials/Action/Tool/Configuration/Charset/Iconv.html @@ -0,0 +1,29 @@ +<div class="typo3-message {f:if(condition:'{preset.isAvailable}', then:'message-ok', else:'message-error')}"> + <div class="header-container"> + <div class="message-header"> + <input + type="radio" + class="t3-install-tool-configuration-radio" + id="t3-install-tool-configuration-charset-iconv" + name="install[values][{feature.name}][enable]" + value="{preset.name}" + {f:if(condition:'{preset.isAvailable}', then:'', else:'disabled="disabled"')} + {f:if(condition:'{preset.isActive}', then:'checked="checked"')} + /> + <label + for="t3-install-tool-configuration-charset-iconv" + class="t3-install-tool-configuration-radio-label" + > + <strong> + iconv + </strong> + {f:if(condition:'{preset.isActive}', then:' [Active]')} + </label> + </div> + </div> + <div class="message-body>"> + iconv implementation is based on a PHP module. It works well but + mbstring should be preferred if available. + </div> +</div> +<p></p> \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Private/Partials/Action/Tool/Configuration/Charset/Mbstring.html b/typo3/sysext/install/Resources/Private/Partials/Action/Tool/Configuration/Charset/Mbstring.html new file mode 100644 index 000000000000..de31bafdad71 --- /dev/null +++ b/typo3/sysext/install/Resources/Private/Partials/Action/Tool/Configuration/Charset/Mbstring.html @@ -0,0 +1,28 @@ +<div class="typo3-message {f:if(condition:'{preset.isAvailable}', then:'message-ok', else:'message-error')}"> + <div class="header-container"> + <div class="message-header"> + <input + type="radio" + class="t3-install-tool-configuration-radio" + id="t3-install-tool-configuration-charset-mbstring" + name="install[values][{feature.name}][enable]" + value="{preset.name}" + {f:if(condition:'{preset.isAvailable}', then:'', else:'disabled="disabled"')} + {f:if(condition:'{preset.isActive}', then:'checked="checked"')} + /> + <label + for="t3-install-tool-configuration-charset-mbstring" + class="t3-install-tool-configuration-radio-label" + > + <strong> + mbstring + </strong> + {f:if(condition:'{preset.isActive}', then:' [Active]')} + </label> + </div> + </div> + <div class="message-body>"> + mbstring conversion is based on a PHP module and usually the quickest implementation. + </div> +</div> +<p></p> \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Private/Partials/Action/Tool/Configuration/Context.html b/typo3/sysext/install/Resources/Private/Partials/Action/Tool/Configuration/Context.html new file mode 100644 index 000000000000..244087368be2 --- /dev/null +++ b/typo3/sysext/install/Resources/Private/Partials/Action/Tool/Configuration/Context.html @@ -0,0 +1,26 @@ +<div class="toggleGroup"> + <div class="toggleButton"> + <h4>Development / Production settings</h4> + </div> + + <div class="toggleData" style="display:none"> + <p> + A set of configuration options should be different if the current + environment is a development or a production system. The goal is + to configure a production instance with maximum performance and no + debug output that is possibly shown to users, while development + instances should enable error output. + </p> + <p> + The environment can be defined with the environment variable + "TYPO3_CONTEXT" set to "Production" or "Development". If no context + environment variable is set, "Production" is assumed. + </p> + + <f:for each="{feature.presetsOrderedByPriority}" as="preset"> + <f:render partial="Action/Tool/Configuration/{feature.name}/{preset.name}" arguments="{_all}" /> + </f:for> + </div> +</div> + +<hr /> \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Private/Partials/Action/Tool/Configuration/Context/Custom.html b/typo3/sysext/install/Resources/Private/Partials/Action/Tool/Configuration/Context/Custom.html new file mode 100644 index 000000000000..1b1fe0810d7e --- /dev/null +++ b/typo3/sysext/install/Resources/Private/Partials/Action/Tool/Configuration/Context/Custom.html @@ -0,0 +1,40 @@ +<div class="typo3-message message-warning"> + <div class="header-container"> + <div class="message-header"> + <input + type="radio" + class="t3-install-tool-configuration-radio" + id="t3-install-tool-configuration-context-custom" + name="install[values][{feature.name}][enable]" + value="{preset.name}" + {f:if(condition:'{preset.isActive}', then:'checked="checked"')} + /> + <label + for="t3-install-tool-configuration-context-custom" + class="t3-install-tool-configuration-radio-label" + > + <strong> + Custom configuration + </strong> + {f:if(condition:'{preset.isActive}', then:' [Active]')} + </label> + </div> + </div> + <div class="message-body>"> + <p> + Custom configuration mixture if no other preset fits. + </p> + + <f:for each="{preset.configurationValues}" as="configurationValue" key="configurationKey"> + <div> + <input + type="input" + name="install[values][{feature.name}][{preset.name}][{configurationKey}]" + value="{configurationValue}" + /> + {configurationKey} + </div> + </f:for> + </div> +</div> +<p></p> \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Private/Partials/Action/Tool/Configuration/Context/Development.html b/typo3/sysext/install/Resources/Private/Partials/Action/Tool/Configuration/Context/Development.html new file mode 100644 index 000000000000..2a379d5fea2f --- /dev/null +++ b/typo3/sysext/install/Resources/Private/Partials/Action/Tool/Configuration/Context/Development.html @@ -0,0 +1,28 @@ +<div class="typo3-message message-ok"> + <div class="header-container"> + <div class="message-header"> + <input + type="radio" + class="t3-install-tool-configuration-radio" + id="t3-install-tool-configuration-context-development" + name="install[values][{feature.name}][enable]" + value="{preset.name}" + {f:if(condition:'{preset.isActive}', then:'checked="checked"')} + /> + <label + for="t3-install-tool-configuration-context-development" + class="t3-install-tool-configuration-radio-label" + > + <strong> + Development + </strong> + {f:if(condition:'{preset.isActive}', then:' [Active]')} + </label> + </div> + </div> + <div class="message-body>"> + Development settings enable debug output, deprecation logs + and set logging to info level. + </div> +</div> +<p></p> \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Private/Partials/Action/Tool/Configuration/Context/Production.html b/typo3/sysext/install/Resources/Private/Partials/Action/Tool/Configuration/Context/Production.html new file mode 100644 index 000000000000..90dc4584aa48 --- /dev/null +++ b/typo3/sysext/install/Resources/Private/Partials/Action/Tool/Configuration/Context/Production.html @@ -0,0 +1,28 @@ +<div class="typo3-message message-ok"> + <div class="header-container"> + <div class="message-header"> + <input + type="radio" + class="t3-install-tool-configuration-radio" + id="t3-install-tool-configuration-context-production" + name="install[values][{feature.name}][enable]" + value="{preset.name}" + {f:if(condition:'{preset.isActive}', then:'checked="checked"')} + /> + <label + for="t3-install-tool-configuration-context-production" + class="t3-install-tool-configuration-radio-label" + > + <strong> + Production + </strong> + {f:if(condition:'{preset.isActive}', then:' [Active]')} + </label> + </div> + </div> + <div class="message-body>"> + Production settings turn off debug output, deprecation logs + and set logging to warnings and errors only. + </div> +</div> +<p></p> \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Private/Partials/Action/Tool/Configuration/ExtbaseObjectCache.html b/typo3/sysext/install/Resources/Private/Partials/Action/Tool/Configuration/ExtbaseObjectCache.html new file mode 100644 index 000000000000..62620755648d --- /dev/null +++ b/typo3/sysext/install/Resources/Private/Partials/Action/Tool/Configuration/ExtbaseObjectCache.html @@ -0,0 +1,24 @@ +<div class="toggleGroup"> + <div class="toggleButton"> + <h4>Extbase object cache</h4> + </div> + + <div class="toggleData" style="display:none"> + <p> + To speed up object instantiation Extbase stores some cache data. This can lead + to lots of SELECT database queries on each page hit if the cache is configured + to use the default database cache backend. + </p> + <p> + This cache can not grow very big, it uses no tagging and is used multiple times + for one request. These characteristics make it well suited to be used in + combination with a APC cache backend. + </p> + + <f:for each="{feature.presetsOrderedByPriority}" as="preset"> + <f:render partial="Action/Tool/Configuration/{feature.name}/{preset.name}" arguments="{_all}" /> + </f:for> + </div> +</div> + +<hr /> \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Private/Partials/Action/Tool/Configuration/ExtbaseObjectCache/Apc.html b/typo3/sysext/install/Resources/Private/Partials/Action/Tool/Configuration/ExtbaseObjectCache/Apc.html new file mode 100644 index 000000000000..aa3f0d8e7519 --- /dev/null +++ b/typo3/sysext/install/Resources/Private/Partials/Action/Tool/Configuration/ExtbaseObjectCache/Apc.html @@ -0,0 +1,38 @@ +<div class="typo3-message {f:if(condition:'{preset.isAvailable}', then:'message-ok', else:'message-warning')}"> + <div class="header-container"> + <div class="message-header"> + <input + type="radio" + class="t3-install-tool-configuration-radio" + id="t3-install-tool-configuration-extbaseobjectcache-apc" + name="install[values][{feature.name}][enable]" + value="{preset.name}" + {f:if(condition:'{preset.isAvailable}', then:'', else:'disabled="disabled"')} + {f:if(condition:'{preset.isActive}', then:'checked="checked"')} + /> + <label + for="t3-install-tool-configuration-extbaseobjectcache-apc" + class="t3-install-tool-configuration-radio-label" + > + <strong> + APC cache backend + </strong> + {f:if(condition:'{preset.isActive}', then:' [Active]')} + </label> + </div> + </div> + <div class="message-body>"> + <f:if condition="{preset.isAvailable}"> + <f:then> + Use APC cache backend. This reduces your MySQL load and + speeds up lots of TYPO3 CMS requests. Use if available. + </f:then> + <f:else> + APC is not loaded or not enough memory is left. APC should + be configured to have at least 100MB of shared memory with + 5MB free memory. + </f:else> + </f:if> + </div> +</div> +<p></p> \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Private/Partials/Action/Tool/Configuration/ExtbaseObjectCache/Database.html b/typo3/sysext/install/Resources/Private/Partials/Action/Tool/Configuration/ExtbaseObjectCache/Database.html new file mode 100644 index 000000000000..79e7a485c2bf --- /dev/null +++ b/typo3/sysext/install/Resources/Private/Partials/Action/Tool/Configuration/ExtbaseObjectCache/Database.html @@ -0,0 +1,28 @@ +<div class="typo3-message message-ok"> + <div class="header-container"> + <div class="message-header"> + <input + type="radio" + class="t3-install-tool-configuration-radio" + id="t3-install-tool-configuration-extbaseobjectcache-database" + name="install[values][{feature.name}][enable]" + value="{preset.name}" + {f:if(condition:'{preset.isActive}', then:'checked="checked"')} + /> + <label + for="t3-install-tool-configuration-extbaseobjectcache-database" + class="t3-install-tool-configuration-radio-label" + > + <strong> + Database cache backend + </strong> + {f:if(condition:'{preset.isActive}', then:' [Active]')} + </label> + </div> + </div> + <div class="message-body>"> + This default cache backend is always available and a + fallback if APC is not available. + </div> +</div> +<p></p> \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Private/Partials/Action/Tool/Configuration/Image.html b/typo3/sysext/install/Resources/Private/Partials/Action/Tool/Configuration/Image.html new file mode 100644 index 000000000000..67eee57bcd0b --- /dev/null +++ b/typo3/sysext/install/Resources/Private/Partials/Action/Tool/Configuration/Image.html @@ -0,0 +1,37 @@ +<div class="toggleGroup"> + <div class="toggleButton"> + <h4>Image handling settings</h4> + </div> + + <div class="toggleData" style="display:none"> + <p> + Advanced image handling in TYPO3 CMS uses the command line tools + GraphicsMagick or ImageMagick. The tools need to be configured + correctly depending on the version that is available on the system. + </p> + <p> + This module detects the available image handling versions and sets + the system accordingly. If everything is correctly set up the image + tests of the install tool section "Test setup" should be fine. + </p> + + <p> + If ImageMagick or GraphicsMagick executables are located at some + not standard place, add the absolute directory name here. + </p> + <p> + <input + type="input" + name="install[values][{feature.name}][additionalSearchPath]" + value="{feature.additionalSearchPath}" + /> + <button type="submit" name="install[set][ImageSearch]">Find executables in this directory</button> + </p> + + <f:for each="{feature.presetsOrderedByPriority}" as="preset"> + <f:render partial="Action/Tool/Configuration/{feature.name}/{preset.name}" arguments="{_all}" /> + </f:for> + </div> +</div> + +<hr /> \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Private/Partials/Action/Tool/Configuration/Image/Custom.html b/typo3/sysext/install/Resources/Private/Partials/Action/Tool/Configuration/Image/Custom.html new file mode 100644 index 000000000000..f716a16492d3 --- /dev/null +++ b/typo3/sysext/install/Resources/Private/Partials/Action/Tool/Configuration/Image/Custom.html @@ -0,0 +1,40 @@ +<div class="typo3-message message-warning"> + <div class="header-container"> + <div class="message-header"> + <input + type="radio" + class="t3-install-tool-configuration-radio" + id="t3-install-tool-configuration-image-custom" + name="install[values][{feature.name}][enable]" + value="{preset.name}" + {f:if(condition:'{preset.isActive}', then:'checked="checked"')} + /> + <label + for="t3-install-tool-configuration-image-custom" + class="t3-install-tool-configuration-radio-label" + > + <strong> + Custom configuration + </strong> + {f:if(condition:'{preset.isActive}', then:' [Active]')} + </label> + </div> + </div> + <div class="message-body>"> + <p> + Custom configuration mixture if no other preset fits. + </p> + + <f:for each="{preset.configurationValues}" as="configurationValue" key="configurationKey"> + <div> + <input + type="input" + name="install[values][{feature.name}][{preset.name}][{configurationKey}]" + value="{configurationValue}" + /> + {configurationKey} + </div> + </f:for> + </div> +</div> +<p></p> \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Private/Partials/Action/Tool/Configuration/Image/GraphicsMagick.html b/typo3/sysext/install/Resources/Private/Partials/Action/Tool/Configuration/Image/GraphicsMagick.html new file mode 100644 index 000000000000..61c24ea0a33c --- /dev/null +++ b/typo3/sysext/install/Resources/Private/Partials/Action/Tool/Configuration/Image/GraphicsMagick.html @@ -0,0 +1,37 @@ +<div class="typo3-message {f:if(condition:'{preset.isAvailable}', then:'message-ok', else:'message-error')}"> + <div class="header-container"> + <div class="message-header"> + <input + type="radio" + class="t3-install-tool-configuration-radio" + id="t3-install-tool-configuration-image-graphicsmagick" + name="install[values][{feature.name}][enable]" + value="{preset.name}" + {f:if(condition:'{preset.isAvailable}', then:'', else:'disabled="disabled"')} + {f:if(condition:'{preset.isActive}', then:'checked="checked"')} + /> + <label + for="t3-install-tool-configuration-image-graphicsmagick" + class="t3-install-tool-configuration-radio-label" + > + <strong> + Graphics Magick + </strong> + {f:if(condition:'{preset.isActive}', then:' [Active]')} + </label> + </div> + </div> + <div class="message-body>"> + <f:if condition="{preset.isAvailable}"> + <f:then> + GraphicsMagick was found in path {preset.foundPath} + </f:then> + <f:else> + GraphicsMagick was not found in standard system paths. If it is + installed at an unusual location at your system, add the path to the + input box above and search again. + </f:else> + </f:if> + </div> +</div> +<p></p> \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Private/Partials/Action/Tool/Configuration/Image/ImageMagick6.html b/typo3/sysext/install/Resources/Private/Partials/Action/Tool/Configuration/Image/ImageMagick6.html new file mode 100644 index 000000000000..000f7625b470 --- /dev/null +++ b/typo3/sysext/install/Resources/Private/Partials/Action/Tool/Configuration/Image/ImageMagick6.html @@ -0,0 +1,37 @@ +<div class="typo3-message {f:if(condition:'{preset.isAvailable}', then:'message-ok', else:'message-error')}"> + <div class="header-container"> + <div class="message-header"> + <input + type="radio" + class="t3-install-tool-configuration-radio" + id="t3-install-tool-configuration-image-imagemagick6" + name="install[values][{feature.name}][enable]" + value="{preset.name}" + {f:if(condition:'{preset.isAvailable}', then:'', else:'disabled="disabled"')} + {f:if(condition:'{preset.isActive}', then:'checked="checked"')} + /> + <label + for="t3-install-tool-configuration-image-imagemagick6" + class="t3-install-tool-configuration-radio-label" + > + <strong> + Image Magick version 6 or higher + </strong> + {f:if(condition:'{preset.isActive}', then:' [Active]')} + </label> + </div> + </div> + <div class="message-body>"> + <f:if condition="{preset.isAvailable}"> + <f:then> + An ImageMagick version 6 or higher was found in path {preset.foundPath} + </f:then> + <f:else> + ImageMagick version 6 or higher was not found in standard system paths. + If it is installed at an unusual location at your system, add the path + to the input box above and search again. + </f:else> + </f:if> + </div> +</div> +<p></p> \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Private/Templates/Action/Tool/Configuration.html b/typo3/sysext/install/Resources/Private/Templates/Action/Tool/Configuration.html new file mode 100644 index 000000000000..aa32bb9aa07c --- /dev/null +++ b/typo3/sysext/install/Resources/Private/Templates/Action/Tool/Configuration.html @@ -0,0 +1,28 @@ +{namespace i=TYPO3\CMS\Install\ViewHelpers} + +<f:layout name="ToolAuthenticated" /> + +<f:section name="Content"> + <h3>Configuration presets</h3> + + <f:for each="{actionMessages}" as="statusMessage"> + <f:render partial="Action/Common/StatusMessage" arguments="{message: statusMessage}" /> + </f:for> + + <p> + The configuration module suggests best matching configuration settings + based on your system setup. + </p> + + <hr /> + + <form method="post"> + <f:render partial="Action/Common/HiddenFormFields" arguments="{_all}" /> + + <f:for each="{features}" as="feature"> + <f:render partial="Action/Tool/Configuration/{feature.name}" arguments="{_all}" /> + </f:for> + + <f:render partial="Action/Common/SubmitButton" arguments="{name:'activate', text:'Activate'}"/> + </form> +</f:section> \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/Images/Menu/Configuration.png b/typo3/sysext/install/Resources/Public/Images/Menu/Configuration.png new file mode 100644 index 0000000000000000000000000000000000000000..3262767cda95a217ac8d3fabf6c4bfe3514fd770 GIT binary patch literal 859 zcmV-h1El<kP)<h;3K|Lk000e1NJLTq000mG000mO1^@s6AM^iV00004XF*Lt006JZ zHwB960000PbVXQnQ*UN;cVTj606}DLVr3vnZDD6+Qe|Oed2z{QJOBU!?MXyIR5;6R zQ|(JraTGrHHYa*Vx;5Q=X=BBpC1l7x6fBU){s5tGLXdtQ)(0U+eGrra@gEp|+7N`< zKagatHD8+5#IiATIkm>-)HU~Z@BQ7|ITsWqFPt%czw<ojd7g7Gr>ZJk^u%JZL0Ogu z7-JwwQn0tTclx3}?kvID+L{XidsxQ^&e&|W7P?<rTFNyxHd^t_fMgy0{rwv!82${{ zkHB?oN??-(i`8m1pwjF0jLt++Okk}CgF*i}f_Oac69i$%ZnyJBqmd>hu`JbU6)Keq zD2hUaNxZkB72a$%4^2)^`UtC|A7te-nGAX1Xrjep5qO>_@7ffX%SGn`-ED7gLpU5( zk(@u5K{Og2Z)$29rKuELp-_NyIt_Job>MI~K&R7bgynLX>`sh~jA#lt3}_YQwqglZ ztJPR4mEiF3kO&v?|I7ONdO%xaZnyg`4MVH2u&{85WF^F8xkx0!oK7d7&*!07ENT-s zHZ~xYO7;1CzImGB_xm6GXq<Ulk_zys<24uz2C@lLQ&S30vd9~<Y0_y5HK3i-^-@n& z7NOJZg6S<UWd@{_>~MiVV0C|gzZGQ)-QC?rN*&h*fy7fxUu2>pgCsM)-Q?tMb$Vds z*E@*sEW?$R-d!Zlo`yI#H#gqa);3B?D6pBWXVBO67?`R6Qy3_qLZ+|_MxhlJx8`9r z{Xs@mdTouNQ0N7+J#TJqhNGh+O#w+J@OC~45~`3D2_z=L-&zrFU%dy%Qdzg0ic~cM z%s{~na19L&^isj*=4PpCtqL-e!E)J#V5X7%DWt(<u)>#}Pq3W$oGSy^Pc4j%jrk7_ z4xV5*S(C}slXQfB*Dx$m5ut)=uA6Vdoof#vmX1Pr{o_H2ueAT3P;2Ktrs3gX7h2gv zE62G1jK||?p|odbXLH|f%y4eoeRKHd`|tRw^&nXM?`u5!c)i}iTrM|2E9N*Z__gcJ lE2dmBR}@y4olxbIzJJd{=EC=vF*^VN002ovPDHLkV1lGDi4On( literal 0 HcmV?d00001 diff --git a/typo3/sysext/install/Resources/Public/Stylesheets/Action/Common/Install.css b/typo3/sysext/install/Resources/Public/Stylesheets/Action/Common/Install.css index c415fcdc22db..1ee279e450ea 100755 --- a/typo3/sysext/install/Resources/Public/Stylesheets/Action/Common/Install.css +++ b/typo3/sysext/install/Resources/Public/Stylesheets/Action/Common/Install.css @@ -312,6 +312,10 @@ button span.t3-install-form-button-icon-negative { background-image: url('../../../Images/Menu/SystemEnvironment.png'); } +#t3-install-menu #t3-install-menu-configuration { + background-image: url('../../../Images/Menu/Configuration.png'); +} + #t3-install-menu #t3-install-menu-folderStructure { background-image: url('../../../Images/Menu/FolderStructure.png'); } @@ -398,7 +402,12 @@ button span.t3-install-form-button-icon-negative { color: #111 !important; } - +.t3-install-tool-configuration-radio { + float: none; +} +.t3-install-tool-configuration-radio-label { + float: none; +} .typo3-message { padding: 0.6em 0.6em 0.6em 2.6em; @@ -632,4 +641,4 @@ body.standalone .t3-install-login h2 { clear: both; margin: 0; padding: 0.5em 0 0.5em 3.35em; -} +} \ No newline at end of file -- GitLab