TYPO3 v15 dev-main snapshot ()
This commit is contained in:
@@ -0,0 +1,110 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
namespace TYPO3\CMS\Install\Configuration;
|
||||
|
||||
/**
|
||||
* Abstract custom preset class implements common preset code
|
||||
* @internal only to be used within EXT:install
|
||||
*/
|
||||
abstract class AbstractCustomPreset extends AbstractPreset
|
||||
{
|
||||
/**
|
||||
* @var string Name of preset, always set to "Custom"
|
||||
*/
|
||||
protected $name = 'Custom';
|
||||
|
||||
/**
|
||||
* @var bool TRUE if custom preset is active
|
||||
*/
|
||||
protected $isActive = false;
|
||||
|
||||
/**
|
||||
* @var int Priority of custom prefix is usually the lowest
|
||||
*/
|
||||
protected $priority = 10;
|
||||
|
||||
/**
|
||||
* Whether custom preset is active is set by feature
|
||||
*
|
||||
* @return bool 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.
|
||||
*/
|
||||
public function setActive()
|
||||
{
|
||||
$this->isActive = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom configuration is always available
|
||||
*
|
||||
* @return bool TRUE
|
||||
*/
|
||||
public function isAvailable()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get configuration values is used to persist data and is merged with given $postValues.
|
||||
*
|
||||
* @return array Configuration values needed to activate prefix
|
||||
*/
|
||||
public function getConfigurationValues()
|
||||
{
|
||||
return array_map(static fn($configuration) => $configuration['value'], $this->getConfigurationDescriptors());
|
||||
}
|
||||
|
||||
/**
|
||||
* Build configuration descriptors to be 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 getConfigurationDescriptors()
|
||||
{
|
||||
$configurationValues = [];
|
||||
foreach ($this->configurationValues as $configurationKey => $configurationValue) {
|
||||
$readonly = isset($this->readonlyConfigurationValues[$configurationKey]);
|
||||
if (!$readonly
|
||||
&& 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] = [
|
||||
'value' => $currentValue,
|
||||
'readonly' => $readonly,
|
||||
];
|
||||
}
|
||||
return $configurationValues;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
namespace TYPO3\CMS\Install\Configuration;
|
||||
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
/**
|
||||
* Abstract feature class implements common code
|
||||
* @internal only to be used within EXT:install
|
||||
*/
|
||||
abstract class AbstractFeature
|
||||
{
|
||||
/**
|
||||
* @var string Name of feature
|
||||
*/
|
||||
protected $name = '';
|
||||
|
||||
/**
|
||||
* @var array List of preset classes
|
||||
*/
|
||||
protected $presetRegistry = [];
|
||||
|
||||
/**
|
||||
* @var array Holds instances of presets
|
||||
*/
|
||||
protected $presetInstances = [];
|
||||
|
||||
/**
|
||||
* @var array List of $POST values
|
||||
*/
|
||||
protected $postValues = [];
|
||||
|
||||
/**
|
||||
* Initialize presets of feature
|
||||
*
|
||||
* @param array $postValues List of $POST values of this feature
|
||||
* @throws Exception
|
||||
*/
|
||||
public function initializePresets(array $postValues)
|
||||
{
|
||||
// Give feature sub array of $POST values to preset and set to own property
|
||||
$featurePostValues = [];
|
||||
if (!empty($postValues[$this->name])) {
|
||||
$featurePostValues = $postValues[$this->name];
|
||||
}
|
||||
$this->postValues = $featurePostValues;
|
||||
|
||||
$isNonCustomPresetActive = false;
|
||||
$customPresetFound = false;
|
||||
foreach ($this->presetRegistry as $presetClass) {
|
||||
$presetInstance = GeneralUtility::makeInstance($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 = [];
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
namespace TYPO3\CMS\Install\Configuration;
|
||||
|
||||
use TYPO3\CMS\Core\Configuration\ConfigurationManager;
|
||||
use TYPO3\CMS\Core\Utility\Exception\MissingArrayPathException;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
/**
|
||||
* Abstract preset class implements common preset code
|
||||
* @internal only to be used within EXT:install
|
||||
*/
|
||||
abstract class AbstractPreset implements PresetInterface
|
||||
{
|
||||
/**
|
||||
* @var \TYPO3\CMS\Core\Configuration\ConfigurationManager
|
||||
*/
|
||||
protected $configurationManager;
|
||||
|
||||
/**
|
||||
* @var string Name of preset, must be set by extending classes
|
||||
*/
|
||||
protected $name = '';
|
||||
|
||||
/**
|
||||
* @var int Default priority of preset
|
||||
*/
|
||||
protected $priority = 50;
|
||||
|
||||
/**
|
||||
* @var array Configuration values handled by this preset
|
||||
*/
|
||||
protected $configurationValues = [];
|
||||
|
||||
/**
|
||||
* @var array Configuration values that are visible but not editable via presets GUI
|
||||
*/
|
||||
protected $readonlyConfigurationValues = [];
|
||||
|
||||
/**
|
||||
* @var array List of $POST values
|
||||
*/
|
||||
protected $postValues = [];
|
||||
|
||||
public function __construct(?ConfigurationManager $configurationManager = null)
|
||||
{
|
||||
$this->configurationManager = $configurationManager ?: GeneralUtility::makeInstance(ConfigurationManager::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set POST values
|
||||
*
|
||||
* @param array $postValues Post values of feature
|
||||
* @return mixed
|
||||
*/
|
||||
public function setPostValues(array $postValues)
|
||||
{
|
||||
$this->postValues = $postValues;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper for isAvailable, used in fluid
|
||||
*
|
||||
* @return bool TRUE if preset is available
|
||||
*/
|
||||
public function getIsAvailable()
|
||||
{
|
||||
return $this->isAvailable();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check is preset is currently active on the system
|
||||
*
|
||||
* @return bool TRUE if preset is active
|
||||
*/
|
||||
public function isActive()
|
||||
{
|
||||
$isActive = true;
|
||||
foreach ($this->configurationValues as $configurationKey => $configurationValue) {
|
||||
try {
|
||||
$currentValue = $this->configurationManager->getConfigurationValueByPath($configurationKey);
|
||||
} catch (MissingArrayPathException $e) {
|
||||
$currentValue = null;
|
||||
}
|
||||
if ($currentValue === null && $configurationValue === '__UNSET') {
|
||||
// Preset can define configuration values to be removed using `__UNSET` value handled by
|
||||
// `ArrayUtility::mergeRecursiveWithOverrule()`, retrieving `$currentValue = null`. This
|
||||
// case needs to be skipped to avoid taking the unset value of the other preset to flag
|
||||
// the current preset as inactive. Continue with next value.
|
||||
continue;
|
||||
}
|
||||
if ($currentValue !== $configurationValue) {
|
||||
$isActive = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $isActive;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper for isActive, used in fluid
|
||||
*
|
||||
* @return bool 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 int 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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
namespace TYPO3\CMS\Install\Configuration\Cache;
|
||||
|
||||
use TYPO3\CMS\Install\Configuration\AbstractFeature;
|
||||
use TYPO3\CMS\Install\Configuration\FeatureInterface;
|
||||
|
||||
/**
|
||||
* Cache feature sets best practices
|
||||
* @internal only to be used within EXT:install
|
||||
*/
|
||||
class CacheFeature extends AbstractFeature implements FeatureInterface
|
||||
{
|
||||
/**
|
||||
* @var string Name of feature
|
||||
*/
|
||||
protected $name = 'Cache';
|
||||
|
||||
/**
|
||||
* @var array List of preset classes
|
||||
*/
|
||||
protected $presetRegistry = [
|
||||
DatabaseCachePreset::class,
|
||||
FileCachePreset::class,
|
||||
CustomCachePreset::class,
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
namespace TYPO3\CMS\Install\Configuration\Cache;
|
||||
|
||||
use TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend;
|
||||
use TYPO3\CMS\Install\Configuration\AbstractCustomPreset;
|
||||
use TYPO3\CMS\Install\Configuration\CustomPresetInterface;
|
||||
|
||||
/**
|
||||
* Custom preset is a fallback if no other preset fits
|
||||
* @internal only to be used within EXT:install
|
||||
*/
|
||||
class CustomCachePreset extends AbstractCustomPreset implements CustomPresetInterface
|
||||
{
|
||||
/**
|
||||
* @var array Configuration values handled by this preset
|
||||
*/
|
||||
protected $configurationValues = [
|
||||
'SYS/caching/cacheConfigurations/hash/backend' => Typo3DatabaseBackend::class,
|
||||
'SYS/caching/cacheConfigurations/pages/backend' => Typo3DatabaseBackend::class,
|
||||
'SYS/caching/cacheConfigurations/rootline/backend' => Typo3DatabaseBackend::class,
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
namespace TYPO3\CMS\Install\Configuration\Cache;
|
||||
|
||||
use TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend;
|
||||
use TYPO3\CMS\Install\Configuration\AbstractPreset;
|
||||
|
||||
class DatabaseCachePreset extends AbstractPreset
|
||||
{
|
||||
/**
|
||||
* @var string Name of preset
|
||||
*/
|
||||
protected $name = 'Database';
|
||||
|
||||
/**
|
||||
* @var int Priority of preset
|
||||
*/
|
||||
protected $priority = 60;
|
||||
|
||||
/**
|
||||
* @var array Configuration values handled by this preset
|
||||
*/
|
||||
protected $configurationValues = [
|
||||
'SYS/caching/cacheConfigurations/hash/backend' => Typo3DatabaseBackend::class,
|
||||
'SYS/caching/cacheConfigurations/pages/backend' => Typo3DatabaseBackend::class,
|
||||
'SYS/caching/cacheConfigurations/pages/options/compression' => true,
|
||||
'SYS/caching/cacheConfigurations/rootline/backend' => Typo3DatabaseBackend::class,
|
||||
'SYS/caching/cacheConfigurations/rootline/options/compression' => true,
|
||||
];
|
||||
|
||||
/**
|
||||
* Database is always enabled
|
||||
*
|
||||
* @return bool TRUE if sendmail path if set
|
||||
*/
|
||||
public function isAvailable()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
namespace TYPO3\CMS\Install\Configuration\Cache;
|
||||
|
||||
use TYPO3\CMS\Core\Cache\Backend\FileBackend;
|
||||
use TYPO3\CMS\Install\Configuration\AbstractPreset;
|
||||
|
||||
class FileCachePreset extends AbstractPreset
|
||||
{
|
||||
/**
|
||||
* @var string Name of preset
|
||||
*/
|
||||
protected $name = 'File';
|
||||
|
||||
/**
|
||||
* @var int Priority of preset
|
||||
*/
|
||||
protected $priority = 50;
|
||||
|
||||
/**
|
||||
* @var array Configuration values handled by this preset
|
||||
*/
|
||||
protected $configurationValues = [
|
||||
'SYS/caching/cacheConfigurations/hash/backend' => FileBackend::class,
|
||||
'SYS/caching/cacheConfigurations/pages/backend' => FileBackend::class,
|
||||
'SYS/caching/cacheConfigurations/pages/options/compression' => '__UNSET',
|
||||
'SYS/caching/cacheConfigurations/rootline/backend' => FileBackend::class,
|
||||
'SYS/caching/cacheConfigurations/rootline/options/compression' => '__UNSET',
|
||||
];
|
||||
|
||||
/**
|
||||
* Database is always enabled
|
||||
*
|
||||
* @return bool TRUE if sendmail path if set
|
||||
*/
|
||||
public function isAvailable()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
namespace TYPO3\CMS\Install\Configuration\Context;
|
||||
|
||||
use TYPO3\CMS\Install\Configuration\AbstractFeature;
|
||||
use TYPO3\CMS\Install\Configuration\FeatureInterface;
|
||||
|
||||
/**
|
||||
* Context feature sets development / production settings
|
||||
* @internal only to be used within EXT:install
|
||||
*/
|
||||
class ContextFeature extends AbstractFeature implements FeatureInterface
|
||||
{
|
||||
/**
|
||||
* @var string Name of feature
|
||||
*/
|
||||
protected $name = 'Context';
|
||||
|
||||
/**
|
||||
* @var array List of preset classes
|
||||
*/
|
||||
protected $presetRegistry = [
|
||||
LivePreset::class,
|
||||
DebugPreset::class,
|
||||
CustomPreset::class,
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
namespace TYPO3\CMS\Install\Configuration\Context;
|
||||
|
||||
use TYPO3\CMS\Install\Configuration\AbstractCustomPreset;
|
||||
use TYPO3\CMS\Install\Configuration\CustomPresetInterface;
|
||||
|
||||
/**
|
||||
* Custom preset is a fallback if no other preset fits
|
||||
* @internal only to be used within EXT:install
|
||||
*/
|
||||
class CustomPreset extends AbstractCustomPreset implements CustomPresetInterface
|
||||
{
|
||||
/**
|
||||
* @var array Configuration values handled by this preset
|
||||
*/
|
||||
protected $configurationValues = [
|
||||
'BE/debug' => '',
|
||||
'FE/debug' => '',
|
||||
'SYS/devIPmask' => '',
|
||||
'SYS/displayErrors' => '',
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
namespace TYPO3\CMS\Install\Configuration\Context;
|
||||
|
||||
use Psr\Log\LogLevel;
|
||||
use TYPO3\CMS\Core\Core\Environment;
|
||||
use TYPO3\CMS\Core\Log\Writer\FileWriter;
|
||||
use TYPO3\CMS\Install\Configuration\AbstractPreset;
|
||||
|
||||
/**
|
||||
* Debug preset
|
||||
* @internal only to be used within EXT:install
|
||||
*/
|
||||
class DebugPreset extends AbstractPreset
|
||||
{
|
||||
/**
|
||||
* @var string Name of preset
|
||||
*/
|
||||
protected $name = 'Debug';
|
||||
|
||||
/**
|
||||
* @var int Priority of preset
|
||||
*/
|
||||
protected $priority = 50;
|
||||
|
||||
/**
|
||||
* @var array Configuration values handled by this preset
|
||||
*/
|
||||
protected $configurationValues = [
|
||||
'BE/debug' => true,
|
||||
'FE/debug' => true,
|
||||
'SYS/devIPmask' => '*',
|
||||
'SYS/displayErrors' => 1,
|
||||
// Values below are not available in UI
|
||||
'LOG/TYPO3/CMS/deprecations/writerConfiguration/' . LogLevel::NOTICE . '/' . FileWriter::class . '/disabled' => false,
|
||||
// E_WARNING | E_RECOVERABLE_ERROR | E_DEPRECATED
|
||||
'SYS/exceptionalErrors' => 12290,
|
||||
];
|
||||
|
||||
/**
|
||||
* Development preset is always available
|
||||
*
|
||||
* @return bool Always TRUE
|
||||
*/
|
||||
public function isAvailable()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* If context is set to development, priority
|
||||
* of this preset is raised.
|
||||
*
|
||||
* @return int Priority of preset
|
||||
*/
|
||||
public function getPriority()
|
||||
{
|
||||
$priority = $this->priority;
|
||||
if (Environment::getContext()->isDevelopment()) {
|
||||
$priority = $priority + 20;
|
||||
}
|
||||
return $priority;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
namespace TYPO3\CMS\Install\Configuration\Context;
|
||||
|
||||
use Psr\Log\LogLevel;
|
||||
use TYPO3\CMS\Core\Core\Environment;
|
||||
use TYPO3\CMS\Core\Log\Writer\FileWriter;
|
||||
use TYPO3\CMS\Install\Configuration\AbstractPreset;
|
||||
|
||||
/**
|
||||
* Live preset
|
||||
* @internal only to be used within EXT:install
|
||||
*/
|
||||
class LivePreset extends AbstractPreset
|
||||
{
|
||||
/**
|
||||
* @var string Name of preset
|
||||
*/
|
||||
protected $name = 'Live';
|
||||
|
||||
/**
|
||||
* @var int Priority of preset
|
||||
*/
|
||||
protected $priority = 50;
|
||||
|
||||
/**
|
||||
* @var array Configuration values handled by this preset
|
||||
*/
|
||||
protected $configurationValues = [
|
||||
'BE/debug' => false,
|
||||
'FE/debug' => false,
|
||||
'SYS/devIPmask' => '',
|
||||
'SYS/displayErrors' => 0,
|
||||
// Values below are not available in UI
|
||||
'LOG/TYPO3/CMS/deprecations/writerConfiguration/' . LogLevel::NOTICE . '/' . FileWriter::class . '/disabled' => true,
|
||||
// E_RECOVERABLE_ERROR
|
||||
'SYS/exceptionalErrors' => 4096,
|
||||
];
|
||||
|
||||
/**
|
||||
* Production preset is always available
|
||||
*
|
||||
* @return bool Always TRUE
|
||||
*/
|
||||
public function isAvailable()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* If context is set to production, priority
|
||||
* of this preset is raised.
|
||||
*
|
||||
* @return int Priority of preset
|
||||
*/
|
||||
public function getPriority()
|
||||
{
|
||||
$priority = $this->priority;
|
||||
if (Environment::getContext()->isProduction()) {
|
||||
$priority = $priority + 20;
|
||||
}
|
||||
return $priority;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
namespace TYPO3\CMS\Install\Configuration;
|
||||
|
||||
/**
|
||||
* Custom preset interface
|
||||
*
|
||||
* Interface for presets not caught 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.
|
||||
*/
|
||||
public function setActive();
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
namespace TYPO3\CMS\Install\Configuration;
|
||||
|
||||
/**
|
||||
* A configuration exception
|
||||
*/
|
||||
class Exception extends \TYPO3\CMS\Install\Exception {}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
namespace TYPO3\CMS\Install\Configuration;
|
||||
|
||||
/**
|
||||
* A feature representation handles preset classes.
|
||||
*/
|
||||
interface FeatureInterface
|
||||
{
|
||||
/**
|
||||
* Initialize presets
|
||||
*
|
||||
* @param array $postValues List of $POST values of this feature
|
||||
*/
|
||||
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();
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
namespace TYPO3\CMS\Install\Configuration;
|
||||
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use TYPO3\CMS\Install\Configuration\Cache\CacheFeature;
|
||||
use TYPO3\CMS\Install\Configuration\Context\ContextFeature;
|
||||
use TYPO3\CMS\Install\Configuration\Image\ImageFeature;
|
||||
use TYPO3\CMS\Install\Configuration\Mail\MailFeature;
|
||||
use TYPO3\CMS\Install\Configuration\PasswordHashing\PasswordHashingFeature;
|
||||
|
||||
/**
|
||||
* Instantiate and configure all known features and presets
|
||||
* @internal only to be used within EXT:install
|
||||
*/
|
||||
class FeatureManager
|
||||
{
|
||||
/**
|
||||
* @var array List of feature class names
|
||||
*/
|
||||
protected $featureRegistry = [
|
||||
CacheFeature::class,
|
||||
ContextFeature::class,
|
||||
ImageFeature::class,
|
||||
MailFeature::class,
|
||||
PasswordHashingFeature::class,
|
||||
];
|
||||
|
||||
/**
|
||||
* Get initialized list of features with possible presets
|
||||
*
|
||||
* @param array $postValues List of $POST values
|
||||
* @return FeatureInterface[]
|
||||
* @throws Exception
|
||||
*/
|
||||
public function getInitializedFeatures(array $postValues = [])
|
||||
{
|
||||
$features = [];
|
||||
foreach ($this->featureRegistry as $featureClass) {
|
||||
$featureInstance = GeneralUtility::makeInstance($featureClass);
|
||||
if (!($featureInstance instanceof FeatureInterface)) {
|
||||
throw new Exception(
|
||||
'Feature ' . $featureClass . ' does 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 = [];
|
||||
$features = $this->getInitializedFeatures($postValues);
|
||||
foreach ($features as $feature) {
|
||||
$featureName = $feature->getName();
|
||||
$presets = $feature->getPresetsOrderedByPriority();
|
||||
foreach ($presets as $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 = [];
|
||||
$features = $this->getInitializedFeatures([]);
|
||||
foreach ($features as $feature) {
|
||||
$presets = $feature->getPresetsOrderedByPriority();
|
||||
foreach ($presets as $preset) {
|
||||
// Only choose "normal" presets, no custom presets
|
||||
if ($preset instanceof CustomPresetInterface) {
|
||||
break;
|
||||
}
|
||||
|
||||
if ($preset->isAvailable()) {
|
||||
$localConfigurationValuesToSet = array_merge(
|
||||
$localConfigurationValuesToSet,
|
||||
$preset->getConfigurationValues()
|
||||
);
|
||||
// Setting for this feature done, go to next feature
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $localConfigurationValuesToSet;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
namespace TYPO3\CMS\Install\Configuration\Image;
|
||||
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use TYPO3\CMS\Install\Configuration\AbstractPreset;
|
||||
|
||||
/**
|
||||
* Abstract class implements common image preset code
|
||||
* @internal only to be used within EXT:install
|
||||
*/
|
||||
abstract class AbstractImagePreset extends AbstractPreset
|
||||
{
|
||||
/**
|
||||
* @var array Default paths to search for executable, with trailing slash
|
||||
*/
|
||||
protected $defaultExecutableSearchPaths = [
|
||||
'/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 Found path
|
||||
*/
|
||||
public function getFoundPath()
|
||||
{
|
||||
return $this->foundPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check is preset is currently active on the system.
|
||||
* Overwrites parent method to ignore processor_path setting
|
||||
*
|
||||
* @return bool TRUE if preset is active
|
||||
*/
|
||||
public function isActive()
|
||||
{
|
||||
$isActive = true;
|
||||
foreach ($this->configurationValues as $configurationKey => $configurationValue) {
|
||||
if ($configurationKey !== 'GFX/processor_path') {
|
||||
$currentValue = $this->configurationManager->getConfigurationValueByPath($configurationKey);
|
||||
if ($currentValue !== $configurationValue) {
|
||||
$isActive = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $isActive;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find out if GraphicsMagick is available
|
||||
*
|
||||
* @return bool 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/processor_path'] = $this->getFoundPath();
|
||||
return $configurationValues;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find executable in path, wrapper for specific ImageMagick/GraphicsMagick find methods.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
abstract protected function findExecutableInPath(array $searchPaths);
|
||||
|
||||
/**
|
||||
* Get list of paths to search for image handling executables
|
||||
*
|
||||
* @return array List of paths to search for
|
||||
*/
|
||||
protected function getSearchPaths()
|
||||
{
|
||||
$searchPaths = $this->defaultExecutableSearchPaths;
|
||||
|
||||
// Add configured processor_path on top
|
||||
$imPath = $GLOBALS['TYPO3_CONF_VARS']['GFX']['processor_path'];
|
||||
if ((string)$imPath !== '' && !in_array($imPath, $searchPaths)) {
|
||||
$path = $this->cleanUpPath($imPath);
|
||||
array_unshift($searchPaths, $path);
|
||||
}
|
||||
|
||||
// Add additional search path from form if given
|
||||
if (isset($this->postValues['additionalSearchPath'])
|
||||
&& (string)$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 = GeneralUtility::fixWindowsFilePath((string)$path);
|
||||
// Add trailing slash if missing
|
||||
if (!preg_match('/[\\/]$/', $path)) {
|
||||
$path .= '/';
|
||||
}
|
||||
return $path;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
namespace TYPO3\CMS\Install\Configuration\Image;
|
||||
|
||||
use TYPO3\CMS\Install\Configuration\AbstractCustomPreset;
|
||||
use TYPO3\CMS\Install\Configuration\CustomPresetInterface;
|
||||
|
||||
/**
|
||||
* Custom preset is a fallback if no other preset fits
|
||||
* @internal only to be used within EXT:install
|
||||
*/
|
||||
class CustomPreset extends AbstractCustomPreset implements CustomPresetInterface
|
||||
{
|
||||
/**
|
||||
* @var array Configuration values handled by this preset
|
||||
*/
|
||||
protected $configurationValues = [
|
||||
'GFX/processor_enabled' => false,
|
||||
'GFX/processor_path' => '',
|
||||
'GFX/processor' => '',
|
||||
'GFX/processor_effects' => false,
|
||||
'GFX/processor_colorspace' => '',
|
||||
];
|
||||
|
||||
protected $readonlyConfigurationValues = [
|
||||
'GFX/processor_path' => true,
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
namespace TYPO3\CMS\Install\Configuration\Image;
|
||||
|
||||
use TYPO3\CMS\Core\Core\Environment;
|
||||
use TYPO3\CMS\Core\Utility\CommandUtility;
|
||||
|
||||
/**
|
||||
* Preset for GraphicsMagick
|
||||
* @internal only to be used within EXT:install
|
||||
*/
|
||||
class GraphicsMagickPreset extends AbstractImagePreset
|
||||
{
|
||||
/**
|
||||
* @var string Name of preset
|
||||
*/
|
||||
protected $name = 'GraphicsMagick';
|
||||
|
||||
/**
|
||||
* @var int Priority of preset
|
||||
*/
|
||||
protected $priority = 80;
|
||||
|
||||
/**
|
||||
* @var array Configuration values handled by this preset
|
||||
*/
|
||||
protected $configurationValues = [
|
||||
'GFX/processor_enabled' => true,
|
||||
// processor_path is determined and set by path lookup methods
|
||||
'GFX/processor_path' => '',
|
||||
'GFX/processor' => 'GraphicsMagick',
|
||||
'GFX/processor_effects' => false,
|
||||
];
|
||||
|
||||
/**
|
||||
* Find executable in path, wrapper for specific ImageMagick/GraphicsMagick find methods.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
protected function findExecutableInPath(array $searchPaths)
|
||||
{
|
||||
return $this->findGraphicsMagickInPaths($searchPaths);
|
||||
}
|
||||
|
||||
/**
|
||||
* Search for GraphicsMagick executables in given paths.
|
||||
*
|
||||
* @param array $searchPaths List of paths to search for
|
||||
* @return bool TRUE if graphics magick was found in path
|
||||
*/
|
||||
protected function findGraphicsMagickInPaths(array $searchPaths)
|
||||
{
|
||||
$result = false;
|
||||
foreach ($searchPaths as $path) {
|
||||
if (Environment::isWindows()) {
|
||||
$executable = 'gm.exe';
|
||||
} else {
|
||||
$executable = 'gm';
|
||||
}
|
||||
|
||||
$binaryPath = $path . $executable;
|
||||
if (!file_exists($binaryPath) || !is_executable($binaryPath)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$command = escapeshellarg($binaryPath) . ' -version';
|
||||
$executingResult = [];
|
||||
@CommandUtility::exec($command, $executingResult);
|
||||
// First line of exec command should contain string GraphicsMagick
|
||||
$firstResultLine = array_shift($executingResult);
|
||||
if (is_string($firstResultLine) && str_contains($firstResultLine, 'GraphicsMagick')) {
|
||||
$this->foundPath = $path;
|
||||
$result = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
namespace TYPO3\CMS\Install\Configuration\Image;
|
||||
|
||||
use TYPO3\CMS\Install\Configuration\AbstractFeature;
|
||||
use TYPO3\CMS\Install\Configuration\FeatureInterface;
|
||||
|
||||
/**
|
||||
* Image feature detects imagemagick / graphicsmagick versions
|
||||
* @internal only to be used within EXT:install
|
||||
*/
|
||||
class ImageFeature extends AbstractFeature implements FeatureInterface
|
||||
{
|
||||
/**
|
||||
* @var string Name of feature
|
||||
*/
|
||||
protected $name = 'Image';
|
||||
|
||||
/**
|
||||
* @var array List of preset classes
|
||||
*/
|
||||
protected $presetRegistry = [
|
||||
GraphicsMagickPreset::class,
|
||||
ImageMagick6Preset::class,
|
||||
CustomPreset::class,
|
||||
];
|
||||
|
||||
/**
|
||||
* Image feature can be fed 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']) && $this->postValues['additionalSearchPath'] !== '') {
|
||||
$additionalPath = $this->postValues['additionalSearchPath'];
|
||||
}
|
||||
return $additionalPath;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
namespace TYPO3\CMS\Install\Configuration\Image;
|
||||
|
||||
use TYPO3\CMS\Core\Core\Environment;
|
||||
use TYPO3\CMS\Core\Utility\CommandUtility;
|
||||
|
||||
/**
|
||||
* Preset for ImageMagick version 6 or higher
|
||||
* @internal only to be used within EXT:install
|
||||
*/
|
||||
class ImageMagick6Preset extends AbstractImagePreset
|
||||
{
|
||||
/**
|
||||
* @var string Name of preset
|
||||
*/
|
||||
protected $name = 'ImageMagick6';
|
||||
|
||||
/**
|
||||
* @var int Priority of preset
|
||||
*/
|
||||
protected $priority = 70;
|
||||
|
||||
/**
|
||||
* @var array Configuration values handled by this preset
|
||||
*/
|
||||
protected $configurationValues = [
|
||||
'GFX/processor_enabled' => true,
|
||||
// processor_path is determined and set by path lookup methods
|
||||
'GFX/processor_path' => '',
|
||||
'GFX/processor' => 'ImageMagick',
|
||||
'GFX/processor_effects' => true,
|
||||
];
|
||||
|
||||
/**
|
||||
* Find executable in path, wrapper for specific ImageMagick/GraphicsMagick find methods.
|
||||
*
|
||||
* @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 bool TRUE if graphics magick was found in path
|
||||
*/
|
||||
protected function findImageMagick6InPaths(array $searchPaths)
|
||||
{
|
||||
$result = false;
|
||||
foreach ($searchPaths as $path) {
|
||||
if (Environment::isWindows()) {
|
||||
$executable = 'identify.exe';
|
||||
|
||||
if (!@is_file($path . $executable)) {
|
||||
$executable = 'magick.exe';
|
||||
}
|
||||
} else {
|
||||
$executable = 'identify';
|
||||
}
|
||||
|
||||
$binaryPath = $path . $executable;
|
||||
if (!file_exists($binaryPath) || !is_executable($binaryPath)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$command = escapeshellarg($binaryPath) . ' -version';
|
||||
$executingResult = [];
|
||||
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 (is_string($firstResultLine) && str_contains($firstResultLine, 'ImageMagick')) {
|
||||
[, $version] = explode('ImageMagick', $firstResultLine);
|
||||
// Example: "6.6.0-4"
|
||||
[$version] = explode(' ', trim($version));
|
||||
if (version_compare($version, '6.0.0') >= 0) {
|
||||
$this->foundPath = $path;
|
||||
$result = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
namespace TYPO3\CMS\Install\Configuration\Mail;
|
||||
|
||||
use TYPO3\CMS\Install\Configuration\AbstractCustomPreset;
|
||||
use TYPO3\CMS\Install\Configuration\CustomPresetInterface;
|
||||
|
||||
/**
|
||||
* Custom preset is a fallback if no other preset fits
|
||||
* @internal only to be used within EXT:install
|
||||
*/
|
||||
class CustomPreset extends AbstractCustomPreset implements CustomPresetInterface
|
||||
{
|
||||
/**
|
||||
* @var array Configuration values handled by this preset
|
||||
*/
|
||||
protected $configurationValues = [
|
||||
'MAIL/transport' => '',
|
||||
'MAIL/transport_sendmail_command' => '',
|
||||
'MAIL/transport_smtp_server' => '',
|
||||
'MAIL/transport_smtp_encrypt' => '',
|
||||
'MAIL/transport_smtp_username' => '',
|
||||
'MAIL/transport_smtp_password' => '',
|
||||
];
|
||||
|
||||
protected $readonlyConfigurationValues = [
|
||||
'MAIL/transport_sendmail_command' => true,
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
namespace TYPO3\CMS\Install\Configuration\Mail;
|
||||
|
||||
use TYPO3\CMS\Install\Configuration\AbstractFeature;
|
||||
use TYPO3\CMS\Install\Configuration\FeatureInterface;
|
||||
|
||||
/**
|
||||
* Mail feature detects sendmail settings
|
||||
* @internal only to be used within EXT:install
|
||||
*/
|
||||
class MailFeature extends AbstractFeature implements FeatureInterface
|
||||
{
|
||||
/**
|
||||
* @var string Name of feature
|
||||
*/
|
||||
protected $name = 'Mail';
|
||||
|
||||
/**
|
||||
* @var array List of preset classes
|
||||
*/
|
||||
protected $presetRegistry = [
|
||||
SendmailPreset::class,
|
||||
SmtpPreset::class,
|
||||
CustomPreset::class,
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
namespace TYPO3\CMS\Install\Configuration\Mail;
|
||||
|
||||
use TYPO3\CMS\Install\Configuration\AbstractPreset;
|
||||
|
||||
/**
|
||||
* Sendmail path handling preset
|
||||
* @internal only to be used within EXT:install
|
||||
*/
|
||||
class SendmailPreset extends AbstractPreset
|
||||
{
|
||||
/**
|
||||
* @var string Name of preset
|
||||
*/
|
||||
protected $name = 'Sendmail';
|
||||
|
||||
/**
|
||||
* @var int Priority of preset
|
||||
*/
|
||||
protected $priority = 50;
|
||||
|
||||
/**
|
||||
* @var array Configuration values handled by this preset
|
||||
*/
|
||||
protected $configurationValues = [
|
||||
'MAIL/transport' => 'sendmail',
|
||||
'MAIL/transport_sendmail_command' => '',
|
||||
'MAIL/transport_smtp_server' => '',
|
||||
'MAIL/transport_smtp_encrypt' => '',
|
||||
'MAIL/transport_smtp_username' => '',
|
||||
'MAIL/transport_smtp_password' => '',
|
||||
];
|
||||
|
||||
/**
|
||||
* Get configuration values to activate prefix
|
||||
*
|
||||
* @return array Configuration values needed to activate prefix
|
||||
*/
|
||||
public function getConfigurationValues()
|
||||
{
|
||||
$configurationValues = $this->configurationValues;
|
||||
$configurationValues['MAIL/transport_sendmail_command'] = $this->getSendmailPath();
|
||||
if (($this->postValues['Mail']['enable'] ?? false) === 'Sendmail') {
|
||||
$configurationValues['MAIL/transport'] = 'sendmail';
|
||||
}
|
||||
return $configurationValues;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if sendmail path if set
|
||||
*
|
||||
* @return bool TRUE if sendmail path if set
|
||||
*/
|
||||
public function isAvailable()
|
||||
{
|
||||
return !empty($this->getSendmailPath());
|
||||
}
|
||||
|
||||
/**
|
||||
* Path where executable was found
|
||||
*
|
||||
* @return string|bool Sendmail path or FALSE if not set
|
||||
*/
|
||||
public function getSendmailPath()
|
||||
{
|
||||
return ini_get('sendmail_path');
|
||||
}
|
||||
|
||||
/**
|
||||
* Check is preset is currently active on the system
|
||||
*
|
||||
* @return bool TRUE if preset is active
|
||||
*/
|
||||
public function isActive()
|
||||
{
|
||||
$this->configurationValues['MAIL/transport_sendmail_command'] = $this->getSendmailPath();
|
||||
return parent::isActive();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
namespace TYPO3\CMS\Install\Configuration\Mail;
|
||||
|
||||
use TYPO3\CMS\Install\Configuration\AbstractPreset;
|
||||
|
||||
/**
|
||||
* SMTP settings handling preset
|
||||
* @internal only to be used within EXT:install
|
||||
*/
|
||||
class SmtpPreset extends AbstractPreset
|
||||
{
|
||||
/**
|
||||
* @var string Name of preset
|
||||
*/
|
||||
protected $name = 'Smtp';
|
||||
|
||||
/**
|
||||
* @var int Priority of preset
|
||||
*/
|
||||
protected $priority = 40;
|
||||
|
||||
/**
|
||||
* @var array Configuration values handled by this preset
|
||||
*/
|
||||
protected $configurationValues = [
|
||||
'MAIL/transport' => 'smtp',
|
||||
'MAIL/transport_sendmail_command' => '',
|
||||
'MAIL/transport_smtp_server' => 'localhost:25',
|
||||
'MAIL/transport_smtp_encrypt' => '',
|
||||
'MAIL/transport_smtp_username' => '',
|
||||
'MAIL/transport_smtp_password' => '',
|
||||
];
|
||||
|
||||
/**
|
||||
* Get configuration values to activate prefix
|
||||
*
|
||||
* @return array Configuration values needed to activate prefix
|
||||
*/
|
||||
public function getConfigurationValues()
|
||||
{
|
||||
$configurationValues = $this->configurationValues;
|
||||
$keys = array_keys($configurationValues);
|
||||
foreach ($keys as $key) {
|
||||
if (!empty($this->postValues['Smtp'][$key])) {
|
||||
$configurationValues[$key] = $this->postValues['Smtp'][$key];
|
||||
}
|
||||
}
|
||||
if (($this->postValues['Mail']['enable'] ?? '') === 'Smtp') {
|
||||
$configurationValues['MAIL/transport'] = 'smtp';
|
||||
}
|
||||
return $configurationValues;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if sendmail path if set
|
||||
*
|
||||
* @return bool TRUE if sendmail path if set
|
||||
*/
|
||||
public function isAvailable()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
namespace TYPO3\CMS\Install\Configuration\PasswordHashing;
|
||||
|
||||
use TYPO3\CMS\Core\Crypto\PasswordHashing\Argon2iPasswordHash;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use TYPO3\CMS\Install\Configuration\AbstractPreset;
|
||||
|
||||
/**
|
||||
* Preset for password hashing method "argon2i"
|
||||
* @internal only to be used within EXT:install
|
||||
*/
|
||||
class Argon2iPreset extends AbstractPreset
|
||||
{
|
||||
/**
|
||||
* @var string Name of preset
|
||||
*/
|
||||
protected $name = 'Argon2i';
|
||||
|
||||
/**
|
||||
* @var int Priority of preset
|
||||
*/
|
||||
protected $priority = 70;
|
||||
|
||||
/**
|
||||
* @var array Configuration values handled by this preset
|
||||
*/
|
||||
protected $configurationValues = [
|
||||
'BE/passwordHashing/className' => Argon2iPasswordHash::class,
|
||||
'BE/passwordHashing/options' => [],
|
||||
'FE/passwordHashing/className' => Argon2iPasswordHash::class,
|
||||
'FE/passwordHashing/options' => [],
|
||||
];
|
||||
|
||||
/**
|
||||
* Find out if Argon2i is available on this system
|
||||
*/
|
||||
public function isAvailable(): bool
|
||||
{
|
||||
return GeneralUtility::makeInstance(Argon2iPasswordHash::class)->isAvailable();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
namespace TYPO3\CMS\Install\Configuration\PasswordHashing;
|
||||
|
||||
use TYPO3\CMS\Core\Crypto\PasswordHashing\Argon2idPasswordHash;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use TYPO3\CMS\Install\Configuration\AbstractPreset;
|
||||
|
||||
/**
|
||||
* Preset for password hashing method "argon2id"
|
||||
* @internal only to be used within EXT:install
|
||||
*/
|
||||
class Argon2idPreset extends AbstractPreset
|
||||
{
|
||||
/**
|
||||
* @var string Name of preset
|
||||
*/
|
||||
protected $name = 'Argon2id';
|
||||
|
||||
/**
|
||||
* @var int Priority of preset
|
||||
*/
|
||||
protected $priority = 65;
|
||||
|
||||
/**
|
||||
* @var array Configuration values handled by this preset
|
||||
*/
|
||||
protected $configurationValues = [
|
||||
'BE/passwordHashing/className' => Argon2idPasswordHash::class,
|
||||
'BE/passwordHashing/options' => [],
|
||||
'FE/passwordHashing/className' => Argon2idPasswordHash::class,
|
||||
'FE/passwordHashing/options' => [],
|
||||
];
|
||||
|
||||
/**
|
||||
* Find out if Argon2id is available on this system
|
||||
*/
|
||||
public function isAvailable(): bool
|
||||
{
|
||||
return GeneralUtility::makeInstance(Argon2idPasswordHash::class)->isAvailable();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
namespace TYPO3\CMS\Install\Configuration\PasswordHashing;
|
||||
|
||||
use TYPO3\CMS\Core\Crypto\PasswordHashing\BcryptPasswordHash;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use TYPO3\CMS\Install\Configuration\AbstractPreset;
|
||||
|
||||
/**
|
||||
* Preset for password hashing method "bcrypt"
|
||||
* @internal only to be used within EXT:install
|
||||
*/
|
||||
class BcryptPreset extends AbstractPreset
|
||||
{
|
||||
/**
|
||||
* @var string Name of preset
|
||||
*/
|
||||
protected $name = 'Bcrypt';
|
||||
|
||||
/**
|
||||
* @var int Priority of preset
|
||||
*/
|
||||
protected $priority = 60;
|
||||
|
||||
/**
|
||||
* @var array Configuration values handled by this preset
|
||||
*/
|
||||
protected $configurationValues = [
|
||||
'BE/passwordHashing/className' => BcryptPasswordHash::class,
|
||||
'BE/passwordHashing/options' => [],
|
||||
'FE/passwordHashing/className' => BcryptPasswordHash::class,
|
||||
'FE/passwordHashing/options' => [],
|
||||
];
|
||||
|
||||
/**
|
||||
* Find out if bcrypt is available on this system
|
||||
*/
|
||||
public function isAvailable(): bool
|
||||
{
|
||||
return GeneralUtility::makeInstance(BcryptPasswordHash::class)->isAvailable();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
namespace TYPO3\CMS\Install\Configuration\PasswordHashing;
|
||||
|
||||
use TYPO3\CMS\Install\Configuration\AbstractCustomPreset;
|
||||
use TYPO3\CMS\Install\Configuration\CustomPresetInterface;
|
||||
|
||||
/**
|
||||
* Preset used if custom password hashing configuration has been applied.
|
||||
* Note this custom preset does not allow manipulation via gui, this has to be done manually.
|
||||
* This preset only find out if it is active and shows the current values.
|
||||
* @internal only to be used within EXT:install
|
||||
*/
|
||||
class CustomPreset extends AbstractCustomPreset implements CustomPresetInterface
|
||||
{
|
||||
/**
|
||||
* Get configuration values is used in fluid to show configuration options.
|
||||
* They are fetched from LocalConfiguration / DefaultConfiguration.
|
||||
*
|
||||
* They are not merged with postValues for security reasons, as
|
||||
* all options are readonly.
|
||||
*
|
||||
* @return array Current custom configuration values
|
||||
*/
|
||||
public function getConfigurationDescriptors(): array
|
||||
{
|
||||
$configurationValues = [];
|
||||
$configurationValues['BE/passwordHashing/className'] = [
|
||||
'value' => $this->configurationManager->getConfigurationValueByPath('BE/passwordHashing/className'),
|
||||
'readonly' => true,
|
||||
];
|
||||
$options = (array)$this->configurationManager->getConfigurationValueByPath('BE/passwordHashing/options');
|
||||
foreach ($options as $optionName => $optionValue) {
|
||||
$configurationValues['BE/passwordHashing/options/' . $optionName] = [
|
||||
'value' => $optionValue,
|
||||
'readonly' => true,
|
||||
];
|
||||
}
|
||||
$configurationValues['FE/passwordHashing/className'] = [
|
||||
'value' => $this->configurationManager->getConfigurationValueByPath('FE/passwordHashing/className'),
|
||||
'readonly' => true,
|
||||
];
|
||||
$options = (array)$this->configurationManager->getConfigurationValueByPath('FE/passwordHashing/options');
|
||||
foreach ($options as $optionName => $optionValue) {
|
||||
$configurationValues['FE/passwordHashing/options/' . $optionName] = [
|
||||
'value' => $optionValue,
|
||||
'readonly' => true,
|
||||
];
|
||||
}
|
||||
return $configurationValues;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
namespace TYPO3\CMS\Install\Configuration\PasswordHashing;
|
||||
|
||||
use TYPO3\CMS\Install\Configuration\AbstractFeature;
|
||||
use TYPO3\CMS\Install\Configuration\FeatureInterface;
|
||||
|
||||
/**
|
||||
* Password hashing feature detects password hashing capabilities of the system
|
||||
* @internal only to be used within EXT:install
|
||||
*/
|
||||
class PasswordHashingFeature extends AbstractFeature implements FeatureInterface
|
||||
{
|
||||
/**
|
||||
* @var string Name of feature
|
||||
*/
|
||||
protected $name = 'PasswordHashing';
|
||||
|
||||
/**
|
||||
* @var array List of preset classes
|
||||
*/
|
||||
protected $presetRegistry = [
|
||||
Argon2iPreset::class,
|
||||
Argon2idPreset::class,
|
||||
BcryptPreset::class,
|
||||
Pbkdf2Preset::class,
|
||||
PhpassPreset::class,
|
||||
CustomPreset::class,
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
namespace TYPO3\CMS\Install\Configuration\PasswordHashing;
|
||||
|
||||
use TYPO3\CMS\Core\Crypto\PasswordHashing\Pbkdf2PasswordHash;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use TYPO3\CMS\Install\Configuration\AbstractPreset;
|
||||
|
||||
/**
|
||||
* Preset for password hashing method "PBKDF2"
|
||||
* @internal only to be used within EXT:install
|
||||
*/
|
||||
class Pbkdf2Preset extends AbstractPreset
|
||||
{
|
||||
/**
|
||||
* @var string Name of preset
|
||||
*/
|
||||
protected $name = 'Pbkdf2';
|
||||
|
||||
/**
|
||||
* @var int Priority of preset
|
||||
*/
|
||||
protected $priority = 50;
|
||||
|
||||
/**
|
||||
* @var array Configuration values handled by this preset
|
||||
*/
|
||||
protected $configurationValues = [
|
||||
'BE/passwordHashing/className' => Pbkdf2PasswordHash::class,
|
||||
'BE/passwordHashing/options' => [],
|
||||
'FE/passwordHashing/className' => Pbkdf2PasswordHash::class,
|
||||
'FE/passwordHashing/options' => [],
|
||||
];
|
||||
|
||||
/**
|
||||
* Find out if PBKDF2 is available on this system
|
||||
*/
|
||||
public function isAvailable(): bool
|
||||
{
|
||||
return GeneralUtility::makeInstance(Pbkdf2PasswordHash::class)->isAvailable();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
namespace TYPO3\CMS\Install\Configuration\PasswordHashing;
|
||||
|
||||
use TYPO3\CMS\Core\Crypto\PasswordHashing\PhpassPasswordHash;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use TYPO3\CMS\Install\Configuration\AbstractPreset;
|
||||
|
||||
/**
|
||||
* Preset for password hashing method "phpass"
|
||||
* @internal only to be used within EXT:install
|
||||
*/
|
||||
class PhpassPreset extends AbstractPreset
|
||||
{
|
||||
/**
|
||||
* @var string Name of preset
|
||||
*/
|
||||
protected $name = 'Phpass';
|
||||
|
||||
/**
|
||||
* @var int Priority of preset
|
||||
*/
|
||||
protected $priority = 40;
|
||||
|
||||
/**
|
||||
* @var array Configuration values handled by this preset
|
||||
*/
|
||||
protected $configurationValues = [
|
||||
'BE/passwordHashing/className' => PhpassPasswordHash::class,
|
||||
'BE/passwordHashing/options' => [],
|
||||
'FE/passwordHashing/className' => PhpassPasswordHash::class,
|
||||
'FE/passwordHashing/options' => [],
|
||||
];
|
||||
|
||||
/**
|
||||
* Find out if Phpass is available on this system
|
||||
*/
|
||||
public function isAvailable(): bool
|
||||
{
|
||||
return GeneralUtility::makeInstance(PhpassPasswordHash::class)->isAvailable();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
namespace TYPO3\CMS\Install\Configuration;
|
||||
|
||||
/**
|
||||
* 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 bool TRUE if preset is available
|
||||
*/
|
||||
public function isAvailable();
|
||||
|
||||
/**
|
||||
* Wrapper for isAvailable, used in fluid
|
||||
*
|
||||
* @return bool TRUE if preset is available
|
||||
*/
|
||||
public function getIsAvailable();
|
||||
|
||||
/**
|
||||
* Check is preset is currently active on the system
|
||||
*
|
||||
* @return bool TRUE if preset is active
|
||||
*/
|
||||
public function isActive();
|
||||
|
||||
/**
|
||||
* Wrapper for isActive, used in fluid
|
||||
*
|
||||
* @return bool TRUE if preset is active
|
||||
*/
|
||||
public function getIsActive();
|
||||
|
||||
/**
|
||||
* Get name of preset
|
||||
*
|
||||
* @return string Name
|
||||
*/
|
||||
public function getName();
|
||||
|
||||
/**
|
||||
* Get priority of preset
|
||||
*
|
||||
* @return int 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();
|
||||
}
|
||||
Reference in New Issue
Block a user