Archive_Tar::_dirCheck PHP Method

_dirCheck() public method

Check if a directory exists and create it (including parent dirs) if not.
public _dirCheck ( string $p_dir ) : boolean
$p_dir string directory to check
return boolean TRUE if the directory exists or was created
    function _dirCheck($p_dir)
    {
        clearstatcache();
        if (@is_dir($p_dir) || $p_dir == '') {
            return true;
        }
        $p_parent_dir = dirname($p_dir);
        if ($p_parent_dir != $p_dir && $p_parent_dir != '' && !$this->_dirCheck($p_parent_dir)) {
            return false;
        }
        if (!@mkdir($p_dir, 0777)) {
            $this->_error("Unable to create directory '{$p_dir}'");
            return false;
        }
        return true;
    }