public static function mkDir($dirName, $mode = 0777)
    {
        if (file_exists($dirName) && is_dir($dirName)) {
            return @chmod($dirName, $mode);
        }
        $result = @mkdir($dirName, $mode, true);
        if (false === $result) {
            throw new Exception('Can not create dir ' . $dirName);
        }
        return true;
    }