src/xPDO/Cache/xPDOCacheManager.php
public function writeTree($dirname, $options= array()) {
        $written= false;
        if (!empty ($dirname)) {
            if (!is_array($options)) $options = is_scalar($options) && !is_bool($options) ? array('new_folder_permissions' => $options) : array();
            $mode = $this->getOption('new_folder_permissions', $options, $this->getFolderPermissions());
            if (is_string($mode)) $mode = octdec($mode);
            $dirname= strtr(trim($dirname), '\\', '/');
            if ($dirname{strlen($dirname) - 1} == '/') $dirname = substr($dirname, 0, strlen($dirname) - 1);
            if (is_dir($dirname) || (is_writable(dirname($dirname)) && @mkdir($dirname, $mode))) {
                $written= true;
            } elseif (!$this->writeTree(dirname($dirname), $options)) {
                $written= false;
            } else {
                $written= @ mkdir($dirname, $mode);
            }
            if ($written && !is_writable($dirname)) {
                @ chmod($dirname, $mode);
            }
        }
        return $written;
    }
public function writeTree($dirname, $options= array()) {
        $written= false;
        if (!empty ($dirname)) {
            if (!is_array($options)) $options = is_scalar($options) && !is_bool($options) ? array('new_folder_permissions' => $options) : array();
            $mode = $this->getOption('new_folder_permissions', $options, $this->getFolderPermissions());
            if (is_string($mode)) $mode = octdec($mode);
            $dirname= strtr(trim($dirname), '\\', '/');
            if ($dirname{strlen($dirname) - 1} == '/') $dirname = substr($dirname, 0, strlen($dirname) - 1);
            if (is_dir($dirname) || (is_writable(dirname($dirname)) && @mkdir($dirname, $mode))) {
                $written= true;
            } elseif (!$this->writeTree(dirname($dirname), $options)) {
                $written= false;
            } else {
                $written= @ mkdir($dirname, $mode);
            }
            if ($written && !is_writable($dirname)) {
                @ chmod($dirname, $mode);
            }
        }
        return $written;
    }
public function writeTree ( $ dirname , $ options = array ( ) ) { $ written = false ; if ( ! empty ( $ dirname ) ) { if ( ! is_array ( $ options ) ) $ options = is_scalar ( $ options ) && ! is_bool ( $ options ) ? array ( 'new_folder_permissions' => $ options ) : array ( ) ; $ mode = $ this -> getOption ( 'new_folder_permissions' , $ options , $ this -> getFolderPermissions ( ) ) ; if ( is_string ( $ mode ) ) $ mode = octdec ( $ mode ) ; $ dirname = strtr ( trim ( $ dirname ) , '\\' , '/' ) ; if ( $ dirname { strlen ( $ dirname ) - 1 } == '/' ) $ dirname = substr ( $ dirname , 0 , strlen ( $ dirname ) - 1 ) ; if ( is_dir ( $ dirname ) || ( is_writable ( dirname ( $ dirname ) ) && @ mkdir ( $ dirname , $ mode ) ) ) { $ written = true ; } elseif ( ! $ this -> writeTree ( dirname ( $ dirname ) , $ options ) ) { $ written = false ; } else { $ written = @ mkdir ( $ dirname , $ mode ) ; } if ( $ written && ! is_writable ( $ dirname ) ) { @ chmod ( $ dirname , $ mode ) ; } } return $ written ; }
Recursively writes a directory tree of files to the filesystem

@access public
@param string $dirname The directory to write
@param array $options An array of options for the function. Can also be a value representing
a permissions mode to write new directories with, though this is deprecated.
@return boolean Returns true if the directory was successfully written.
Recursively writes a directory tree of files to the filesystem