]> git.mxchange.org Git - mailer.git/blobdiff - inc/libs/cache_functions.php
Fixes for #113, task texts where too much secured, resolved
[mailer.git] / inc / libs / cache_functions.php
index 93e9d621edb67582c4fb80e73199e7b54daa4a3a..afae515b3e16625c145946b9e7b1c266575102a1 100644 (file)
  * -------------------------------------------------------------------- *
  * Kurzbeschreibung  : Funktionen fuer die admins-Erweiterung           *
  * -------------------------------------------------------------------- *
- * $Revision:: 856                                                    $ *
- * $Date:: 2009-03-06 20:24:32 +0100 (Fr, 06. March 2009)             $ *
+ * $Revision::                                                        $ *
+ * $Date::                                                            $ *
  * $Tag:: 0.2.1-FINAL                                                 $ *
- * $Author:: stelzi                                                   $ *
+ * $Author::                                                          $ *
  * Needs to be in all Files and every File needs "svn propset           *
  * svn:keywords Date Revision" (autoprobset!) at least!!!!!!            *
  * -------------------------------------------------------------------- *
@@ -64,7 +64,7 @@ class CacheSystem {
                $this->path = $path;
 
                // Check if path exists
-               if ((is_dir($path)) && (!$tested)) {
+               if ((isDirectory($path)) && (!$tested)) {
                        // Check if we can create a file inside the path
                        touch($path."dummy.tmp", 'w');
                        if (FILE_READABLE($path."dummy.tmp")) {
@@ -113,7 +113,7 @@ class CacheSystem {
                if ($this->ret == "done") {
                        // Create file
                        if ($this->isCacheReadable()) chmod($this->fqfn, 0666);
-                       $this->pointer = fopen($this->fqfn, 'w') or mxchange_die("Cannot write to cache ".$this->fqfn." !");
+                       $this->pointer = fopen($this->fqfn, 'w') or app_die(__METHOD__, __LINE__, "Cannot write to cache ".$this->fqfn." !");
 
                        // Add open PHP tag
                        fwrite($this->pointer, "<?php\n");
@@ -418,6 +418,9 @@ class CacheSystem {
 
 // Destroy the cache on extension changes
 function FILTER_CACHE_DESTROY_ON_EXT_CHANGE ($data) {
+       // Return the data anyway if there is no cache extension
+       if (!isCacheInstanceValid()) return $data;
+
        // Remove cache
        if ($GLOBALS['cache_instance']->loadCacheFile("config"))     $GLOBALS['cache_instance']->destroyCacheFile();
        if ($GLOBALS['cache_instance']->loadCacheFile("extensions")) $GLOBALS['cache_instance']->destroyCacheFile();
@@ -429,12 +432,18 @@ function FILTER_CACHE_DESTROY_ON_EXT_CHANGE ($data) {
 
 // Destroy the cache on changing admin
 function FILTER_CACHE_DESTROY_ON_ADMIN_CHANGE () {
+       // Skip this step if the cache instance is not there
+       if (!isCacheInstanceValid()) return false;
+
        // Remove cache
        if ($GLOBALS['cache_instance']->loadCacheFile("admins")) $GLOBALS['cache_instance']->destroyCacheFile();
 }
 
 // Destroy all cache files
 function FILTER_CACHE_DESTROY_ALL () {
+       // Skip this step if the cache instance is not there
+       if (!isCacheInstanceValid()) return false;
+
        // Remove cache files
        if ($GLOBALS['cache_instance']->loadCacheFile("admins"))      $GLOBALS['cache_instance']->destroyCacheFile();
        if ($GLOBALS['cache_instance']->loadCacheFile("admins_acls")) $GLOBALS['cache_instance']->destroyCacheFile();