From 3634007848d7f2c48c9d33a60108107fd40d2aef Mon Sep 17 00:00:00 2001 From: Thomas Hohn <thomas@hohn.dk> Date: Fri, 3 Mar 2023 06:26:38 +0100 Subject: [PATCH] [TASK] Streamline logging in method TSFE->set_no_cache The logging in the method set_no_cache should not depend on the calling parameter $internal. Instead it should be notice in both cases. Since it's possible to change the general log level during development or debugging the entries will still be visible, just not on production systems which makes good sense. In addition the variable $internal was renamed to $internalRequest in order to make the purpose clearer. Resolves: #100067 Related: #97815 Releases: main, 11.5 Change-Id: I59af542e22c2a6ad65ad42e0fc3d2c64f0408f76 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/78122 Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch> Tested-by: Christian Kuhn <lolli@schwarzbu.ch> Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de> --- .../Controller/TypoScriptFrontendController.php | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php b/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php index a32ebad491b2..04a94d4e3ca6 100644 --- a/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php +++ b/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php @@ -3174,9 +3174,9 @@ class TypoScriptFrontendController implements LoggerAwareInterface * Sets the cache-flag to 1. Could be called from user-included php-files in order to ensure that a page is not cached. * * @param string $reason An optional reason to be written to the log. - * @param bool $internal Whether the call is done from core itself (should only be used by core). + * @param bool $internalRequest Whether the request is internal or not (true should only be used by core calls). */ - public function set_no_cache($reason = '', $internal = false) + public function set_no_cache($reason = '', $internalRequest = false) { $context = []; if ($reason !== '') { @@ -3196,18 +3196,14 @@ class TypoScriptFrontendController implements LoggerAwareInterface $context['file'] = $file; $context['line'] = $trace[0]['line']; } - if (!$internal && $GLOBALS['TYPO3_CONF_VARS']['FE']['disableNoCacheParameter']) { + if (!$internalRequest && $GLOBALS['TYPO3_CONF_VARS']['FE']['disableNoCacheParameter']) { $warning .= ' However, $TYPO3_CONF_VARS[\'FE\'][\'disableNoCacheParameter\'] is set, so it will be ignored!'; - $this->getTimeTracker()->setTSlogMessage($warning, LogLevel::WARNING); + $this->getTimeTracker()->setTSlogMessage($warning, LogLevel::NOTICE); } else { $warning .= ' Caching is disabled!'; $this->disableCache(); } - if ($internal && ($this->isBackendUserLoggedIn() || $this->isInPreviewMode())) { - $this->logger->notice($warning, $context); - } else { - $this->logger->warning($warning, $context); - } + $this->logger->notice($warning, $context); } /** -- GitLab