]> git.mxchange.org Git - mailer.git/commitdiff
Cache class rewritten to better convention
authorRoland Häder <roland@mxchange.org>
Fri, 12 Dec 2008 21:05:06 +0000 (21:05 +0000)
committerRoland Häder <roland@mxchange.org>
Fri, 12 Dec 2008 21:05:06 +0000 (21:05 +0000)
23 files changed:
inc/databases.php
inc/db/lib-mysql3.php
inc/extensions.php
inc/extensions/ext-cache.php
inc/extensions/ext-sql_patches.php
inc/functions.php
inc/libs/admins_functions.php
inc/libs/cache_functions.php
inc/libs/refback_functions.php
inc/load_extensions.php
inc/loader/load_cache-admin.php
inc/loader/load_cache-config.php
inc/loader/load_cache-modreg.php
inc/loader/load_cache-refdepths.php
inc/loader/load_cache-refsystem.php
inc/loader/load_cache-them.php
inc/modules/admin/admin-inc.php
inc/modules/admin/what-admins_add.php
inc/modules/admin/what-config_admins.php
inc/modules/admin/what-config_cache.php
inc/modules/admin/what-config_mods.php
inc/modules/admin/what-config_points.php
inc/modules/admin/what-extensions.php

index 3a51cc507ebeaecc52df0b6ea50a7cf565e9a970..a52b9cab05d3ec48a36fa055975e0a2adfb4f396 100644 (file)
@@ -114,7 +114,7 @@ define('USAGE_BASE', "usage");
 define('SERVER_URL', "http://www.mxchange.org");
 
 // Current SVN revision
-define('CURR_SVN_REVISION', "622");
+define('CURR_SVN_REVISION', "623");
 
 // Take a prime number which is long (if you know a longer one please try it out!)
 define('_PRIME', 591623);
index afdf53ec76fbeb838e92e6f756b8476663c483ad..c2d781c655672cef838422009c56b92c9803410e 100644 (file)
@@ -197,6 +197,8 @@ function SQL_CLOSE(&$link, $F, $L) {
                // Skip double close
                return false;
        } // END - if
