Bug #38146
closedExternal file concatenation takes place on every page request
0%
Description
If concatenateJs/Css=1 is enabled external files will get downloaded on every page request. This is unnecessary and reduces speed.
// t3lib/class.t3lib_compressor.php protected function retrieveExternalFile($url) { $filename = $this->targetDirectory . 'external-' . md5($url); $externalContent = t3lib_div::getUrl($url); t3lib_div::writeFile(PATH_site . $filename, $externalContent); return $filename; }
The main problem is that concatenation will not work as expected because the modified timestamp of all files is used to generate an unique md5 hash as identifier. On every page request these external files will get downloaded and hence they will get a new creation date / modified date. That's the reason why the concatenation hash differs and a new merged file is created for every request.
// t3lib/class.t3lib_compressor.php -> createMergedFile ... // we add up the filenames, filemtimes and filsizes to later build a checksum over // it and include it in the temporary file name $unique = ''; foreach ($filesToInclude as $key => $filename) { if (t3lib_div::isValidUrl($filename)) { $filesToInclude[$key] = $this->retrieveExternalFile($filename); $filename = $filesToInclude[$key]; } $filepath = t3lib_div::resolveBackPath($this->rootPath . $filename); $unique .= $filename . filemtime($filepath) . filesize($filepath); }
In best case these external files will only get downloaded after a clear cache command, that would fix the creation date problem and a will allow browser caching.
This issue is a follow up to http://forge.typo3.org/issues/29695 and the appropriate review https://review.typo3.org/#/c/4924/1/t3lib/class.t3lib_compressor.php
Updated by Frans Saris almost 10 years ago
- Status changed from New to Needs Feedback
- Is Regression set to No
Is this still an issue. The functionality of retrieveExternalFile() has been adjusted in the meanwhile.
Updated by Alexander Opitz over 9 years ago
- Status changed from Needs Feedback to Closed
No feedback within the last 90 days => closing this issue.
If you think that this is the wrong decision or experience this issue again, then please write to the mailing list typo3.teams.bugs with issue number and an explanation or open a new ticket and add a relation to this ticket number.