private function _mkdir($target)
{
// from php.net/mkdir user contributed notes
if (file_exists($target)) {
if (!@is_dir($target)) {
return FALSE;
} else {
return TRUE;
}
}
// Attempting to create the directory may clutter up our display.
if (@mkdir($target)) {
$stat = @stat(dirname($target));
$dir_perms = $stat['mode'] & 07777;
// Get the permission bits.
@chmod($target, $dir_perms);
return TRUE;
} else {
if (is_dir(dirname($target))) {
return FALSE;
}
}
// If the above failed, attempt to create the parent node, then try again.
if ($this->_mkdir(dirname($target))) {
return $this->_mkdir($target);
}
return FALSE;
}