Skip to content

Commit

Permalink
Prepare supporting TYPO3 v13
Browse files Browse the repository at this point in the history
  • Loading branch information
christophlehmann committed Oct 20, 2024
1 parent 785883c commit 7a3b5b9
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 20 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/Test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@ jobs:
strategy:
fail-fast: false
matrix:
typo3: [ '^11.5.0', '^12.4.0' ]
typo3: [ '^11.5.0', '^12.4.0', '^13.4.0' ]
php: [ '8.1', '8.2', '8.3' ]
dependency-version: [ lowest, stable ]
experimental: [ false ]
exclude:
- typo3: '^13.4.0'
php: '8.1'

continue-on-error: ${{ matrix.experimental }}

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"symfony/console": "^5.4 || ^6.4 || ^7.0",
"symfony/yaml": "^5.4 || ^6.4 || ^7.0",
"typo3/cms-composer-installers": "^4.0@rc || >=5.0",
"typo3/cms-core": "^11.5.20 || ^12.4",
"typo3/cms-core": "^11.5.20 || ^12.4 || ^13.4",
"composer-runtime-api": "^2.2",
"symfony/polyfill-php80": "^1.23.1"
},
Expand Down
4 changes: 2 additions & 2 deletions src/Composer/InstallerScript/DumpSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ private function generateLocalConfigurationFile(ScriptEvent $event): bool
$fileSystem = new Filesystem();
$fileSystem->ensureDirectoryExists(getenv('TYPO3_PATH_APP') . '/config');
$fileSystem->ensureDirectoryExists(getenv('TYPO3_PATH_APP') . '/var/cache/code');
if ($this->isMajorVersionTwelve($event->getComposer())) {
if ($this->isMajorVersionTwelveOrHigher($event->getComposer())) {
$systemConfigurationFile = getenv('TYPO3_PATH_APP') . '/config/system/settings.php';
$fileSystem->ensureDirectoryExists(getenv('TYPO3_PATH_APP') . '/config/system');
} else {
Expand Down Expand Up @@ -100,7 +100,7 @@ private function generateLocalConfigurationFile(ScriptEvent $event): bool
) > 0;
}

private function isMajorVersionTwelve(Composer $composer): bool
private function isMajorVersionTwelveOrHigher(Composer $composer): bool
{
$repository = $composer->getRepositoryManager()->getLocalRepository();
$corePackage = $repository->findPackage('typo3/cms-core', '*');
Expand Down
3 changes: 3 additions & 0 deletions src/Typo3SiteConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@

class Typo3SiteConfiguration extends SiteConfiguration
{
protected $configFileName = 'config.yaml';
protected $cacheIdentifier = 'sites-configuration';

/**
* Load plain configuration
* This method should only be used in case the original configuration as it exists in the file should be loaded,
Expand Down
30 changes: 14 additions & 16 deletions src/Xclass/ConfigurationManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,13 @@
*
* This class handles the access to the files
* - EXT:core/Configuration/DefaultConfiguration.php (default TYPO3_CONF_VARS)
* - typo3conf/LocalConfiguration.php (overrides of TYPO3_CONF_VARS)
* - typo3conf/AdditionalConfiguration.php (optional additional local code blocks)
* - config/system/settings.php or typo3conf/system/settings.php - previously known as LocalConfiguration.php
* - config/system/additional.php or typo3conf/system/additional.php (optional additional code blocks) - previously known as typo3conf/AdditionalConfiguration.php
*
* IMPORTANT:
* This class is intended for internal core use ONLY.
* Extensions should usually use the resulting $GLOBALS['TYPO3_CONF_VARS'] array,
* do not try to modify settings in LocalConfiguration.php with an extension.
*
* do not try to modify settings in the config/system/settings.php file with an extension.
* @internal
*/
class ConfigurationManager
Expand Down Expand Up @@ -130,7 +129,7 @@ class ConfigurationManager
*
* @var array
*/
protected $whiteListedLocalConfigurationPaths = [
protected array $allowedSettingsPaths = [
'EXTCONF',
'DB',
'SYS/caching/cacheConfigurations',
Expand Down Expand Up @@ -190,7 +189,8 @@ public function getDefaultConfigurationDescriptionFileLocation()
}

/**
* Return local configuration array typo3conf/LocalConfiguration.php
* Return configuration array of typo3conf/system/settings.php or config/system/settings.php, falls back
* to typo3conf/LocalConfiguration.php
*
* @return array Content array of local configuration file
*/
Expand Down Expand Up @@ -466,7 +466,7 @@ public function enableFeature(string $featureName): bool
}

/**
* Disables a feature and writes the option to LocalConfiguration.php
* Disables a feature and writes the option to system/settings.php
* Short-hand method
* Warning: TO BE USED ONLY to disable a single feature.
* NOT TO BE USED within iterations to disable multiple features.
Expand Down Expand Up @@ -509,7 +509,7 @@ public function exportConfiguration()
}

/**
* Write local configuration array to typo3conf/LocalConfiguration.php
* Write configuration array to %config-dir%/system/settings.php
*
* @param array $configuration The local configuration to be written
*
Expand All @@ -529,7 +529,7 @@ public function writeLocalConfiguration(array $configuration)
}

/**
* Write additional configuration array to typo3conf/AdditionalConfiguration.php
* Write additional configuration array to config/system/additional.php / typo3conf/system/additional.php
*
* @param array $additionalConfigurationLines The configuration lines to be written
*
Expand All @@ -549,18 +549,17 @@ public function writeAdditionalConfiguration(array $additionalConfigurationLines

/**
* Uses FactoryConfiguration file and a possible AdditionalFactoryConfiguration
* file in typo3conf to create a basic LocalConfiguration.php. This is used
* by the install tool in an early step.
* file in typo3conf to create a basic config/system/settings.php. This is used
* by the installer in an early step.
*
* @throws \RuntimeException
*
* @internal
*/
public function createLocalConfigurationFromFactoryConfiguration()
{
if (file_exists($this->getLocalConfigurationFileLocation())) {
throw new \RuntimeException(
'LocalConfiguration.php exists already',
basename($this->getSystemConfigurationFileLocation(true)) . ' already exists',
1364836026
);
}
Expand All @@ -583,14 +582,13 @@ public function createLocalConfigurationFromFactoryConfiguration()
* Check if access / write to given path in local configuration is allowed.
*
* @param string $path Path to search for
*
* @return bool TRUE if access is allowed
*/
protected function isValidLocalConfigurationPath($path)
{
// Early return for white listed paths
foreach ($this->whiteListedLocalConfigurationPaths as $whiteListedPath) {
if (str_starts_with($path, $whiteListedPath)) {
foreach ($this->allowedSettingsPaths as $allowedSettingsPath) {
if (str_starts_with($path, $allowedSettingsPath)) {
return true;
}
}
Expand Down

0 comments on commit 7a3b5b9

Please sign in to comment.