+
+       // Do we need to update cache/db counter?
        //* DEBUG: */ echo "DB=".$_CONFIG['db_hits'].",CACHE=".$_CONFIG['cache_hits']."<br />\n";
        if ((GET_EXT_VERSION("cache") >= "0.0.7") && (isset($_CONFIG['db_hits'])) && (isset($_CONFIG['cache_hits'])) && (is_object($cacheInstance))) {
                // Add new hits
index dd6cfa4b7d573be69f3d8dc06c9794321c212dca..ed6f43c50386877ce402900c253d32e7e7d4e8db 100644 (file)
@@ -200,9 +200,9 @@ function EXTENSION_REGISTER ($ext_name, $id, $dry_run=false) {
                                if ((EXT_IS_ACTIVE("cache")) || (GET_EXT_VERSION("cache") != "")) {
                                        //* DEBUG: */ echo __LINE__.": DESTROY!<br />\n";
                                        // Remove cache files
-                                       if ($cacheInstance->cache_file("extensions", true)) $cacheInstance->cache_destroy();
-                                       if ($cacheInstance->cache_file("mod_reg")) $cacheInstance->cache_destroy();
-                                       if ($cacheInstance->cache_file("config")) $cacheInstance->cache_destroy();
+                                       if ($cacheInstance->loadCacheFile("extensions", true)) $cacheInstance->destroyCacheFile();
+                                       if ($cacheInstance->loadCacheFile("mod_reg"))          $cacheInstance->destroyCacheFile();
+                                       if ($cacheInstance->loadCacheFile("config"))           $cacheInstance->destroyCacheFile();
                                } // END - if
 
                                // Check for added include files
@@ -337,9 +337,9 @@ function EXTENSION_RUN_SQLS($id, $EXT_LOAD_MODE) {
        if (((EXT_IS_ACTIVE("cache")) || (GET_EXT_VERSION("cache") != "")) && (((SQL_AFFECTEDROWS() == 1)) || ($sqlRan === true) || ($EXT_LOAD_MODE == "activate") || ($EXT_LOAD_MODE == "deactivate"))) {
                //* DEBUG: */ echo __LINE__.": DESTROY!<br />\n";
                // Remove cache files
-               if ($cacheInstance->cache_file("extensions", true)) $cacheInstance->cache_destroy();
-               if ($cacheInstance->cache_file("mod_reg"))    $cacheInstance->cache_destroy();
-               if ($cacheInstance->cache_file("config"))     $cacheInstance->cache_destroy();
+               if ($cacheInstance->loadCacheFile("extensions", true)) $cacheInstance->destroyCacheFile();
+               if ($cacheInstance->loadCacheFile("mod_reg"))    $cacheInstance->destroyCacheFile();
+               if ($cacheInstance->loadCacheFile("config"))     $cacheInstance->destroyCacheFile();
 
                // @TODO This causes the whole (!) menu cache being purged
                CACHE_PURGE_ADMIN_MENU();
@@ -536,9 +536,9 @@ function EXTENSION_UPDATE($file, $ext, $EXT_VER, $dry_run=false)
 
                        // Update cache
                        if (EXT_IS_ACTIVE("cache")) {
-                               if ($cacheInstance->cache_file("extensions", true)) $cacheInstance->cache_destroy();
-                               if ($cacheInstance->cache_file("config")) $cacheInstance->cache_destroy();
-                               if ($cacheInstance->cache_file("mod_reg")) $cacheInstance->cache_destroy();
+                               if ($cacheInstance->loadCacheFile("extensions", true)) $cacheInstance->destroyCacheFile();
+                               if ($cacheInstance->loadCacheFile("config")) $cacheInstance->destroyCacheFile();
+                               if ($cacheInstance->loadCacheFile("mod_reg")) $cacheInstance->destroyCacheFile();
                        } // END - if
 
                        // Remove array
index 9bfd6e0459e2252c3699a3d0a926536dc6a3f297..e881b8bd6fbbe28e71e14e047be689b5f14daf34 100644 (file)
@@ -91,11 +91,13 @@ case "update": // Update an extension
                break;
 
        case "0.0.4": // SQL queries for v0.0.4
-               // Update notes (these will be set as task text!)
+               // Is the cache extension itself there?
                if (EXT_IS_ACTIVE("cache")) {
                        // Check for cache when extension is already installed
-                       if ($cacheInstance->cache_file("extensions", true)) $cacheInstance->cache_destroy();
+                       if ($cacheInstance->loadCacheFile("extensions", true)) $cacheInstance->destroyCacheFile();
                } // END - if
+
+               // Update notes (these will be set as task text!)
                $UPDATE_NOTES = "Spalte &quot;keep_active&quot; ist hinzugef&uuml;gt. Cache wurde reinitialisiert.";
                break;
 
@@ -204,7 +206,7 @@ default: // Do stuff when extension is loaded
        // Create instance on class
        if ($cacheMode != "init") {
                // Initialize cache system only when it's needed
-               $cacheInstance = new mxchange_cache($_CONFIG['cache_update'], PATH."inc/".$_CONFIG['cache_path'], $_CONFIG['cache_tested']);
+               $cacheInstance = new CacheSystem($_CONFIG['cache_update'], PATH."inc/".$_CONFIG['cache_path'], $_CONFIG['cache_tested']);
                if ($cacheInstance->getStatus() != "done") {
                        // Failed to initialize cache sustem
                        ADD_FATAL(__FILE__."(<font color=\"#0000aa\">".__LINE__."</font>): ".CACHE_CANNOT_INITIALIZE);
index c35f2ffe254db2b3faa9e22596b947a7000815e6..a9a1f4a082919f718a6d946b252354c5e81b733a 100644 (file)
@@ -726,8 +726,8 @@ default: // Do stuff when extension is loaded
                                // Remove extensions and mod_reg cache file
                                require_once(PATH."inc/libs/cache_functions.php");
                                require_once(PATH."inc/extensions/ext-cache.php");
-                               if ($cacheInstance->cache_file("extensions", true)) $cacheInstance->cache_destroy();
-                               if ($cacheInstance->cache_file("mod_reg")) $cacheInstance->cache_destroy();
+                               if ($cacheInstance->loadCacheFile("extensions", true)) $cacheInstance->destroyCacheFile();
+                               if ($cacheInstance->loadCacheFile("mod_reg"))          $cacheInstance->destroyCacheFile();
                        } // END - if
                } // END - if
 
index 1fa43f7be0d61c60eb10a7ebeb8d3a7837e8efbd..d5a4f20347509cd0f2b2833ad90ad51290228827 100644 (file)
@@ -2622,9 +2622,9 @@ function REBUILD_CACHE ($cache, $inc="") {
        // Shall I remove the cache file?
        if ((EXT_IS_ACTIVE("cache")) && (is_object($cacheInstance))) {
                // Rebuild cache
-               if ($cacheInstance->cache_file($cache)) {
+               if ($cacheInstance->loadCacheFile($cache)) {
                        // Destroy it
-                       $cacheInstance->cache_destroy();
+                       $cacheInstance->destroyCacheFile();
                } // END - if
 
                // Include file given?
index 535adf41acd8ab806f7211a3930aa105da24224d..f0cdd7536b26a48a8851eb191f1cadd0198f1748 100644 (file)
@@ -255,7 +255,7 @@ WHERE id=%s LIMIT 1",
 
        // Remove cache file
        if ((EXT_IS_ACTIVE("cache")) && ($cache_update == "1")) {
-               if ($cacheInstance->cache_file("admins")) $cacheInstance->cache_destroy();
+               if ($cacheInstance->loadCacheFile("admins")) $cacheInstance->destroyCacheFile();
        }
 }
 
@@ -368,7 +368,7 @@ function ADMINS_REMOVE_ADMIN_ACCOUNTS ($POST) {
 
        // Remove cache if cache system is activated
        if ((EXT_IS_ACTIVE("cache")) && ($cache_update == "1")) {
-               if ($cacheInstance->cache_file("admins")) $cacheInstance->cache_destroy();
+               if ($cacheInstance->loadCacheFile("admins")) $cacheInstance->destroyCacheFile();
        }
 }
 
index 29cb7aea70fcfff6007293932af40f9fbc54c801..611073a72ae89cba3603f1129bd3f217afc0c64b 100644 (file)
@@ -38,23 +38,23 @@ if (!defined('__SECURITY')) {
 }
 
 // Caching class
-class mxchange_cache {
+class CacheSystem {
        // Define variables
        var $ret = "init";
-       var $cache_path = "";
-       var $cache_inc = "";
-       var $cache_pointer = false;
-       var $cache_data = "";
-       var $cache_version = "";
-       var $cache_file = "";
+       var $path = "";
+       var $inc = "";
+       var $pointer = false;
+       var $data = "";
+       var $version = "";
+       var $name = "";
 
        // Constructor
-       function mxchange_cache($interval, $path, $tested) {
+       function CacheSystem ($interval, $path, $tested) {
                // Failed is the default
                $this->ret = "failed";
 
                // Remeber path
-               $this->cache_path = $path;
+               $this->path = $path;
 
                // Check if path exists
                if ((is_dir($path)) && (!$tested)) {
@@ -83,45 +83,42 @@ class mxchange_cache {
        }
 
        // Checks validity of cache file and if content is given
-       function cache_file ($file, $forceContent = false) {
+       function loadCacheFile ($file, $forceContent = false) {
                // Remember cache file
-               $this->cache_file = $file;
+               $this->name = $file;
 
                // Construct FQFN (full qualified file name)
-               $inc = $this->cache_path.$file.".cache";
-
-               // Rember it + filename in class
-               $this->cache_inc = $inc;
+               $this->inc = $this->path.$file.".cache";
 
                // Check if file exists and if version matches
-               $status = (FILE_READABLE($inc) && (is_writeable($inc)) && ($this->ext_version_matches("cache")));
+               $status = (FILE_READABLE($this->inc) && (is_writeable($this->inc)) && ($this->extensionVersionMatches("cache")));
 
                // Return status
                return $status;
        }
 
-       function cache_init($array) {
+       function init () {
                // This will destory an existing cache file!
                if ($this->ret == "done") {
                        // Create file
-                       if (FILE_READABLE($this->cache_inc)) chmod($this->cache_inc, 0666);
-                       $this->cache_pointer = fopen($this->cache_inc, 'w') or mxchange_die("Cannot write to cache ".$this->cache_inc." !");
+                       if (FILE_READABLE($this->inc)) chmod($this->inc, 0666);
+                       $this->pointer = fopen($this->inc, 'w') or mxchange_die("Cannot write to cache ".$this->inc." !");
 
-                       // Begin of cache file
-                       fwrite($this->cache_pointer, "<?php\n\$ARRAY = \"".$array."\";\n\n");
+                       // Add open PHP tag
+                       fwrite($this->pointer, "<?php\n");
 
                        // Add default depency
-                       $this->store_extension_version("cache");
+                       $this->storeExtensionVersion("cache");
                } else {
                        // Cannot create file
                        ADD_FATAL(__FILE__."(<font color=\"#0000aa\">".__LINE__."</font>): ".CACHE_PROBLEMS_DETECTED);
                }
        }
 
-       function add_row ($data) {
+       function addRow ($data) {
                global $cacheArray;
 
-               if (is_resource($this->cache_pointer)) {
+               if (is_resource($this->pointer)) {
                        // Write every array element to cache file
                        foreach ($data as $k => $v) {
                                // Write global cache array for immediate access
@@ -140,7 +137,7 @@ class mxchange_cache {
                                }
 
                                // Write cache line to file
-                               fwrite($this->cache_pointer, $this->add_raw_row($k, $v));
+                               fwrite($this->pointer, $this->rewriteEntry($k, $v));
                        }
                } else {
                        // Cannot create file
@@ -148,89 +145,88 @@ class mxchange_cache {
                }
        }
 
-       function cache_close() {
+       function finalize () {
                // Quit function when no pointer is set
-               if (empty($this->cache_pointer)) return;
-               if (is_resource($this->cache_pointer)) {
+               if (is_resource($this->pointer)) {
                        // Write footer
-                       fwrite($this->cache_pointer, "?>\n");
+                       fwrite($this->pointer, "?>\n");
 
                        // Close file add destroy handler
-                       fclose($this->cache_pointer);
+                       fclose($this->pointer);
 
                        // Set rights
-                       if (FILE_READABLE($this->cache_inc)) chmod($this->cache_inc, 0666);
+                       if (FILE_READABLE($this->inc)) chmod($this->inc, 0666);
 
                        // Remove pointer
-                       unset($this->cache_pointer);
+                       $this->pointer = false;
                } else {
                        // Cannot create file
                        ADD_FATAL(__FILE__."(<font color=\"#0000aa\">".__LINE__."</font>): ".CACHE_PROBLEMS_DETECTED);
                }
        }
 
-       function cache_load() {
+       function getArrayFromCache () {
                // Is the cache already loaded?
-               if (isset($this->cache_data[$this->cache_file])) {
+               if (isset($this->data[$this->name])) {
                        // Return it's content!
-                       return $this->cache_data[$this->cache_file];
+                       return $this->data[$this->name];
                } // END - if
 
                // Is the cache file there?
-               if (FILE_READABLE($this->cache_inc)) {
+               if (FILE_READABLE($this->inc)) {
                        // Prepare temporary array
                        $data = array();
                        $cache_version = null;
 
                        // Load cache file
-                       require_once($this->cache_inc);
+                       require_once($this->inc);
 
                        // Is there an array?
                        if (is_array($data)) {
                                // Cache data
-                               $this->cache_data[$this->cache_file] = $data;
+                               $this->data[$this->name] = $data;
 
                                // Cache version found?
                                if ((is_array($cache_version)) && (count($cache_version) > 0)) {
                                        // Remember it as well...
-                                       $this->cache_version[$this->cache_file] = $cache_version;
+                                       $this->version[$this->name] = $cache_version;
                                } else {
                                        // Invalid cache so destroy it
-                                       $this->cache_destroy();
+                                       $this->destroyCacheFile();
 
                                        // Clear cached data
-                                       $this->cache_data[$this->cache_file] = array();
+                                       $this->data[$this->name] = array();
                                }
 
                                // Return cache
-                               return $this->cache_data[$this->cache_file];
+                               return $this->data[$this->name];
                        } else {
                                // Cache problem detected!
-                               $this->cache_destroy();
+                               $this->destroyCacheFile();
                        }
                } else {
                        // Cache file not found or not readable
-                       ADD_FATAL(__FILE__."(<font color=\"#0000aa\">".__LINE__."</font>): ".CACHE_CANNOT_LOAD_1.$this->cache_inc.CACHE_CANNOT_LOAD_2);
+                       ADD_FATAL(__FILE__."(<font color=\"#0000aa\">".__LINE__."</font>): ".CACHE_CANNOT_LOAD_1.$this->inc.CACHE_CANNOT_LOAD_2);
                }
        }
 
        // Destroy an existing cache file
-       function cache_destroy() {
+       function destroyCacheFile () {
                // Is the cache file there?
-               if (FILE_READABLE($this->cache_inc)) {
+               if (FILE_READABLE($this->inc)) {
                        // Close cache
-                       $this->cache_close();
+                       $this->finalize();
 
                        // Remove cache file from system
-                       unlink($this->cache_inc);
+                       unlink($this->inc);
 
                        // Is the file there?
-                       if (!FILE_READABLE($this->cache_inc)) {
+                       if (!FILE_READABLE($this->inc)) {
                                // The cache does no longer exist so kill the content
-                               unset($this->cache_data[$this->cache_file]);
+                               unset($this->data[$this->name]);
                        } else {
                                // Not removed!
-                               ADD_FATAL(__FILE__."(<font color=\"#0000aa\">".__LINE__."</font>): ".CACHE_CANNOT_UNLINK_1.$this->cache_inc.CACHE_CANNOT_UNLINK_2);
+                               ADD_FATAL(__FILE__."(<font color=\"#0000aa\">".__LINE__."</font>): ".CACHE_CANNOT_UNLINK_1.$this->inc.CACHE_CANNOT_UNLINK_2);
                        }
                } else {
                        // Does not exist!
@@ -238,11 +234,11 @@ class mxchange_cache {
                }
        }
 
-       function cache_remove($search, $data, $array) {
-               global $ARRAY;
-               if ((FILE_READABLE($this->cache_inc)) && (is_writeable($this->cache_inc))) {
+       // Unused method:
+       function removeEntry ($search, $data, $array) {
+               if ((FILE_READABLE($this->inc)) && (is_writeable($this->inc))) {
                        // Load cache into dummy array
-                       $dummy = $this->cache_load();
+                       $dummy = $this->getArrayFromCache();
 
                        // Search for key in array
                        $key = array_search($data, $dummy[$search]);
@@ -254,13 +250,13 @@ class mxchange_cache {
                                }
 
                                // Flush array to cache file
-                               $this->cache_init($ARRAY);
+                               $this->init();
 
                                // Write array out
-                               $this->cache_write_array($dummy);
+                               $this->writeArray($dummy);
 
                                // Close cache file
-                               $this->cache_close();
+                               $this->finalize();
                        }
                } else {
                        // Cannot write to cache!
@@ -268,23 +264,23 @@ class mxchange_cache {
                }
        }
 
-       function cache_write_array ($array) {
-               if (is_resource($this->cache_pointer)) {
+       function writeArray ($array) {
+               if (is_resource($this->pointer)) {
                        foreach ($array as $k => $v) {
                                if (is_array($v)) {
                                        // Multi line(s) found
                                        $LINE = "";
                                        foreach($v as $k2 => $v2) {
                                                // Put every array element in a row...
-                                               $LINE .= $this->add_raw_row($k, $v2);
+                                               $LINE .= $this->rewriteEntry($k, $v2);
                                        }
                                } else {
                                        // Single line found
-                                       $LINE = $this->add_raw_row($k, $v);
+                                       $LINE = $this->rewriteEntry($k, $v);
                                }
 
                                // Write line(s)
-                               fwrite($this->cache_pointer, $LINE);
+                               fwrite($this->pointer, $LINE);
                        } // END - foreach
                } else {
                        // Cannot write array!
@@ -292,11 +288,11 @@ class mxchange_cache {
                }
        }
 
-       function cache_replace($search, $replace, $search_key, $array) {
-               global $ARRAY;
-               if ((FILE_READABLE($this->cache_inc)) && (is_writeable($this->cache_inc))) {
+       // Unused method
+       function replaceEntry ($search, $replace, $search_key, $array) {
+               if ((FILE_READABLE($this->inc)) && (is_writeable($this->inc))) {
                        // Load cache into dummy array
-                       $dummy = $this->cache_load();
+                       $dummy = $this->getArrayFromCache();
 
                        // Check if $dummy is valid (prevents some errors)
                        if ((is_array($dummy)) && (isset($dummy[$search])) && (is_array($dummy[$search]))) {
@@ -314,13 +310,13 @@ class mxchange_cache {
                                        }
 
                                        // Flush array to cache file
-                                       $this->cache_init($ARRAY);
+                                       $this->init();
 
                                        // Write array out
-                                       $this->cache_write_array($dummy);
+                                       $this->writeArray($dummy);
 
                                        // Close cache file
-                                       $this->cache_close();
+                                       $this->finalize();
                                }
                        }
                } else {
@@ -329,39 +325,49 @@ class mxchange_cache {
                }
        }
 
-       function store_extension_version ($ext_name) {
+       function storeExtensionVersion ($ext_name) {
                // Valid cache pointer?
-               if (is_resource($this->cache_pointer)) {
+               if (is_resource($this->pointer)) {
                        // Get extension version
                        $ext_ver = GET_EXT_VERSION($ext_name);
 
                        // Write cache line to file
-                       fwrite($this->cache_pointer, "\$cache_version['".$ext_name."'] = \"".$ext_ver."\";\n");
+                       fwrite($this->pointer, "\$cache_version['".$ext_name."'] = \"".$ext_ver."\";\n");
                } else {
                        // Cannot create file
                        ADD_FATAL(__FILE__."(<font color=\"#0000aa\">".__LINE__."</font>): ".CACHE_PROBLEMS_DETECTED);
                }
        }
 
-       function ext_version_matches ($ext_name) {
+       function extensionVersionMatches ($ext_name) {
                // Load cache (dummy)
-               $this->cache_load();
+               $this->getArrayFromCache();
 
                // Get extension version
                $ext_ver = GET_EXT_VERSION($ext_name);
 
                // Compare both
-               return ((isset($this->cache_version[$this->cache_file][$ext_name])) && ($this->cache_version[$this->cache_file][$ext_name] == $ext_ver));
+               return ((isset($this->version[$this->name][$ext_name])) && ($this->version[$this->name][$ext_name] == $ext_ver));
        }
 
-       function add_raw_row ($key, $value) {
+       function rewriteEntry ($key, $value) {
                // Init line
                $line = "";
 
                // String or non-string? ;-)
-               if ((is_string($value)) || (is_null($value))) {
+               if (is_string($value)) {
                        // String...
                        $line = "\$data['".$key."'][] = \"".$value."\";\n";
+               } elseif (is_null($value)) {
+                       // Null
+                       $line = "\$data['".$key."'][] = null;\n";
+               } elseif (is_bool($value)) {
+                       // Boolean value
+                       if ($value === true) {
+                               $line = "\$data['".$key."'][] = true;\n";
+                       } else {
+                               $line = "\$data['".$key."'][] = false;\n";
+                       }
                } else {
                        // Non-string
                        $line = "\$data['".$key."'][] = ".$value.";\n";
index 469b04d304a6afa5213c46534416039711bfbb47..5f9293a3c14c36da4cee08667a9af2fff726282a 100644 (file)
@@ -247,7 +247,7 @@ function UPDATE_REFBACK_TABLE($uid) {
        if ((($cacheArray['up_refid'][$cacheArray['back_level']] == $uid) || ($cacheArray['up_refid'][$cacheArray['back_level']] == 0)) && (GET_EXT_VERSION("cache") >= "0.1.2") && (!isset($cacheArray['back_cached']))) {
                // Remove cache here
                //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},ref={$cacheArray['up_refid'][$cacheArray['back_level']]} - CACHE!<br />\n";
-               if ($cacheInstance->cache_file("refback")) $cacheInstance->cache_destroy();
+               if ($cacheInstance->loadCacheFile("refback")) $cacheInstance->destroyCacheFile();
                $cacheArray['back_cached'] = 1;
        } // END - if
 
index 1f443670ac371dc20d0f1cc994a5c5efbeb55479..256cb97daa0fb13f0599d8d149854c8ba2a39740 100644 (file)
@@ -68,7 +68,7 @@ if (EXT_IS_ACTIVE("cache")) {
        include_once(PATH."inc/extensions/ext-cache.php");
 
        // Check extension cache
-       switch (($cacheInstance->cache_file("extensions", true)) && ($cacheInstance->ext_version_matches("sql_patches"))) {
+       switch (($cacheInstance->loadCacheFile("extensions", true)) && ($cacheInstance->extensionVersionMatches("sql_patches"))) {
                case true : $cacheMode = "load"; break;
                case false: $cacheMode = "init"; break;
        }
@@ -76,8 +76,8 @@ if (EXT_IS_ACTIVE("cache")) {
        // Do we need to init the cache?
        if (($cacheMode == "init") && ($_CONFIG['cache_exts'] == "Y")) {
                // Init cache file
-               $cacheInstance->cache_init("EXTENSIONS");
-               $cacheInstance->store_extension_version("sql_patches");
+               $cacheInstance->init("EXTENSIONS");
+               $cacheInstance->storeExtensionVersion("sql_patches");
        } elseif ($_CONFIG['cache_exts'] == "N") {
                // Cache will not be created for extensions
                $cacheMode = "skip";
@@ -90,15 +90,15 @@ if ($cacheMode == "load") {
        $EXT_POOL = array();
 
        // Re-initialize handler
-       $cacheInstance->cache_file("extensions", true);
+       $cacheInstance->loadCacheFile("extensions", true);
 
        // Load extension data from cache file
-       $EXT_DUMMY = $cacheInstance->cache_load();
+       $EXT_DUMMY = $cacheInstance->getArrayFromCache();
 
        // Is the cache file fine?
        if (!isset($EXT_DUMMY['ext_name'])) {
                // Cache file is damaged so kill it
-               $cacheInstance->cache_destroy();
+               $cacheInstance->destroyCacheFile();
 
                // Skip any further execution
                return;
@@ -166,9 +166,6 @@ if ($cacheMode == "load") {
        $EXT_DUMMY['ext_name'] = $EXT_NAMES;
        unset($EXT_NAMES);
 
-       // Close cache file
-       $cacheInstance->cache_close();
-
        // Loading cache is done so let's free some memory!
        unset($EXT_DUMMY['ext_lang']);
        unset($EXT_DUMMY['ext_keep']);
@@ -198,12 +195,12 @@ if ($cacheMode == "load") {
 
        if (GET_EXT_VERSION("sql_patches") >= "0.0.6") {
                // Query with CSS file from DB
-               $res_ext_crt = SQL_QUERY("SELECT id, ext_name, ext_lang_file, ext_has_css, ext_active, ext_version
+               $res_ext_crt = SQL_QUERY("SELECT id AS ext_id, ext_name, ext_lang_file AS ext_lang, ext_has_css AS ext_css, ext_active, ext_version
 FROM "._MYSQL_PREFIX."_extensions".$ADD."
 ORDER BY ext_name", __FILE__, __LINE__);
        } else {
                // Old obsolete query string
-               $res_ext_crt = SQL_QUERY("SELECT id, ext_name, ext_lang_file, ext_name, ext_active, ext_version
+               $res_ext_crt = SQL_QUERY("SELECT id AS ext_id, ext_name, ext_lang_file AS ext_lang, ext_name, ext_active, ext_version
 FROM "._MYSQL_PREFIX."_extensions".$ADD."
 ORDER BY ext_name", __FILE__, __LINE__);
        }
@@ -218,93 +215,95 @@ if ((SQL_NUMROWS($res_ext_crt) > 0) && ((($cacheMode == "init") && ($CSS != "1")
        require_once(PATH."inc/theme-manager.php");
 
        // Extensions are registered so we load them
-       while (list($EXT_ID, $name, $lang, $css, $active, $version) = SQL_FETCHROW($res_ext_crt)) {
+       while ($content = SQL_FETCHARRAY($res_ext_crt)) {
                // Get menu entry
-               $menu = "N";
-               if (MODULE_HAS_MENU($name, true)) {
-                       $menu = "Y";
+               $content['ext_menu'] = "N";
+               if (MODULE_HAS_MENU($content['ext_name'], true)) {
+                       $content['ext_menu'] = "Y";
                } // END - if
 
                // Load extensions
-               $file1 = sprintf("%sinc/extensions/ext-%s.php", PATH, $name);
+               $file1 = sprintf("%sinc/extensions/ext-%s.php", PATH, $content['ext_name']);
                $file2 = $file1; $EXT_CSS = "N"; $EXT_ALWAYS_ACTIVE = "N";
 
                // Special functions file
-               $file3 = sprintf("%sinc/libs/%s_functions.php", PATH, $name);
+               $file3 = sprintf("%sinc/libs/%s_functions.php", PATH, $content['ext_name']);
 
                // Does the extension file exists?
                if (FILE_READABLE($file1)) {
                        // If there's no language file specified we don't need to load one... ;-)
-                       if (!empty($lang)) {
+                       if (!empty($content['ext_lang'])) {
                                // Create language file
-                               $file2 = sprintf("%sinc/language/%s_%s.php", PATH, $lang, GET_LANGUAGE());
+                               $file2 = sprintf("%sinc/language/%s_%s.php", PATH, $content['ext_lang'], GET_LANGUAGE());
                        } // END - if
 
                        if (FILE_READABLE($file3)) {
                                // Special functions file
-                               $funcs = "Y";
+                               $content['ext_funcs'] = "Y";
                                require_once($file3);
                        } else {
                                // Don't load functions file
-                               $funcs = "N";
+                               $content['ext_funcs'] = "N";
                        }
 
                        // Do we need a language file?
                        if (($file1 != $file2) && (FILE_READABLE($file2))) {
                                // Load language file
-                               $lang = "Y";
+                               $content['ext_lang'] = "Y";
                                include($file2);
                        } else {
                                // Don't load language file
-                               $lang = "N";
+                               $content['ext_lang'] = "N";
                        }
 
+                       // By default no extension is always active, except sql_patches
+                       $EXT_ALWAYS_ACTIVE = "N";
+
                        // Load extension
-                       if ($name != "sql_patches") {
+                       if ($content['ext_name'] != "sql_patches") {
                                // Load extension's file
                                include_once($file1);
                        } else {
-                               // KEEP sql_patches ALWAYS ACTIVE!
+                               // Keep sql_patches always active
                                $EXT_ALWAYS_ACTIVE = "Y";
                        }
 
-                       if ($css == "Y") {
-                               $CSS_FILE = sprintf("%stheme/%s/css/%s.css", PATH, GET_CURR_THEME(), $name);
+                       // Transfer EXT_ALWAYS_ACTIVE flag
+                       $content['ext_keep'] = $EXT_ALWAYS_ACTIVE;
+
+                       // CSS file handling:
+                       if ((!isset($content['ext_css'])) || ($content['ext_css'] == "Y")) {
+                               // Create FQFN for the CSS file
+                               $CSS_FILE = sprintf("%stheme/%s/css/%s.css", PATH, GET_CURR_THEME(), $content['ext_name']);
+
+                               // Is the file there?
                                if (FILE_READABLE($CSS_FILE)) {
                                        // CSS file for extension was found (use only relative path for now!)
-                                       $EXT_CSS_FILES[] = $name.".css";
+                                       $EXT_CSS_FILES[] = $content['ext_name'].".css";
+                                       $content['ext_css'] = "Y";
                                } else {
                                        // Don't load CSS file
-                                       $css = "N";
+                                       $content['ext_css'] = "N";
                                }
                        } // END - if
 
-                       // Add cache row
+                       // Shall we cache?
                        if ($cacheMode == "init") {
-                               $cacheInstance->add_row(array(
-                                       'ext_id'      => $EXT_ID,
-                                       'ext_name'    => $name,
-                                       'ext_lang'    => $lang,
-                                       'ext_css'     => $css,
-                                       'ext_menu'    => $menu,
-                                       'ext_funcs'   => $funcs,
-                                       'ext_active'  => $active,
-                                       'ext_version' => $version,
-                                       'ext_keep'    => $EXT_ALWAYS_ACTIVE,
-                               ));
+                               // Add cache row
+                               $cacheInstance->addRow($content);
                        } elseif ($cacheMode == "no") {
                                // Remember this value for later usage
-                               $cacheArray['active_extensions'][$name] = $EXT_ALWAYS_ACTIVE;
+                               $cacheArray['active_extensions'][$content['ext_name']] = $EXT_ALWAYS_ACTIVE;
                        }
                } elseif (!FILE_READABLE($file1)) {
                        // Deleted extension file so we mark it for removal from DB
-                       $DEL[] = $name;
+                       $DEL[] = $content['ext_name'];
                }
        } // END - while
 
        if ($cacheMode == "init") {
                // Close cache file
-               $cacheInstance->cache_close();
+               $cacheInstance->finalize();
 
                // Load more cache files (like admins)
                require_once(PATH."inc/load_cache.php");
@@ -327,14 +326,14 @@ if (!empty($INC_POOL[0])) {
 // Uninstall extensions that are no longer in our system
 if (!empty($DEL[0])) {
        // Remove extensions from two tables: extension registry and tasks table
-       foreach ($DEL as $name) {
+       foreach ($DEL as $del_ext) {
                // First remove entry from extensions table
                SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_extensions WHERE ext_name='%s' LIMIT 1",
-                       array($name), __FILE__, __LINE__);
+                       array($del_ext), __FILE__, __LINE__);
 
                // Remove (maybe?) found tasks (main task and possible updates
                SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_task_system WHERE subject LIKE '[%s:]%%' AND (task_type='EXTENSION' OR task_type='EXTENSION_UPDATE')",
-                       array($name), __FILE__, __LINE__);
+                       array($del_ext), __FILE__, __LINE__);
        } // END - foreach
 
        // I think it's not neccessary to run the optimization function here
index e29f3e2bfdd7bd59ae49fef34e1249dd8c9359d6..336732ba9aabe3f213eadda4a5da50cb9f5d7efe 100644 (file)
@@ -38,10 +38,10 @@ if (!defined('__SECURITY')) {
 } // END - if
 
 // Let's start with the admins table...
-if (($cacheInstance->cache_file("admins")) && ($cacheInstance->ext_version_matches("admins"))) {
+if (($cacheInstance->loadCacheFile("admins")) && ($cacheInstance->extensionVersionMatches("admins"))) {
        // Load cache
        global $cacheArray;
-       $cacheArray['admins'] = $cacheInstance->cache_load();
+       $cacheArray['admins'] = $cacheInstance->getArrayFromCache();
 
        // Check if valid
        if ((isset($cacheArray['admins']['login'])) && (is_array($cacheArray['admins']['login'])) && (is_array($cacheArray['admins']['aid']))) {
@@ -72,18 +72,18 @@ if (($cacheInstance->cache_file("admins")) && ($cacheInstance->ext_version_match
                        } // END - for
                } else {
                        // Nope, cache file is corrupted!
-                       $cacheInstance->cache_destroy();
+                       $cacheInstance->destroyCacheFile();
                        unset($cacheArray['admins']);
                }
        } else {
                // Nope, cache file is corrupted!
-               $cacheInstance->cache_destroy();
+               $cacheInstance->destroyCacheFile();
                unset($cacheArray['admins']);
        }
 } elseif (($_CONFIG['cache_admins'] == "Y") && ($CSS != "1") && ($CSS != "-1")) {
        // Create cache file
-       $cacheInstance->cache_init("ADMINS");
-       $cacheInstance->store_extension_version("admins");
+       $cacheInstance->init("ADMINS");
+       $cacheInstance->storeExtensionVersion("admins");
 
        // Load every data from DB to cache file
        $ADD = ", id, id";
@@ -97,33 +97,30 @@ FROM "._MYSQL_PREFIX."_admins
 ORDER BY login", __FILE__, __LINE__);
        while($dummy = SQL_FETCHARRAY($result_admins)) {
                // Save row
-               $cacheInstance->add_row($dummy);
+               $cacheInstance->addRow($dummy);
        } // END - while
 
        // Free memory
        SQL_FREERESULT($result_admins);
 
        // Close cache
-       $cacheInstance->cache_close();
+       $cacheInstance->finalize();
 
        // Reload the cache
        require(__FILE__);
 }
 
-// Close file
-$cacheInstance->cache_close();
-
 // Next cached table are the admins_acls...
 if (GET_EXT_VERSION("admins") >= "0.3") {
        // Check for cache file
-       if (($cacheInstance->cache_file("admins_acls")) && ($cacheInstance->ext_version_matches("admins"))) {
+       if (($cacheInstance->loadCacheFile("admins_acls")) && ($cacheInstance->extensionVersionMatches("admins"))) {
                // Load referal system from cache
                global $cacheArray;
-               $cacheArray['admin_acls'] = $cacheInstance->cache_load();
+               $cacheArray['admin_acls'] = $cacheInstance->getArrayFromCache();
        } elseif (($_CONFIG['cache_acls'] == "Y") && ($CSS != "1") && ($CSS != "-1")) {
                // Create cache file here
-               $cacheInstance->cache_init("ADMINS_ACLS");
-               $cacheInstance->store_extension_version("admins");
+               $cacheInstance->init("ADMINS_ACLS");
+               $cacheInstance->storeExtensionVersion("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__);
@@ -131,21 +128,18 @@ if (GET_EXT_VERSION("admins") >= "0.3") {
                // Add all rows
                while ($data = SQL_FETCHARRAY($result)) {
                        // Add row to cache file
-                       $cacheInstance->add_row($data);
+                       $cacheInstance->addRow($data);
                } // END - while
 
                // Free memory
                SQL_FREERESULT($result);
 
                // Close cache
-               $cacheInstance->cache_close();
+               $cacheInstance->finalize();
 
                // Reload the cache
                require(__FILE__);
        }
-
-       // Close file
-       $cacheInstance->cache_close();
 } // END - if
 
 //
index a8ca165691d92f3c1bf03b3b16fb935ef8b1609f..86fd873b3abc14ad3d1162d90ddc0b37d9b2bd85 100644 (file)
@@ -38,36 +38,33 @@ if (!defined('__SECURITY')) {
 }
 
 // Next cached table is the configuration (config)...
-if (($cacheInstance->cache_file("config", true)) && ($cacheInstance->ext_version_matches("sql_patches"))) {
+if (($cacheInstance->loadCacheFile("config", true)) && ($cacheInstance->extensionVersionMatches("sql_patches"))) {
        // Load config from cache
        global $cacheArray;
-       $cacheArray['config'] = $cacheInstance->cache_load();
+       $cacheArray['config'] = $cacheInstance->getArrayFromCache();
 
        // TODO: Do we really need to cache the config???
 } elseif (($_CONFIG['cache_config'] == "Y") && ($CSS != "1") && ($CSS != "-1")) {
        // Create cache file here
-       $cacheInstance->cache_init("CONFIG");
-       $cacheInstance->store_extension_version("sql_patches");
+       $cacheInstance->init("CONFIG");
+       $cacheInstance->storeExtensionVersion("sql_patches");
 
        // Load all modules and their data
        $result = SQL_QUERY("SELECT * FROM "._MYSQL_PREFIX."_config ORDER BY config ASC", __FILE__, __LINE__);
        while ($data = SQL_FETCHARRAY($result)) {
                // Add row to cache file
-               $cacheInstance->add_row($data);
+               $cacheInstance->addRow($data);
        } // END - while
 
        // Free memory
        SQL_FREERESULT($result);
 
        // Close the cache
-       $cacheInstance->cache_close();
+       $cacheInstance->finalize();
 
        // Reload the cache
        require(__FILE__);
 }
 
-// Close file
-$cacheInstance->cache_close();
-
 //
 ?>
index 126888ba9bfe80cee68e7fb33c46b0127b6fcedb..25f5652c21adac824290d6b61295870d98c03437 100644 (file)
@@ -38,10 +38,10 @@ if (!defined('__SECURITY')) {
 }
 
 // Next cached table is the module registry (mod_reg)...
-if (($cacheInstance->cache_file("mod_reg")) && ($cacheInstance->ext_version_matches("sql_patches"))) {
+if (($cacheInstance->loadCacheFile("mod_reg")) && ($cacheInstance->extensionVersionMatches("sql_patches"))) {
        // Load cache
        global $cacheArray;
-       $cacheArray['modules'] = $cacheInstance->cache_load();
+       $cacheArray['modules'] = $cacheInstance->getArrayFromCache();
 
        // Rewrite module cache
        $modArray = $cacheArray['modules'];
@@ -66,8 +66,8 @@ if (($cacheInstance->cache_file("mod_reg")) && ($cacheInstance->ext_version_matc
        unset($modArray);
 } elseif (($_CONFIG['cache_modreg'] == "Y") && ($CSS != "1") && ($CSS != "-1")) {
        // Create cache file here
-       $cacheInstance->cache_init("MODULES");
-       $cacheInstance->store_extension_version("sql_patches");
+       $cacheInstance->init("MODULES");
+       $cacheInstance->storeExtensionVersion("sql_patches");
 
        // Load all modules and their data
        if (GET_EXT_VERSION("sql_patches") >= "0.3.6") {
@@ -83,21 +83,18 @@ FROM "._MYSQL_PREFIX."_mod_reg ORDER BY id", __FILE__, __LINE__);
        // Cache all data
        while ($data = SQL_FETCHARRAY($result)) {
                // Add row to cache file
-               $cacheInstance->add_row($data);
+               $cacheInstance->addRow($data);
        } // END - while
 
        // Free memory
        SQL_FREERESULT($result);
 
        // Close the cache
-       $cacheInstance->cache_close();
+       $cacheInstance->finalize();
 
        // Reload the cache
        require(__FILE__);
 }
 
-// Close file
-$cacheInstance->cache_close();
-
 //
 ?>
index 973e7cbedad7355ce312c1701147451201dec5ce..41097f3bc5e39ffea261a0eee92b69cbd87832a2 100644 (file)
@@ -38,34 +38,31 @@ if (!defined('__SECURITY')) {
 }
 
 // Next cached table is the referal system (refdepths)...
-if (($cacheInstance->cache_file("refdepths")) && ($cacheInstance->ext_version_matches("sql_patches"))) {
+if (($cacheInstance->loadCacheFile("refdepths")) && ($cacheInstance->extensionVersionMatches("sql_patches"))) {
        // Load referal system from cache
        global $cacheArray;
-       $cacheArray['ref_depths'] = $cacheInstance->cache_load();
+       $cacheArray['ref_depths'] = $cacheInstance->getArrayFromCache();
 } elseif (($_CONFIG['cache_refdepth'] == "Y") && ($CSS != "1") && ($CSS != "-1")) {
        // Create cache file here
-       $cacheInstance->cache_init("REFDEPTHS");
-       $cacheInstance->store_extension_version("sql_patches");
+       $cacheInstance->init("REFDEPTHS");
+       $cacheInstance->storeExtensionVersion("sql_patches");
 
        // Load all modules and their data
        $result = SQL_QUERY("SELECT id, level, percents FROM "._MYSQL_PREFIX."_refdepths ORDER BY level", __FILE__, __LINE__);
        while ($data = SQL_FETCHARRAY($result)) {
                // Add row to cache file
-               $cacheInstance->add_row($data);
+               $cacheInstance->addRow($data);
        } // END - while
 
        // Free memory
        SQL_FREERESULT($result);
 
        // Close the cache
-       $cacheInstance->cache_close();
+       $cacheInstance->finalize();
 
        // Reload the cache
        require(__FILE__);
 }
 
-// Close file
-$cacheInstance->cache_close();
-
 //
 ?>
index c012c7926db3f82cb70f8bbda81ebdd0ea6b4434..b841bd1de0b00ba5852b63821fe7db78b21397b4 100644 (file)
@@ -38,34 +38,31 @@ if (!defined('__SECURITY')) {
 }
 
 // Next cached table is the referal system (refsystem)...
-if (($cacheInstance->cache_file("refsystem")) && ($cacheInstance->ext_version_matches("sql_patches"))) {
+if (($cacheInstance->loadCacheFile("refsystem")) && ($cacheInstance->extensionVersionMatches("sql_patches"))) {
        // Load referal system from cache
        global $cacheArray;
-       $cacheArray['ref_system'] = $cacheInstance->cache_load();
+       $cacheArray['ref_system'] = $cacheInstance->getArrayFromCache();
 } elseif (($_CONFIG['cache_refsys'] == "Y") && ($CSS != "1") && ($CSS != "-1")) {
        // Create cache file here
-       $cacheInstance->cache_init("REFSYSTEM");
-       $cacheInstance->store_extension_version("sql_patches");
+       $cacheInstance->init("REFSYSTEM");
+       $cacheInstance->storeExtensionVersion("sql_patches");
 
        // Load all modules and their data
        $result = SQL_QUERY("SELECT id, userid, level, counter FROM "._MYSQL_PREFIX."_refsystem ORDER BY userid, level", __FILE__, __LINE__);
        while ($data = SQL_FETCHARRAY($result)) {
                // Add row to cache file
-               $cacheInstance->add_row($data);
+               $cacheInstance->addRow($data);
        } // END - while
 
        // Free memory
        SQL_FREERESULT($result);
 
        // Close the cache
-       $cacheInstance->cache_close();
+       $cacheInstance->finalize();
 
        // Reload the cache
        require(__FILE__);
 }
 
-// Close file
-$cacheInstance->cache_close();
-
 //
 ?>
index fde1f1bc54627c016f6ac8aae65d2f7151e5088f..a92039fe182aa3186aa097b89d235f5813483024 100644 (file)
@@ -38,10 +38,10 @@ if (!defined('__SECURITY')) {
 }
 
 // Next cached table is the referal system (themes)...
-if (($cacheInstance->cache_file("themes")) && ($cacheInstance->ext_version_matches("theme"))) {
+if (($cacheInstance->loadCacheFile("themes")) && ($cacheInstance->extensionVersionMatches("theme"))) {
        // Load referal system from cache
        global $cacheArray;
-       $cache = $cacheInstance->cache_load();
+       $cache = $cacheInstance->getArrayFromCache();
 
        // Restructure the array
        $cacheArray['themes'] = array();
@@ -64,8 +64,8 @@ if (($cacheInstance->cache_file("themes")) && ($cacheInstance->ext_version_match
        unset($cache);
 } elseif (($_CONFIG['cache_refsys'] == "Y") && ($CSS != "1") && ($CSS != "-1")) {
        // Create cache file here
-       $cacheInstance->cache_init("THEMES");
-       $cacheInstance->store_extension_version("theme");
+       $cacheInstance->init("THEMES");
+       $cacheInstance->storeExtensionVersion("theme");
 
        // Load all themes and their data
        if (GET_EXT_VERSION("theme") >= "0.0.7") {
@@ -75,21 +75,18 @@ if (($cacheInstance->cache_file("themes")) && ($cacheInstance->ext_version_match
        }
        while ($data = SQL_FETCHARRAY($result)) {
                // Add row to cache file
-               $cacheInstance->add_row($data);
+               $cacheInstance->addRow($data);
        } // END - while
 
        // Free memory
        SQL_FREERESULT($result);
 
        // Close the cache
-       $cacheInstance->cache_close();
+       $cacheInstance->finalize();
 
        // Reload the cache
        require(__FILE__);
 }
 
-// Close file
-$cacheInstance->cache_close();
-
 //
 ?>
index 970dd69ff5ef87e460c4a93bc1f47ab8bf20ea4a..9c8a1810224cdf5f4222744371b83063dce32483 100644 (file)
@@ -389,9 +389,9 @@ function ADD_ADMIN_MENU($act, $wht, $return=false) {
                $cacheName = "admin_".$act."_".$wht."_".GET_LANGUAGE()."_".strtolower(get_session('admin_login'));
 
                // Is that cache there?
-               if ($cacheInstance->cache_file($cacheName)) {
+               if ($cacheInstance->loadCacheFile($cacheName)) {
                        // Then load it
-                       $data = $cacheInstance->cache_load();
+                       $data = $cacheInstance->getArrayFromCache();
 
                        // Extract all parts
                        $OUT = base64_decode($data['output'][0]);
@@ -540,7 +540,7 @@ function ADD_ADMIN_MENU($act, $wht, $return=false) {
        // Is there a cache instance again?
        if ((is_object($cacheInstance)) && (isset($_CONFIG['cache_admin_menu'])) && ($_CONFIG['cache_admin_menu'] == "Y")) {
                // Init cache
-               $cacheInstance->cache_init($cacheName);
+               $cacheInstance->init($cacheName);
 
                // Prepare cache data
                $data = array(
@@ -550,10 +550,10 @@ function ADD_ADMIN_MENU($act, $wht, $return=false) {
                );
 
                // Write the data away
-               $cacheInstance->add_row($data);
+               $cacheInstance->addRow($data);
 
                // Close cache
-               $cacheInstance->cache_close();
+               $cacheInstance->finalize();
        } // END - if
 
        // Return or output content?
index 45fd36eaafae9afcad275bda6af21420463ed7e9..c6cba4a8c924f154ce48ba3c5bee0da2eb744ee1 100644 (file)
@@ -60,7 +60,7 @@ if ((isset($_POST['add'])) && (!empty($_POST['login'])) && (!empty($_POST['email
 
                // Remove cache file
                if (EXT_IS_ACTIVE("cache")) {
-                       if ($cacheInstance->cache_file("admins")) $cacheInstance->cache_destroy();
+                       if ($cacheInstance->loadCacheFile("admins")) $cacheInstance->destroyCacheFile();
                }
        } else {
                // Free memory
index 05ca3dd2dd746f129e5d52742c0f95aa6f4eef97..d74d041d96281c950ab87a8d6986528d30242405 100644 (file)
@@ -89,7 +89,7 @@ if ((isset($_POST['edit'])) && ($SEL > 0)) {
 
        // Update cache when installed
        if (EXT_IS_ACTIVE("cache")) {
-               if ($cacheInstance->cache_file("admins_acls")) $cacheInstance->cache_destroy();
+               if ($cacheInstance->loadCacheFile("admins_acls")) $cacheInstance->destroyCacheFile();
 
                // Purge menu cache
                CACHE_PURGE_ADMIN_MENU($_POST['admin'][$id]);
@@ -151,7 +151,7 @@ if ((isset($_POST['edit'])) && ($SEL > 0)) {
 
        // Update cache when installed
        if (EXT_IS_ACTIVE("cache")) {
-               if ($cacheInstance->cache_file("admins_acls")) $cacheInstance->cache_destroy();
+               if ($cacheInstance->loadCacheFile("admins_acls")) $cacheInstance->destroyCacheFile();
 
                // @TODO This causes the whole (!) menu cache being rebuild
                CACHE_PURGE_ADMIN_MENU();
@@ -191,7 +191,7 @@ VALUES ('%s','%s','%s','%s')",
 
                                // Update cache when installed
                                if (EXT_IS_ACTIVE("cache")) {
-                                       if ($cacheInstance->cache_file("admins_acls")) $cacheInstance->cache_destroy();
+                                       if ($cacheInstance->loadCacheFile("admins_acls")) $cacheInstance->destroyCacheFile();
 
                                        // Purge cache
                                        CACHE_PURGE_ADMIN_MENU($_POST['admin_id'], $_POST['action_menu'], $_POST['what_menu']);
index 27b9f6d9a9effc8ed69fc9b3a5210533b4faa8b4..eade1757395995467d21fdc90994fcb3b72d53f2 100644 (file)
@@ -51,26 +51,26 @@ if (isset($_POST['ok'])) {
        }
 
        // Delete deactivated cache files
-       if (($_POST['cache_admins'] == "N") && ($cacheInstance->cache_file("admins"))) {
-               $cacheInstance->cache_destroy();
+       if (($_POST['cache_admins'] == "N") && ($cacheInstance->loadCacheFile("admins"))) {
+               $cacheInstance->destroyCacheFile();
        }
-       if (($_POST['cache_acls'] == "N") && ($cacheInstance->cache_file("acls"))) {
-               $cacheInstance->cache_destroy();
+       if (($_POST['cache_acls'] == "N") && ($cacheInstance->loadCacheFile("acls"))) {
+               $cacheInstance->destroyCacheFile();
        }
-       if (($_POST['cache_exts'] == "N") && ($cacheInstance->cache_file("extensions", true))) {
-               $cacheInstance->cache_destroy();
+       if (($_POST['cache_exts'] == "N") && ($cacheInstance->loadCacheFile("extensions", true))) {
+               $cacheInstance->destroyCacheFile();
        }
-       if (($_POST['cache_config'] == "N") && ($cacheInstance->cache_file("config"))) {
-               $cacheInstance->cache_destroy();
+       if (($_POST['cache_config'] == "N") && ($cacheInstance->loadCacheFile("config"))) {
+               $cacheInstance->destroyCacheFile();
        }
-       if (($_POST['cache_modreg'] == "N") && ($cacheInstance->cache_file("modreg"))) {
-               $cacheInstance->cache_destroy();
+       if (($_POST['cache_modreg'] == "N") && ($cacheInstance->loadCacheFile("modreg"))) {
+               $cacheInstance->destroyCacheFile();
        }
-       if (($_POST['cache_refdepth'] == "N") && ($cacheInstance->cache_file("refdepth"))) {
-               $cacheInstance->cache_destroy();
+       if (($_POST['cache_refdepth'] == "N") && ($cacheInstance->loadCacheFile("refdepth"))) {
+               $cacheInstance->destroyCacheFile();
        }
-       if (($_POST['cache_refsys'] == "N") && ($cacheInstance->cache_file("refsys"))) {
-               $cacheInstance->cache_destroy();
+       if (($_POST['cache_refsys'] == "N") && ($cacheInstance->loadCacheFile("refsys"))) {
+               $cacheInstance->destroyCacheFile();
        }
 
        // Save configuration
index b4cdc290059ac428cf71d17789ba449e7732dd9c..93ea4ed61b3abe458c807c71f20f23a1c98add8e 100644 (file)
@@ -106,7 +106,7 @@ if (isset($_POST['edit']))
        // Remove cache file if version matches
        if (GET_EXT_VERSION("cache") >= "0.1.2")
        {
-               if ($cacheInstance->cache_file("mod_reg")) $cacheInstance->cache_destroy();
+               if ($cacheInstance->loadCacheFile("mod_reg")) $cacheInstance->destroyCacheFile();
        }
 
        // Entries updated
index 44cafc4f7694a20cc8cf640b0c2817da6b52359a..436b12720262f23299d645d83099ceecc7a58468 100644 (file)
@@ -103,7 +103,7 @@ if (isset($_POST['ok'])) {
 
                // Update cache file
                if (GET_EXT_VERSION("cache") >= "0.1.2") {
-                       if ($cacheInstance->cache_file("refdepths")) $cacheInstance->cache_destroy();
+                       if ($cacheInstance->loadCacheFile("refdepths")) $cacheInstance->destroyCacheFile();
                }
                break;
 
index 9c4c1c119b9290fd62e765e841822b21ea483d4b..d3d0c8d8477219c7b0f51a34042e74e65271b1a0 100644 (file)
@@ -310,9 +310,9 @@ case "register": // Register new extension
                                // Do we need to update cache file?
                                if ((EXT_IS_ACTIVE("cache")) && ($cacheMode != "no")) {
                                        // Remove cache file (will be auto-created again!)
-                                       if ($cacheInstance->cache_file("config")) $cacheInstance->cache_destroy();
-                                       if ($cacheInstance->cache_file("extensions", true)) $cacheInstance->cache_destroy();
-                                       if ($cacheInstance->cache_file("mod_reg")) $cacheInstance->cache_destroy();
+                                       if ($cacheInstance->loadCacheFile("config")) $cacheInstance->destroyCacheFile();
+                                       if ($cacheInstance->loadCacheFile("extensions", true)) $cacheInstance->destroyCacheFile();
+                                       if ($cacheInstance->loadCacheFile("mod_reg")) $cacheInstance->destroyCacheFile();
                                } // END - if
                        } elseif (GET_EXT_VERSION($ext_name) != "") {
                                // Motify the admin that we have a problem here...