[BUGFIX] Also check if cache files are not empty
authorJigal van Hemert <jigal@xs4all.nl>
Thu, 18 Aug 2011 21:23:10 +0000 (23:23 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sat, 20 Aug 2011 09:53:49 +0000 (11:53 +0200)
If the temp_CACHED* files exist, but they are empty a lot of functions
produce incorrect result due to missing TCA data. Checking the fileSize
prevents the use of empty cache files.

Change-Id: I855034048eca142153badd2567fb2bf6dfbc2629
Resolves: #29075
Branches: 4.6, 4.5, 4.4, 4.3
Reviewed-on: http://review.typo3.org/4420
Reviewed-by: Björn Pedersen
Reviewed-by: Susanne Moog
Tested-by: Susanne Moog
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
t3lib/class.t3lib_extmgm.php

index 3956af1..540557b 100644 (file)
@@ -1507,17 +1507,17 @@ $_EXTCONF = $GLOBALS[\'TYPO3_CONF_VARS\'][\'EXT\'][\'extConf\'][$_EXTKEY];
        }
 
        /**
-        * Returns TRUE if both the localconf and tables cache file exists (with $cacheFilePrefix)
-        * Usage: 2
+        * Returns TRUE if both the localconf and tables cache file exists (with $cacheFilePrefix) and if they are not empty
         *
-        * @param       string          Prefix of the cache file to check
-        * @return      boolean
-        * @internal
+        * @param $cacheFilePrefix string Prefix of the cache file to check
+        * @return boolean
         */
        public static function isCacheFilesAvailable($cacheFilePrefix) {
                return
-                               @is_file(PATH_typo3conf . $cacheFilePrefix . '_ext_localconf.php') &&
-                                               @is_file(PATH_typo3conf . $cacheFilePrefix . '_ext_tables.php');
+                       @is_file(PATH_typo3conf . $cacheFilePrefix . '_ext_localconf.php') &&
+                               @is_file(PATH_typo3conf . $cacheFilePrefix . '_ext_tables.php') &&
+                               @filesize(PATH_typo3conf . $cacheFilePrefix . '_ext_localconf.php') > 0 &&
+                               @filesize(PATH_typo3conf . $cacheFilePrefix . '_ext_tables.php') > 0;
        }
 
        /**