]> git.mxchange.org Git - mailer.git/commitdiff
Cache now supports multiple extension versions
authorRoland Häder <roland@mxchange.org>
Mon, 15 Sep 2008 00:06:45 +0000 (00:06 +0000)
committerRoland Häder <roland@mxchange.org>
Mon, 15 Sep 2008 00:06:45 +0000 (00:06 +0000)
inc/databases.php
inc/libs/cache_functions.php

index 327f7c7a8b9ba7d6fed5551d62391a122f6cdde8..d35cb48bd6b0030d66edd1c0dffd038f884ba89f 100644 (file)
@@ -114,7 +114,7 @@ define('USAGE_BASE', "usage");
 define('SERVER_URL', "http://www.mxchange.org");
 
 // This current patch level
-define('CURR_SVN_REVISION', "329");
+define('CURR_SVN_REVISION', "330");
 
 // Take a prime number which is long (if you know a longer one please try it out!)
 define('_PRIME', 591623);
index f3496a5ccb4f152aed76f2fac9e2d2c510583ad8..e8f750bee8f55e94767d3af40d451b666b024488 100644 (file)
@@ -193,6 +193,7 @@ class mxchange_cache
                if (FILE_READABLE($this->cache_inc)) {
                        // Prepare temporary array
                        $data = array();
+                       $cache_version = null;
 
                        // Load cache file
                        $this->cache_data = implode("", file($this->cache_inc));
@@ -205,7 +206,7 @@ class mxchange_cache
                                $this->cache_data = $data;
 
                                // Cache version found?
-                               if (isset($cache_version)) {
+                               if ((isset($cache_version)) && (is_array($cache_version))) {
                                        // Remember it as well...
                                        $this->cache_version = $cache_version;
                                } // END - if
@@ -351,7 +352,7 @@ class mxchange_cache
                        $ext_ver = GET_EXT_VERSION($ext_name);
 
                        // Write cache line to file
-                       @fwrite($this->cache_pointer, "\$cache_version = \"".$ext_ver."\";\n");
+                       @fwrite($this->cache_pointer, "\$cache_version['".$ext_name."'] = \"".$ext_ver."\";\n");
                } else {
                        // Cannot create file
                        ADD_FATAL(__FILE__."(".__LINE__."): ".CACHE_PROBLEMS_DETECTED);
@@ -367,7 +368,7 @@ class mxchange_cache
 
                //* DEBUG: */ echo __METHOD__.": ext_name={$ext_name},ext_ver={$ext_ver},cache_version={$this->cache_version}<br />\n";
                // Compare both
-               return ($ext_ver == $this->cache_version);
+               return ((isset($this->cache_version[$ext_name])) && ($this->cache_version[$ext_name] == $ext_ver));
        }
 
        function add_raw_row ($key, $value) {