]> git.mxchange.org Git - mailer.git/blobdiff - inc/loader/load_cache-admin.php
Cache system rewritten, thanks to profi-concept's hints of including not evaluating it
[mailer.git] / inc / loader / load_cache-admin.php
index b9cbd32f4ba18e79e689bfe6b42c5a5f8405b72b..e29f3e2bfdd7bd59ae49fef34e1249dd8c9359d6 100644 (file)
@@ -38,13 +38,13 @@ if (!defined('__SECURITY')) {
 } // END - if
 
 // Let's start with the admins table...
 } // END - if
 
 // Let's start with the admins table...
-if (($cacheInstance->cache_file("admins", true) == true) && ($cacheInstance->ext_version_matches("admins"))) {
+if (($cacheInstance->cache_file("admins")) && ($cacheInstance->ext_version_matches("admins"))) {
        // Load cache
        global $cacheArray;
        $cacheArray['admins'] = $cacheInstance->cache_load();
 
        // Check if valid
        // Load cache
        global $cacheArray;
        $cacheArray['admins'] = $cacheInstance->cache_load();
 
        // Check if valid
-       if ((is_array($cacheArray['admins']['login'])) && (is_array($cacheArray['admins']['aid']))) {
+       if ((isset($cacheArray['admins']['login'])) && (is_array($cacheArray['admins']['login'])) && (is_array($cacheArray['admins']['aid']))) {
                // Check count
                if (count($cacheArray['admins']['login']) == count($cacheArray['admins']['aid'])) {
                        // Get "id map"
                // Check count
                if (count($cacheArray['admins']['login']) == count($cacheArray['admins']['aid'])) {
                        // Get "id map"
@@ -116,16 +116,19 @@ $cacheInstance->cache_close();
 // Next cached table are the admins_acls...
 if (GET_EXT_VERSION("admins") >= "0.3") {
        // Check for cache file
 // Next cached table are the admins_acls...
 if (GET_EXT_VERSION("admins") >= "0.3") {
        // Check for cache file
-       if ($cacheInstance->cache_file("admins_acls", true) == true) {
+       if (($cacheInstance->cache_file("admins_acls")) && ($cacheInstance->ext_version_matches("admins"))) {
                // Load referal system from cache
                global $cacheArray;
                $cacheArray['admin_acls'] = $cacheInstance->cache_load();
        } elseif (($_CONFIG['cache_acls'] == "Y") && ($CSS != "1") && ($CSS != "-1")) {
                // Create cache file here
                $cacheInstance->cache_init("ADMINS_ACLS");
                // Load referal system from cache
                global $cacheArray;
                $cacheArray['admin_acls'] = $cacheInstance->cache_load();
        } elseif (($_CONFIG['cache_acls'] == "Y") && ($CSS != "1") && ($CSS != "-1")) {
                // Create cache file here
                $cacheInstance->cache_init("ADMINS_ACLS");
+               $cacheInstance->store_extension_version("admins");
 
                // Load all modules and their data
                $result = SQL_QUERY("SELECT id, admin_id, action_menu, what_menu, access_mode FROM "._MYSQL_PREFIX."_admins_acls ORDER BY admin_id, action_menu, what_menu", __FILE__, __LINE__);
 
                // Load all modules and their data
                $result = SQL_QUERY("SELECT id, admin_id, action_menu, what_menu, access_mode FROM "._MYSQL_PREFIX."_admins_acls ORDER BY admin_id, action_menu, what_menu", __FILE__, __LINE__);
+
+               // Add all rows
                while ($data = SQL_FETCHARRAY($result)) {
                        // Add row to cache file
                        $cacheInstance->add_row($data);
                while ($data = SQL_FETCHARRAY($result)) {
                        // Add row to cache file
                        $cacheInstance->add_row($data);
@@ -134,6 +137,9 @@ if (GET_EXT_VERSION("admins") >= "0.3") {
                // Free memory
                SQL_FREERESULT($result);
 
                // Free memory
                SQL_FREERESULT($result);
 
+               // Close cache
+               $cacheInstance->cache_close();
+
                // Reload the cache
                require(__FILE__);
        }
                // Reload the cache
                require(__FILE__);
        }