Skip to content

Commit

Permalink
Merge pull request #14 from b13/multiple-hash-parameters
Browse files Browse the repository at this point in the history
[FEATURE] Add logic to exclude multiple hash parameters
  • Loading branch information
bmack authored Mar 20, 2024
2 parents f5addfd + 12f9029 commit edf0b4d
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 14 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
"classmap": ["src/"]
},
"require-dev": {
"typo3/coding-standards": "^0.4.0"
"typo3/coding-standards": "^0.6"
}
}
4 changes: 2 additions & 2 deletions examples/extended/AdditionalConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ public function configureCustomLoggingForSomething(string $fileName = 'something
$GLOBALS['TYPO3_CONF_VARS']['LOG']['MyVendor']['MyPath']['writerConfiguration'] = [
$logLevel => [
\TYPO3\CMS\Core\Log\Writer\FileWriter::class => [
'logFile' => $this->varPath . '/log/' . $fileName
]
'logFile' => $this->varPath . '/log/' . $fileName,
],
],
];
return $this;
Expand Down
40 changes: 29 additions & 11 deletions src/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,16 +168,16 @@ public function useProductionPreset(): self
$GLOBALS['TYPO3_CONF_VARS']['LOG']['writerConfiguration'] = array_replace_recursive(
[
LogLevel::DEBUG => [
FileWriter::class => ['disabled' => true]
FileWriter::class => ['disabled' => true],
],
LogLevel::INFO => [
FileWriter::class => ['disabled' => true]
FileWriter::class => ['disabled' => true],
],
LogLevel::WARNING => [
FileWriter::class => ['disabled' => true]
FileWriter::class => ['disabled' => true],
],
LogLevel::ERROR => [
FileWriter::class => ['disabled' => false]
FileWriter::class => ['disabled' => false],
],
],
$GLOBALS['TYPO3_CONF_VARS']['LOG']['writerConfiguration']
Expand All @@ -196,7 +196,7 @@ public function useDevelopmentPreset(): self
$this->enableDeprecationLogging();
// Log warnings to files
$GLOBALS['TYPO3_CONF_VARS']['LOG']['writerConfiguration'][LogLevel::WARNING] = [
FileWriter::class => ['disabled' => false]
FileWriter::class => ['disabled' => false],
];
return $this;
}
Expand All @@ -218,7 +218,7 @@ public function useDDEVConfiguration(string $dbHost = null): self

$mailhogSmtpBindAddr = getenv('MH_SMTP_BIND_ADDR');
if (is_string($mailhogSmtpBindAddr) && $mailhogSmtpBindAddr !== '') {
$this->useMailhog($mailhogSmtpBindAddr);
$this->useMailpit($mailhogSmtpBindAddr);
}

return $this;
Expand All @@ -240,7 +240,7 @@ public function useGraphicsMagick(string $path = '/usr/bin/'): self
return $this;
}

public function useMailhog(string $host = 'localhost', int $port = null): self
public function useMailpit(string $host = 'localhost', int $port = null): self
{
$GLOBALS['TYPO3_CONF_VARS']['MAIL']['transport'] = 'smtp';
$GLOBALS['TYPO3_CONF_VARS']['MAIL']['transport_smtp_encrypt'] = '';
Expand All @@ -250,6 +250,11 @@ public function useMailhog(string $host = 'localhost', int $port = null): self
return $this;
}

public function useMailhog(string $host = 'localhost', int $port = null): self
{
return $this->useMailpit($host, $port);
}

public function allowNoCacheQueryParameter(): self
{
$GLOBALS['TYPO3_CONF_VARS']['FE']['disableNoCacheParameter'] = false;
Expand Down Expand Up @@ -280,6 +285,15 @@ public function excludeQueryParameterForCacheHashCalculation(string $queryParame
return $this;
}

public function excludeQueryParametersForCacheHashCalculation(array $queryParameters): self
{
$GLOBALS['TYPO3_CONF_VARS']['FE']['cacheHash']['excludedParameters'] = array_merge(
$GLOBALS['TYPO3_CONF_VARS']['FE']['cacheHash']['excludedParameters'],
$queryParameters
);
return $this;
}

public function enableDeprecationLogging(): self
{
$GLOBALS['TYPO3_CONF_VARS']['LOG']['TYPO3']['CMS']['deprecations']['writerConfiguration'][LogLevel::NOTICE]['TYPO3\CMS\Core\Log\Writer\FileWriter']['disabled'] = false;
Expand Down Expand Up @@ -319,8 +333,8 @@ public function autoconfigureSolrLogging(string $fileName = 'solr.log', string $
$GLOBALS['TYPO3_CONF_VARS']['LOG']['ApacheSolrForTypo3']['Solr']['writerConfiguration'] = [
$logLevel => [
FileWriter::class => [
'logFile' => $this->varPath . '/log/' . $fileName
]
'logFile' => $this->varPath . '/log/' . $fileName,
],
],
];
return $this;
Expand All @@ -339,6 +353,7 @@ public function autoconfigureSolrLogging(string $fileName = 'solr.log', string $
public function initializeRedisCaching(array $caches = null, string $redisHost = '127.0.0.1', int $redisStartDb = 0, int $redisPort = 6379, $alternativeCacheBackend = null): self
{
$isVersion9 = $this->version->getMajorVersion() === 9;
$isVersion12OrHigher = $this->version->getMajorVersion() >= 12;
$cacheBackend = $alternativeCacheBackend ?? RedisBackend::class;
$redisDb = $redisStartDb;
$caches = $caches ?? [
Expand All @@ -348,13 +363,16 @@ public function initializeRedisCaching(array $caches = null, string $redisHost =
($isVersion9 ? 'cache_rootline' : 'rootline') => 86400*30,
($isVersion9 ? 'cache_extbase' : 'extbase') => 0,
];
if ($isVersion12OrHigher) {
unset($caches['pagesection'], $caches['cache_pagesection']);
}
foreach ($caches as $key => $lifetime) {
$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'][$key]['backend'] = $cacheBackend;
$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'][$key]['options'] = [
'database' => $redisDb++,
'hostname' => $redisHost,
'port' => $redisPort,
'defaultLifetime' => $lifetime
'defaultLifetime' => $lifetime,
];
}
return $this;
Expand All @@ -373,7 +391,7 @@ public function setAlternativeCachePath(string $path, array $applyForCaches = nu
'cache_core',
'fluid_template',
'assets',
'l10n'
'l10n',
];
foreach ($applyForCaches as $cacheName) {
$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'][$cacheName]['options']['cacheDirectory'] = $path;
Expand Down

0 comments on commit edf0b4d

Please sign in to comment.