More fixes for installation and extension registration
[mailer.git] / inc / classes / cachesystem.class.php
index 89b7998102c83ff88860808563ab0ec106d89d8b..571721e63df27a0ce329c36a866abd22d4fc49b7 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /************************************************************************
- * MXChange v0.2.1                                    Start: 10/22/2009 *
- * ===============                              Last change: 10/22/2009 *
+ * Mailer v0.2.1-FINAL                                Start: 10/22/2009 *
+ * ===================                          Last change: 10/22/2009 *
  *                                                                      *
  * -------------------------------------------------------------------- *
  * File              : cachesystem.class.php                            *
@@ -137,7 +137,7 @@ class CacheSystem {
                                                $GLOBALS['cache_array']['extension'][$k][$data['ext_name']] = $v;
                                        }
                                        if (($k == 'ext_keep') && ($v == 'Y')) {
-                                               $GLOBALS['cache_array']['active_extensions'][$data['ext_name']] = $v;
+                                               $GLOBALS['cache_array']['always_active'][$data['ext_name']] = $v;
                                        } // END - if
                                } elseif (is_array($v)) {
                                        // Serialize and BASE64-encode the array
@@ -163,6 +163,9 @@ class CacheSystem {
                                } elseif ($this->name == 'refdepths') {
                                        // Referal levels
                                        $GLOBALS['cache_array']['refdepths'][$k][$data['id']] = $v;
+                               } elseif ($this->name == 'refsystem') {
+                                       // Referal system
+                                       $GLOBALS['cache_array']['refsystem'][$k][$data['id']] = $v;
                                } elseif ($this->name == 'revision') {
                                        // Revision data
                                        $GLOBALS['cache_array']['revision'][$k] = $v;
@@ -228,7 +231,7 @@ class CacheSystem {
                // Is the cache file there?
                if ($this->isCacheReadable()) {
                        // Load cache file
-                       require($this->fqfn);
+                       include($this->fqfn);
 
                        // Is there an array?
                        if (isset($this->data[$this->name])) {
@@ -254,7 +257,7 @@ class CacheSystem {
                } else {
                        // Cache file not found or not readable
                        debug_report_bug($this->name);
-                       addFatalMessage(__METHOD__, __LINE__, "(<font color=\"#0000aa\">".__LINE__."</font>): ".sprintf(getMessage('CACHE_CANNOT_LOAD'), $this->fqfn));
+                       addFatalMessage(__METHOD__, __LINE__, "(<font color=\"#0000aa\">".__LINE__."</font>): ".getMaskedMessage('CACHE_CANNOT_LOAD', $this->fqfn));
 
                        // Try to remove it
                        $this->removeCacheFile();
@@ -279,7 +282,7 @@ class CacheSystem {
                                // Debug message if allowed
                                if (isDebugModeEnabled()) {
                                        // Debug message
-                                       debug_report_bug('Not removing cache ' . $this->name . ' in output_mode=' . getOutputMode());
+                                       logDebugMessage(__METHOD__, __LINE__, 'Not removing cache ' . $this->name . ' in output_mode=' . getOutputMode());
                                } // END - if
 
                                // Abort here
@@ -309,7 +312,7 @@ class CacheSystem {
                                $this->rebuilt[$this->name] = true;
                        } else {
                                // Not removed!
-                               addFatalMessage(__METHOD__, __LINE__, "(<font color=\"#0000aa\">".__LINE__."</font>): ".sprintf(getMessage('CACHE_CANNOT_UNLINK'), $this->fqfn));
+                               addFatalMessage(__METHOD__, __LINE__, "(<font color=\"#0000aa\">".__LINE__."</font>): ".getMaskedMessage('CACHE_CANNOT_UNLINK', $this->fqfn));
                        }
                } // END - if
        }
@@ -414,11 +417,11 @@ class CacheSystem {
                                // Get extension version
                                $ext_ver = getExtensionVersion($ext_name);
 
-                               // Write cache line to file
-                               fwrite($this->pointer, $this->rewriteEntry($ext_name, $ext_ver, 'version', true));
-
                                // Add the extension version to object (DO NOT REMOVE IT! Endless loop...)
                                $this->version[$this->name][$ext_name] = $ext_ver;
+
+                               // Write cache line to file
+                               fwrite($this->pointer, $this->rewriteEntry($ext_name, $ext_ver, 'version', true));
                        } // END - if
                        //* DEBUG: */ outputHtml(__METHOD__."(<font color=\"#0000aa\">".__LINE__."</font>): {$this->name} - {$ext_name}={$ext_ver}<br />");
                } else {
@@ -472,7 +475,7 @@ class CacheSystem {
                // String or non-string? ;-)
                if (is_string($value)) {
                        // String...
-                       $line = '$this->' . $prefix . "['".$this->name."']['" . $key . "']" . $extender . " = '" . smartAddSlashes($value) . "';\n";
+                       $line = '$this->' . $prefix . "['".$this->name."']['" . $key . "']" . $extender . " = '" . escapeQuotes($value) . "';\n";
                } elseif (is_null($value)) {
                        // Null
                        $line = '$this->' . $prefix . "['".$this->name."']['" . $key . "']" . $extender . " = null;\n";