Cache system rewritten, thanks to profi-concept's hints of including not evaluating it
[mailer.git] / inc / loader / load_cache-admin.php
index 7e28bda282bd971f1cb55bd5bda7f4a72061ed13..e29f3e2bfdd7bd59ae49fef34e1249dd8c9359d6 100644 (file)
@@ -44,7 +44,7 @@ if (($cacheInstance->cache_file("admins")) && ($cacheInstance->ext_version_match
        $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"
@@ -127,6 +127,8 @@ if (GET_EXT_VERSION("admins") >= "0.3") {
 
                // 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);
@@ -135,6 +137,9 @@ if (GET_EXT_VERSION("admins") >= "0.3") {
                // Free memory
                SQL_FREERESULT($result);
 
+               // Close cache
+               $cacheInstance->cache_close();
+
                // Reload the cache
                require(__FILE__);
        }