]> git.mxchange.org Git - mailer.git/blobdiff - inc/load_extensions.php
More fixes applied from profi-conecpt, cache system rewritten: now all cache files...
[mailer.git] / inc / load_extensions.php
index e7d7e0b9003cff8fa6f04f65c7041bcee1d1e2db..87f1179fb1e3d431d2e58342842f350b4c80184b 100644 (file)
@@ -64,7 +64,7 @@ if (EXT_IS_ACTIVE("cache")) {
        include_once(PATH."inc/libs/cache_functions.php");
        $cacheMode = "";
        include_once(PATH."inc/extensions/ext-cache.php");
        include_once(PATH."inc/libs/cache_functions.php");
        $cacheMode = "";
        include_once(PATH."inc/extensions/ext-cache.php");
-       switch($cacheInstance->cache_file("extensions", true)) {
+       switch (($cacheInstance->cache_file("extensions", true)) && ($cacheInstance->ext_version_matches("sql_patches"))) {
                case true : $cacheMode = "load"; break;
                case false: $cacheMode = "init"; break;
        }
                case true : $cacheMode = "load"; break;
                case false: $cacheMode = "init"; break;
        }
@@ -75,6 +75,7 @@ if (EXT_IS_ACTIVE("cache")) {
        if ($cacheMode == "init") {
                // Init cache file
                $cacheInstance->cache_init("EXTENSIONS");
        if ($cacheMode == "init") {
                // Init cache file
                $cacheInstance->cache_init("EXTENSIONS");
+               $cacheInstance->store_extension_version("sql_patches");
 
                if ($_CONFIG['cache_exts'] == "N") $cacheMode = "skip";
        } // END - if
 
                if ($_CONFIG['cache_exts'] == "N") $cacheMode = "skip";
        } // END - if
@@ -94,6 +95,15 @@ if ($cacheMode == "load") {
        // Load extension data from cache file
        $EXT_DUMMY = $cacheInstance->cache_load();
 
        // Load extension data from cache file
        $EXT_DUMMY = $cacheInstance->cache_load();
 
+       // Is the cache file fine?
+       if (!isset($EXT_DUMMY['ext_name'])) {
+               // Cache file is damaged so kill it
+               $cacheInstance->cache_destroy();
+
+               // Skip any further execution
+               return;
+       } // END -  if
+
        // Begin with the cache preparation of extensions
        $EXT_NAMES = array();
        foreach ($EXT_DUMMY['ext_name'] as $k => $name) {
        // Begin with the cache preparation of extensions
        $EXT_NAMES = array();
        foreach ($EXT_DUMMY['ext_name'] as $k => $name) {
@@ -108,7 +118,7 @@ if ($cacheMode == "load") {
                        if (FILE_READABLE($INC)) {
                                // Add it
                                $EXT_POOL[] = $INC;
                        if (FILE_READABLE($INC)) {
                                // Add it
                                $EXT_POOL[] = $INC;
-                       }
+                       } // END -  if
                } // END - if
 
                // Load CSS file
                } // END - if
 
                // Load CSS file
@@ -122,12 +132,15 @@ if ($cacheMode == "load") {
                // Version number
                $EXT_DUMMY['ext_version'][$name] = $EXT_DUMMY['ext_version'][$k];
                unset($EXT_DUMMY['ext_version'][$k]);
                // Version number
                $EXT_DUMMY['ext_version'][$name] = $EXT_DUMMY['ext_version'][$k];
                unset($EXT_DUMMY['ext_version'][$k]);
+
                // Extension is active
                $EXT_DUMMY['ext_active'][$name] = $EXT_DUMMY['ext_active'][$k];
                unset($EXT_DUMMY['ext_active'][$k]);
                // Extension is active
                $EXT_DUMMY['ext_active'][$name] = $EXT_DUMMY['ext_active'][$k];
                unset($EXT_DUMMY['ext_active'][$k]);
+
                // Ext menu
                $EXT_DUMMY['ext_menu'][$name] = $EXT_DUMMY['ext_menu'][$k];
                unset($EXT_DUMMY['ext_menu'][$k]);
                // Ext menu
                $EXT_DUMMY['ext_menu'][$name] = $EXT_DUMMY['ext_menu'][$k];
                unset($EXT_DUMMY['ext_menu'][$k]);
+
                // Extension id
                $EXT_DUMMY['ext_id'][$name] = $EXT_DUMMY['ext_id'][$k];
                $id = $EXT_DUMMY['ext_id'][$name];
                // Extension id
                $EXT_DUMMY['ext_id'][$name] = $EXT_DUMMY['ext_id'][$k];
                $id = $EXT_DUMMY['ext_id'][$name];
@@ -296,7 +309,7 @@ if ((SQL_NUMROWS($res_ext_crt) > 0) && ((($cacheMode == "init") && ($CSS != "1")
 
        // Free memory
        SQL_FREERESULT($res_ext_crt);
 
        // Free memory
        SQL_FREERESULT($res_ext_crt);
-}
+} // END - if
 
 // Load include files if found
 if (!empty($INC_POOL[0])) {
 
 // Load include files if found
 if (!empty($INC_POOL[0])) {