[BUGFIX] Use PATH_site in cache identifier for package cache 65/31565/5
authorHelmut Hummel <helmut.hummel@typo3.org>
Thu, 10 Jul 2014 16:10:10 +0000 (18:10 +0200)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Thu, 10 Jul 2014 20:56:28 +0000 (22:56 +0200)
The package cache writes paths to extension directories
(TYPO3_LOADED_EXT) into the cache.

This will result in wrong caches when the same
TYPO3 instance is called from a different absolute
directory e.g. from a different mount or symlink.

To avoid this, the cache identifier now includes
PATH_site which is the current absolute path
of the TYPO3 instance.

Additionally we now only include the modification
time of the package states file instead of the
md5 of the complete content into account, which should
be much faster and also enough.

Resolves: #58288
Releases: 6.2, 6.3
Change-Id: I7c8de41c608beab282f2b8bbeab39f257a9a6a6f
Reviewed-on: https://review.typo3.org/31565
Reviewed-by: Markus Klein
Tested-by: Markus Klein
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind
typo3/sysext/core/Classes/Package/PackageManager.php

index fb713d1..dfe8861 100644 (file)
@@ -184,8 +184,9 @@ class PackageManager extends \TYPO3\Flow\Package\PackageManager implements \TYPO
         */
        protected function getCacheIdentifier() {
                if ($this->cacheIdentifier === NULL) {
-                       if (@file_exists($this->packageStatesPathAndFilename)) {
-                               $this->cacheIdentifier = md5_file($this->packageStatesPathAndFilename);
+                       $mTime = @filemtime($this->packageStatesPathAndFilename);
+                       if ($mTime !== FALSE) {
+                               $this->cacheIdentifier = md5($this->packageStatesPathAndFilename . $mTime);
                        } else {
                                $this->cacheIdentifier = NULL;
                        }