Added check if cache is valid, points_data is only available with recent ext-sql_patc...
authorRoland Häder <roland@mxchange.org>
Tue, 9 Aug 2011 17:35:33 +0000 (17:35 +0000)
committerRoland Häder <roland@mxchange.org>
Tue, 9 Aug 2011 17:35:33 +0000 (17:35 +0000)
inc/loader/load-modules.php
inc/loader/load-points_data.php

index e9ae70acdf3ace224dd5933fc0ccb84ddf9efbf4..727844519641170dab8f5918a1a53c8c3308f209 100644 (file)
@@ -53,8 +53,11 @@ if (($GLOBALS['cache_instance']->loadCacheFile('modules')) && ($GLOBALS['cache_i
 
        // Do only process valid arrays
        if (!isset($modArray['module'])) {
-               // We should fix this!
-               debug_report_bug(__FILE__, __LINE__, 'modArray=<pre>'.print_r($modArray, true).'</pre>');
+               // Try to remove the cache file
+               $GLOBALS['cache_instance']->removeCacheFile();
+
+               // We should fix this
+               debug_report_bug(__FILE__, __LINE__, 'modArray=<pre>' . print_r($modArray, true) . '</pre>Please try to reload to fix this.');
        } // END - if
 
        // Rewrite some parts
index 744b616ba7103ccf18e5bdf7894e7704b7511136..659b3fed1c31c108cc9451bb48d53f82f52eb317 100644 (file)
@@ -48,6 +48,15 @@ if (($GLOBALS['cache_instance']->loadCacheFile('points_data')) && ($GLOBALS['cac
        // Load cache
        $GLOBALS['cache_array']['points_data'] = $GLOBALS['cache_instance']->getArrayFromCache();
 
+       // Do we have cache?
+       if (!isset($GLOBALS['cache_array']['points_data']['subject'])) {
+               // Try to remove the cache file
+               $GLOBALS['cache_instance']->removeCacheFile();
+
+               // Not found, so better abort here
+               debug_report_bug(__FILE__, __LINE__, 'points_data has been generated, but does not contain "subject". Please try to reload to fix this.');
+       } // END - if
+
        // Init temporary array
        $pointsData = array();
 
@@ -66,7 +75,7 @@ if (($GLOBALS['cache_instance']->loadCacheFile('points_data')) && ($GLOBALS['cac
        // Set the array back and remove temporary
        $GLOBALS['cache_array']['points_data'] = $pointsData;
        unset($pointsData);
-} elseif (isHtmlOutputMode()) {
+} elseif ((isHtmlOutputMode()) && (isExtensionInstalledAndNewer('sql_patches', '0.8.0'))) {
        // Create cache file
        $GLOBALS['cache_instance']->init();