From: Roland Häder Date: Fri, 12 Dec 2008 21:05:06 +0000 (+0000) Subject: Cache class rewritten to better convention X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=6586600d8020147192e5f28ca2a3a0153f774d3c;p=mailer.git Cache class rewritten to better convention --- diff --git a/inc/databases.php b/inc/databases.php index 3a51cc507e..a52b9cab05 100644 --- a/inc/databases.php +++ b/inc/databases.php @@ -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); diff --git a/inc/db/lib-mysql3.php b/inc/db/lib-mysql3.php index afdf53ec76..c2d781c655 100644 --- a/inc/db/lib-mysql3.php +++ b/inc/db/lib-mysql3.php @@ -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']."
\n"; if ((GET_EXT_VERSION("cache") >= "0.0.7") && (isset($_CONFIG['db_hits'])) && (isset($_CONFIG['cache_hits'])) && (is_object($cacheInstance))) { // Add new hits diff --git a/inc/extensions.php b/inc/extensions.php index dd6cfa4b7d..ed6f43c503 100644 --- a/inc/extensions.php +++ b/inc/extensions.php @@ -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!
\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!
\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 diff --git a/inc/extensions/ext-cache.php b/inc/extensions/ext-cache.php index 9bfd6e0459..e881b8bd6f 100644 --- a/inc/extensions/ext-cache.php +++ b/inc/extensions/ext-cache.php @@ -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 "keep_active" ist hinzugefü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__."(".__LINE__."): ".CACHE_CANNOT_INITIALIZE); diff --git a/inc/extensions/ext-sql_patches.php b/inc/extensions/ext-sql_patches.php index c35f2ffe25..a9a1f4a082 100644 --- a/inc/extensions/ext-sql_patches.php +++ b/inc/extensions/ext-sql_patches.php @@ -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 diff --git a/inc/functions.php b/inc/functions.php index 1fa43f7be0..d5a4f20347 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -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? diff --git a/inc/libs/admins_functions.php b/inc/libs/admins_functions.php index 535adf41ac..f0cdd7536b 100644 --- a/inc/libs/admins_functions.php +++ b/inc/libs/admins_functions.php @@ -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(); } } diff --git a/inc/libs/cache_functions.php b/inc/libs/cache_functions.php index 29cb7aea70..611073a72a 100644 --- a/inc/libs/cache_functions.php +++ b/inc/libs/cache_functions.php @@ -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, "pointer, "store_extension_version("cache"); + $this->storeExtensionVersion("cache"); } else { // Cannot create file ADD_FATAL(__FILE__."(".__LINE__."): ".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__."(".__LINE__."): ".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__."(".__LINE__."): ".CACHE_CANNOT_LOAD_1.$this->cache_inc.CACHE_CANNOT_LOAD_2); + ADD_FATAL(__FILE__."(".__LINE__."): ".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__."(".__LINE__."): ".CACHE_CANNOT_UNLINK_1.$this->cache_inc.CACHE_CANNOT_UNLINK_2); + ADD_FATAL(__FILE__."(".__LINE__."): ".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__."(".__LINE__."): ".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"; diff --git a/inc/libs/refback_functions.php b/inc/libs/refback_functions.php index 469b04d304..5f9293a3c1 100644 --- a/inc/libs/refback_functions.php +++ b/inc/libs/refback_functions.php @@ -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__."(".__LINE__."):uid={$uid},ref={$cacheArray['up_refid'][$cacheArray['back_level']]} - CACHE!
\n"; - if ($cacheInstance->cache_file("refback")) $cacheInstance->cache_destroy(); + if ($cacheInstance->loadCacheFile("refback")) $cacheInstance->destroyCacheFile(); $cacheArray['back_cached'] = 1; } // END - if diff --git a/inc/load_extensions.php b/inc/load_extensions.php index 1f443670ac..256cb97daa 100644 --- a/inc/load_extensions.php +++ b/inc/load_extensions.php @@ -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 diff --git a/inc/loader/load_cache-admin.php b/inc/loader/load_cache-admin.php index e29f3e2bfd..336732ba9a 100644 --- a/inc/loader/load_cache-admin.php +++ b/inc/loader/load_cache-admin.php @@ -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 // diff --git a/inc/loader/load_cache-config.php b/inc/loader/load_cache-config.php index a8ca165691..86fd873b3a 100644 --- a/inc/loader/load_cache-config.php +++ b/inc/loader/load_cache-config.php @@ -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(); - // ?> diff --git a/inc/loader/load_cache-modreg.php b/inc/loader/load_cache-modreg.php index 126888ba9b..25f5652c21 100644 --- a/inc/loader/load_cache-modreg.php +++ b/inc/loader/load_cache-modreg.php @@ -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(); - // ?> diff --git a/inc/loader/load_cache-refdepths.php b/inc/loader/load_cache-refdepths.php index 973e7cbeda..41097f3bc5 100644 --- a/inc/loader/load_cache-refdepths.php +++ b/inc/loader/load_cache-refdepths.php @@ -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(); - // ?> diff --git a/inc/loader/load_cache-refsystem.php b/inc/loader/load_cache-refsystem.php index c012c7926d..b841bd1de0 100644 --- a/inc/loader/load_cache-refsystem.php +++ b/inc/loader/load_cache-refsystem.php @@ -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(); - // ?> diff --git a/inc/loader/load_cache-them.php b/inc/loader/load_cache-them.php index fde1f1bc54..a92039fe18 100644 --- a/inc/loader/load_cache-them.php +++ b/inc/loader/load_cache-them.php @@ -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(); - // ?> diff --git a/inc/modules/admin/admin-inc.php b/inc/modules/admin/admin-inc.php index 970dd69ff5..9c8a181022 100644 --- a/inc/modules/admin/admin-inc.php +++ b/inc/modules/admin/admin-inc.php @@ -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? diff --git a/inc/modules/admin/what-admins_add.php b/inc/modules/admin/what-admins_add.php index 45fd36eaaf..c6cba4a8c9 100644 --- a/inc/modules/admin/what-admins_add.php +++ b/inc/modules/admin/what-admins_add.php @@ -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 diff --git a/inc/modules/admin/what-config_admins.php b/inc/modules/admin/what-config_admins.php index 05ca3dd2dd..d74d041d96 100644 --- a/inc/modules/admin/what-config_admins.php +++ b/inc/modules/admin/what-config_admins.php @@ -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']); diff --git a/inc/modules/admin/what-config_cache.php b/inc/modules/admin/what-config_cache.php index 27b9f6d9a9..eade175739 100644 --- a/inc/modules/admin/what-config_cache.php +++ b/inc/modules/admin/what-config_cache.php @@ -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 diff --git a/inc/modules/admin/what-config_mods.php b/inc/modules/admin/what-config_mods.php index b4cdc29005..93ea4ed61b 100644 --- a/inc/modules/admin/what-config_mods.php +++ b/inc/modules/admin/what-config_mods.php @@ -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 diff --git a/inc/modules/admin/what-config_points.php b/inc/modules/admin/what-config_points.php index 44cafc4f76..436b127202 100644 --- a/inc/modules/admin/what-config_points.php +++ b/inc/modules/admin/what-config_points.php @@ -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; diff --git a/inc/modules/admin/what-extensions.php b/inc/modules/admin/what-extensions.php index 9c4c1c119b..d3d0c8d847 100644 --- a/inc/modules/admin/what-extensions.php +++ b/inc/modules/admin/what-extensions.php @@ -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...