Conversation
@@ -251,7 +251,7 @@ protected function addToCache() | |||
$strHeader = sprintf | |||
( | |||
"<?php /* %s */ \$expire = %d; \$content = %s; \$type = %s; \$files = %s; \$assets = %s; ?>\n", | |||
$strCacheKey, | |||
ltrim($strCacheKey, '*'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to comment on why this is necessary: when the cache key starts with *
, the resulting PHP header of the cache file would look like this:
<?php /* */empty.de */ $expire = 1494230344; $content = 'text/html'; $type = 'regular'; $files = ''; $assets = ''; ?>
This is invalid PHP syntax of course, thus I simply remove the *
for the header.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about "<?php\n\n// %s\n\$expire = %d;\n\$content = %s;\n\$type = %s;\n\$files = %s;\n\$assets = %s;\n\n?>\n"
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, that would work too :).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have changed it now.
@@ -213,7 +213,7 @@ protected function addToCache() | |||
// If the request string is empty, use a special cache tag which considers the page language | |||
if (\Environment::get('request') == '' || \Environment::get('request') == 'index.php') | |||
{ | |||
$strCacheKey = \Environment::get('host') . '/empty.' . $objPage->language; | |||
$strCacheKey = ($objPage->domain ?: '*') . '/empty.' . $objPage->language; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be $objPage->dns
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, $objPage->dns
is only available for root
pages. For other pages this information is available in ->domain
. See system/modules/core/models/PageModel.php#L868
@@ -251,7 +251,7 @@ protected function addToCache() | |||
$strHeader = sprintf | |||
( | |||
"<?php /* %s */ \$expire = %d; \$content = %s; \$type = %s; \$files = %s; \$assets = %s; ?>\n", | |||
$strCacheKey, | |||
ltrim($strCacheKey, '*'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about "<?php\n\n// %s\n\$expire = %d;\n\$content = %s;\n\$type = %s;\n\$files = %s;\n\$assets = %s;\n\n?>\n"
instead?
This fixes #8694.
Explanation:
Automator
uses$objPages->dns ?: '*'
here for creating the mappings of the empty request cache key.FrontendTemplate::addToCache
never actually uses*
when creating the cache key (for the empty request), see here. Thus the cache key for the empty request will always beexample.org/empty…
.FrontendIndex::outputFromCache
never actually finds a cache entry for the empty request here since it will always be looking for*/empty…
due to the mapping (if no DNS setting was made in the root page).Note: if the internal cache is not in use or created, then this Problem still remains.