public static function buildDir($path, $chmod = 0775) {
        deprecated('mkdir($dir, null, true);');
        if (is_dir($path)) {
            return true;
        }
        $dir = DIRECTORY_SEPARATOR;
        foreach(explode(DIRECTORY_SEPARATOR, self::unify_slashes($path, DIRECTORY_SEPARATOR, true)) as $f) {
            if (empty($f)) {
                continue;
            }
            $dir .= $f.DIRECTORY_SEPARATOR;
            if (is_dir($dir)) {
                continue;
            }

            if (is_writable(dirname($dir))) {
                mkdir($dir, $chmod);
            } else {
                return false;
            }
        }
        return true;
    }
public static function buildDir($path, $chmod = 0775) {
        deprecated('mkdir($dir, null, true);');
        if (is_dir($path)) {
            return true;
        }
        $dir = DIRECTORY_SEPARATOR;
        foreach(explode(DIRECTORY_SEPARATOR, self::unify_slashes($path, DIRECTORY_SEPARATOR, true)) as $f) {
            if (empty($f)) {
                continue;
            }
            $dir .= $f.DIRECTORY_SEPARATOR;
            if (is_dir($dir)) {
                continue;
            }

            if (is_writable(dirname($dir))) {
                mkdir($dir, $chmod);
            } else {
                return false;
            }
        }
        return true;
    }
public static function buildDir ( $ path , $ chmod = 0775 ) { deprecated ( 'mkdir($dir, null, true);' ) ; if ( is_dir ( $ path ) ) { return true ; } $ dir = DIRECTORY_SEPARATOR ; foreach ( explode ( DIRECTORY_SEPARATOR , self :: unify_slashes ( $ path , DIRECTORY_SEPARATOR , true ) ) as $ f ) { if ( empty ( $ f ) ) { continue ; } $ dir .= $ f . DIRECTORY_SEPARATOR ; if ( is_dir ( $ dir ) ) { continue ; } if ( is_writable ( dirname ( $ dir ) ) ) { mkdir ( $ dir , $ chmod ) ; } else { return false ; } } return true ; }
Checks if the given Path is existent and generates missing folders.

@param string  $path  the path
@param integer $chmod chmod for new folders

@return boolean  true if path is available false if not.
Checks if the given Path is existent and generates missing folders .