+
+ // Checks wether versions from cache and extension matches
+ function extensionVersionMatches ($ext_name) {
+ // Load cache (dummy)
+ $this->getArrayFromCache();
+
+ // Get extension version
+ $ext_ver = GET_EXT_VERSION($ext_name);
+
+ // Debug messages
+ if (isset($this->version[$this->name][$ext_name])) {
+ //* DEBUG: */ print __METHOD__."(<font color=\"#0000aa\">".__LINE__."</font>): cache={$this->name},ext_name={$ext_name} - {$ext_ver}/{$this->version[$this->name][$ext_name]}<br />\n";
+ } else {
+ // No cache version found!
+ DEBUG_LOG(__METHOD__, __LINE__, "Cache {$this->name} has missing version entry for extension {$ext_name}!");
+ }
+
+ // Compare both
+ return ((isset($this->version[$this->name][$ext_name])) && ($this->version[$this->name][$ext_name] == $ext_ver));
+ }
+
+ // Rewrit the entry so it can be stored in cache file
+ // @TODO Add support for more types which break in last else-block
+ function rewriteEntry ($key, $value) {
+ // Init line
+ $line = "";
+
+ // String or non-string? ;-)
+ 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) {
+ // True
+ $line = "\$data['".$key."'][] = true;\n";
+ } else {
+ // False
+ $line = "\$data['".$key."'][] = false;\n";
+ }
+ } else {
+ // Non-string
+ $line = "\$data['".$key."'][] = ".$value.";\n";
+ }
+
+ // Return line
+ return $line;
+ }
+
+ // Getter for cache status
+ function getStatus () {
+ return $this->ret;
+ }
+
+ // Checks wether the current cache file is readable
+ function isCacheReadable () {
+ return INCLUDE_READABLE($this->inc);
+ }
+
+} // END - class
+
+// Destroy the cache on extension changes
+function FILTER_CACHE_DESTROY_ON_EXT_CHANGE ($data) {
+ // Remove cache
+ if ($GLOBALS['cache_instance']->loadCacheFile("config")) $GLOBALS['cache_instance']->destroyCacheFile();
+ if ($GLOBALS['cache_instance']->loadCacheFile("extensions")) $GLOBALS['cache_instance']->destroyCacheFile();
+ if ($GLOBALS['cache_instance']->loadCacheFile("modreg")) $GLOBALS['cache_instance']->destroyCacheFile();
+
+ // Return it
+ return $data;
+}
+
+// Destroy the cache on changing admin
+function FILTER_CACHE_DESTROY_ON_ADMIN_CHANGE () {
+ // Remove cache
+ if ($GLOBALS['cache_instance']->loadCacheFile("admins")) $GLOBALS['cache_instance']->destroyCacheFile();