Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enetcache does not respect global cache_period #6

Closed
ffh-webadmin opened this issue Jan 10, 2020 · 1 comment
Closed

enetcache does not respect global cache_period #6

ffh-webadmin opened this issue Jan 10, 2020 · 1 comment

Comments

@ffh-webadmin
Copy link

ffh-webadmin commented Jan 10, 2020

setCachePageLifetime() has a small bug. If a page has no cache_timeout (=0), Typo3 will use the global cache ttl defined via TS in config.cache_period.

But the function will ignore this value and set the ttl of the page to the lifetime of enetcache, which could be to long.

Example:
config.cache_period = 60
Page TTL = 0
EnetCache TTL = 1800

This will result in a TTL of 1800 for the whole page instead of 60.

Fix:

if (!$GLOBALS['TSFE']->page['cache_timeout']) {
// No cache timeout was set yet.
// This would cause min to always return 0 so we filter it out.
$GLOBALS['TSFE']->page['cache_timeout'] = min($lifetime, $GLOBALS['TSFE']->config['config']['cache_period']);
}

$GLOBALS['TSFE']->config['config']['cache_period'] is added to the if()

@lolli42
Copy link
Owner

lolli42 commented Feb 12, 2021

Thx! I refactored the method slightly and hope the issue is fixed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants