/** * Create full directory structure, Ripped straight from the Smarty Template engine. * Version: 2.3.0 * Copyright: 2001,2002 ispi of Lincoln, Inc. * * @param string $dir Full directory. * @access private */ function _create_dir_structure($dir) { if (!@file_exists($dir)) { $dir_parts = preg_split('![\\/]+!', $dir, -1, PREG_SPLIT_NO_EMPTY); $new_dir = $dir[0] == DIR_SEP ? DIR_SEP : ''; foreach ($dir_parts as $dir_part) { $new_dir .= $dir_part; if (!file_exists($new_dir) && !mkdir($new_dir, 0771)) { Cache_Lite::raiseError('Cache_Lite : problem creating directory \\"$dir\\" !', -3); return false; } $new_dir .= DIR_SEP; } } }
/** * Create full directory structure, Ripped straight from the Smarty Template engine. * Version: 2.3.0 * Copyright: 2001,2002 ispi of Lincoln, Inc. * * @param string $dir Full directory. * @access private */ function _create_dir_structure($dir) { $dir = str_replace("\"", "", $dir); //Windows doesn't allow quotes in dir names like Linux does. if (!@file_exists($dir)) { $dir_parts = preg_split('![\\/]+!', $dir, -1, PREG_SPLIT_NO_EMPTY); $new_dir = $dir[0] == DIR_SEP ? DIR_SEP : ''; foreach ($dir_parts as $dir_part) { $new_dir .= $dir_part; if (!file_exists($new_dir) && !mkdir($new_dir, 0771)) { Cache_Lite::raiseError('Cache_Lite : problem creating directory \\"$dir\\" !', -3); return false; } $new_dir .= DIR_SEP; } } }
/** * Write the given data in the cache file * * @param string $data data to put in cache * @return boolean true if ok * @access private */ function _write($data) { $fp = @fopen($this->_file, "w"); if ($fp) { if ($this->_fileLocking) { @flock($fp, LOCK_EX); } if ($this->_readControl) { @fwrite($fp, $this->_hash($data, $this->_readControlType), 32); } $len = strlen($data); @fwrite($fp, $data, $len); if ($this->_fileLocking) { @flock($fp, LOCK_UN); } @fclose($fp); return true; } Cache_Lite::raiseError('Cache_Lite : Unable to write cache !', -1); return false; }
/** * Create full directory structure, Ripped straight from the Smarty Template engine. * Version: 2.3.0 * Copyright: 2001,2002 ispi of Lincoln, Inc. * * @param string $dir Full directory. * @access private */ function _create_dir_structure($dir) { if (!@file_exists($dir)) { Hashed_Cache_Lite::_create_dir_structure(dirname($dir)); if (!mkdir($dir, 0771)) { Cache_Lite::raiseError("Cache_Lite : problem creating directory \"{$dir}\" !", -3); } } }