OSDN Git Service

- Cachemanager doesn't make directory and make cache file under the tmp directory...
authorsotarok <sotarok@2ef88817-412d-0410-a32c-8029a115e976>
Fri, 30 Jan 2009 18:34:39 +0000 (18:34 +0000)
committersotarok <sotarok@2ef88817-412d-0410-a32c-8029a115e976>
Fri, 30 Jan 2009 18:34:39 +0000 (18:34 +0000)
class/Plugin/Cachemanager/Ethna_Plugin_Cachemanager_Localfile.php

index 0098de2..baf0427 100644 (file)
@@ -222,6 +222,11 @@ class Ethna_Plugin_Cachemanager_Localfile extends Ethna_Plugin_Cachemanager
      */
     function _getCacheDir($namespace, $key)
     {
+        $safe_mode = ini_get('safe_mode');
+        if ($safe_mode) {
+            return sprintf("%s", $this->backend->getTmpdir());
+        }
+
         $len = strlen($key);
         // intentionally avoid using -2 or -4
         $dir1 = substr($key, $len-4, 2);
@@ -246,7 +251,6 @@ class Ethna_Plugin_Cachemanager_Localfile extends Ethna_Plugin_Cachemanager
                 }
             }
         }
-        
         return sprintf("%s/cache/%s/cache_%s/%s/%s", $this->backend->getTmpdir(), $dir, $this->_escape($namespace), $this->_escape($dir1), $this->_escape($dir2));
     }
 
@@ -257,6 +261,11 @@ class Ethna_Plugin_Cachemanager_Localfile extends Ethna_Plugin_Cachemanager
      */
     function _getCacheFile($namespace, $key)
     {
+        $safe_mode = ini_get('safe_mode');
+        if ($safe_mode) {
+            return sprintf("%s/cache_%s_%s", $this->_getCacheDir($namespace, $key), $this->_escape($namespace), $this->_escape($key));
+        }
+
         return sprintf("%s/%s", $this->_getCacheDir($namespace, $key), $this->_escape($key));
     }