Files
typo3-13/config/system/additional.php
T
frommeandClaude Opus 5.5 8302214657 feat: ICO and web manifest files can be uploaded to fileadmin
TYPO3 13 only accepts uploads whose extension is in textfile_ext,
mediafile_ext or miscfile_ext (security.system.enforceAllowedFileExtensions),
so the favicon.ico and site.webmanifest of a realfavicongenerator set were
rejected ("Resource consistency check failed"). Both are appended to
miscfile_ext in additional.php, which is deployed with the code;
settings.php, which production leads, stays untouched.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-25 17:34:20 +01:00

121 lines
5.1 KiB
PHP

<?php
// Maintained in Git (taken over from DDEV's generated file): DDEV settings locally, secrets
// from secrets.php everywhere. Empty secret values leave settings.php untouched.
if (getenv('IS_DDEV_PROJECT') == 'true') {
$GLOBALS['TYPO3_CONF_VARS'] = array_replace_recursive(
$GLOBALS['TYPO3_CONF_VARS'],
[
'DB' => [
'Connections' => [
'Default' => [
'dbname' => 'db',
'driver' => 'mysqli',
'host' => 'db',
'password' => 'db',
'port' => '3306',
'user' => 'db',
],
],
],
// This GFX configuration allows processing by installed ImageMagick 6
'GFX' => [
'processor' => 'ImageMagick',
'processor_path' => '/usr/bin/',
'processor_path_lzw' => '/usr/bin/',
],
// This mail configuration sends all emails to mailpit
'MAIL' => [
'transport' => 'smtp',
'transport_smtp_encrypt' => false,
'transport_smtp_server' => 'localhost:1025',
],
'SYS' => [
'trustedHostsPattern' => '.*.*',
'devIPmask' => '*',
'displayErrors' => 1,
// Warnings are exceptions locally: they are how PHP 7.4 leftovers show up. Deprecations
// are not (production neither): PHP 8.5 deprecations in vendor code, e.g. EXT:form's
// RenderFormValueViewHelper, would break requests that work in production. They are
// still written to the deprecation log.
'exceptionalErrors' => E_WARNING | E_RECOVERABLE_ERROR,
],
'BE' => [
'debug' => true,
],
'FE' => [
'debug' => true,
],
'LOG' => [
'TYPO3' => [
'CMS' => [
'deprecations' => [
'writerConfiguration' => [
'notice' => [
\TYPO3\CMS\Core\Log\Writer\FileWriter::class => ['disabled' => false],
],
],
],
],
],
],
]
);
}
// Redis caches as on TYPO3 10, but in databases 3-5: 0-2 may still hold TYPO3 10 entries. Without a
// connection the backend only logs an alert and every lookup is a miss, so pages still render.
$redisOptions = getenv('IS_DDEV_PROJECT') == 'true'
? ['hostname' => 'redis', 'port' => 6379]
: ['hostname' => '/run/redis_eptypo3/redis.sock', 'port' => 0];
$redisOptions['connectionTimeout'] = 2;
// These replace the definitions from settings.php wholesale, so 'groups' and the compression and
// lifetime options have to be repeated here. Each cache has its own database: RedisBackend::flush()
// issues FLUSHDB.
$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['pages'] = [
'frontend' => \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend::class,
'backend' => \TYPO3\CMS\Core\Cache\Backend\RedisBackend::class,
'options' => $redisOptions + ['database' => 3, 'compression' => true],
'groups' => ['pages'],
];
$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['hash'] = [
'frontend' => \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend::class,
'backend' => \TYPO3\CMS\Core\Cache\Backend\RedisBackend::class,
'options' => $redisOptions + ['database' => 4],
'groups' => ['pages'],
];
$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['rootline'] = [
'frontend' => \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend::class,
'backend' => \TYPO3\CMS\Core\Cache\Backend\RedisBackend::class,
'options' => $redisOptions + ['database' => 5, 'compression' => true, 'defaultLifetime' => 2592000],
'groups' => ['pages'],
];
unset($redisOptions);
// Favicon sets from realfavicongenerator.net (fileadmin/user_upload/favicon/<site>/) contain an ICO
// and a web manifest, which TYPO3 13 rejects on upload unless an extension list allows them
$GLOBALS['TYPO3_CONF_VARS']['SYS']['miscfile_ext'] .= ',ico,webmanifest';
// Deployer creates an empty secrets.php if none exists yet: only an array counts
$secrets = is_file(__DIR__ . '/secrets.php') ? require __DIR__ . '/secrets.php' : null;
if (is_array($secrets)) {
$withoutEmptyValues = static function (array $values) use (&$withoutEmptyValues): array {
foreach ($values as $key => $value) {
if (is_array($value)) {
$values[$key] = $withoutEmptyValues($value);
} elseif ($value === '' || $value === null) {
unset($values[$key]);
}
}
return $values;
};
$GLOBALS['TYPO3_CONF_VARS'] = array_replace_recursive(
$GLOBALS['TYPO3_CONF_VARS'],
$withoutEmptyValues($secrets)
);
unset($withoutEmptyValues);
}
unset($secrets);