Пример #1
0
 /**
  * Set Cache Directory Path
  *
  * @param	string	$path	Path to the cache directory
  * @return	bool
  */
 public function check_path($path = '')
 {
     $path = $path === '' ? Core::$tempDir . DS . 'Database' : $path;
     // Add a trailing slash to the path if needed
     $path = realpath($path) ? rtrim(realpath($path), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR : rtrim($path, '/') . '/';
     if (!is_dir($path)) {
         if (!mkdir($path, 0777, false)) {
             Logger::logDebug('DB cache path error: ' . $path);
             // If the path is wrong we'll turn off caching
             return $this->db->cache_off();
         }
     }
     if (!Core::isReallyWritable($path)) {
         Logger::logDebug('DB cache dir not writable: ' . $path);
         // If the path is not really writable we'll turn off caching
         return $this->db->cache_off();
     }
     $this->db->cachedir = $path;
     return TRUE;
 }