Method extensionVersionMatches() is now cached in
authorRoland Häder <roland@mxchange.org>
Mon, 15 Feb 2010 04:51:14 +0000 (04:51 +0000)
committerRoland Häder <roland@mxchange.org>
Mon, 15 Feb 2010 04:51:14 +0000 (04:51 +0000)
inc/classes/cachesystem.class.php
inc/loader/load_cache-modules.php

index f160a6cfdbcede2062f8ce21fe3a14fa40db0858..ae127dc27eb69e79faca27b1fd481cb94310c23b 100644 (file)
@@ -436,32 +436,35 @@ class CacheSystem {
 
        // Checks wether versions from cache and extension matches
        function extensionVersionMatches ($ext_name) {
 
        // Checks wether versions from cache and extension matches
        function extensionVersionMatches ($ext_name) {
-               // Default is not matching
-               $matches = false;
-
-               // Compare only if installed
-               if (isExtensionInstalled($ext_name)) {
-                       // Get extension version
-                       $ext_ver = getExtensionVersion($ext_name);
-
-                       // Debug messages
-                       if (isset($this->version[$this->name][$ext_name])) {
-                               // Does it match?
-                               $matches = ((isset($this->version[$this->name][$ext_name])) && ($this->version[$this->name][$ext_name] == $ext_ver));
-                       } elseif ($this->isCacheReadable()) {
-                               // No cache version found!
-                               logDebugMessage(__METHOD__, __LINE__, "Cache {$this->name} has missing version entry for extension {$ext_name}! Purging cache...");
-
-                               // Remove the cache file
-                               $this->removeCacheFile(true);
+               // Check cache
+               if (!isset($GLOBALS[__METHOD__][$ext_name])) {
+                       // Compare only if installed
+                       if (isExtensionInstalled($ext_name)) {
+                               // Get extension version
+                               $ext_ver = getExtensionVersion($ext_name);
+
+                               // Debug messages
+                               if (isset($this->version[$this->name][$ext_name])) {
+                                       // Does it match?
+                                       $GLOBALS[__METHOD__][$ext_name] = ((isset($this->version[$this->name][$ext_name])) && ($this->version[$this->name][$ext_name] == $ext_ver));
+                               } elseif ($this->isCacheReadable()) {
+                                       // No cache version found!
+                                       logDebugMessage(__METHOD__, __LINE__, "Cache {$this->name} has missing version entry for extension {$ext_name}! Purging cache...");
+       
+                                       // Remove the cache file
+                                       $this->removeCacheFile(true);
+                               }
+                       } else {
+                               // Not installed, does always match
+                               $GLOBALS[__METHOD__][$ext_name] = true;
                        }
                } else {
                        }
                } else {
-                       // Not installed, does always match
-                       $matches = true;
+                       // Cache entry found, log debug message
+                       //* DEBUG: */ logDebugMessage(__METHOD__, __LINE__, 'ext_name=' . $ext_name . ', matches=' . intval($GLOBALS[__METHOD__][$ext_name]));
                }
 
                // Compare both
                }
 
                // Compare both
-               return $matches;
+               return $GLOBALS[__METHOD__][$ext_name];
        }
 
        // Rewrit the entry so it can be stored in cache file
        }
 
        // Rewrit the entry so it can be stored in cache file
index 052d9937dd1957e5f29d9a445188a76e2bda9c64..c0caef79c51e80de0023bef69ed49722930d5d29 100644 (file)
@@ -64,7 +64,7 @@ if (($GLOBALS['cache_instance']->loadCacheFile('modules')) && ($GLOBALS['cache_i
                                unset($GLOBALS['cache_array']['modules'][$entry][$key]);
                        } else {
                                // Log this for debug purposes
                                unset($GLOBALS['cache_array']['modules'][$entry][$key]);
                        } else {
                                // Log this for debug purposes
-                               debugLogMessage('[' . basename(__FILE__) . ':' . __LINE__ . '] Entry not found. module=' . $mod . ',key=' . $key . ',entry=' . $entry);
+                               logDebugMessage(basename(__FILE__), __LINE__, 'Entry not found. module=' . $mod . ',key=' . $key . ',entry=' . $entry);
                        }
                } // END - foreach
        } // END - foreach
                        }
                } // END - foreach
        } // END - foreach