Project

General

Profile

Actions

Bug #38146

closed

External file concatenation takes place on every page request

Added by Björn Schmitt almost 12 years ago. Updated almost 9 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2012-06-18
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
4.7
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

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


Related issues 1 (0 open1 closed)

Follows TYPO3 Core - Bug #29695: t3lib_Compressor fails with external filesClosedXavier Perseguers2011-09-12

Actions
Actions #1

Updated by Frans Saris over 9 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.

Actions #2

Updated by Alexander Opitz almost 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.

Actions

Also available in: Atom PDF