Create a directory.

@param string $dirname The name of the new directory.
@param array  $config  An optional configuration array.

@return bool True on success, false on failure.
424769
public function createDir($dirname, array $config = [])
    {
        list($prefix, $dirname) = $this->getPrefixAndPath($dirname);

        return $this->getFilesystem($prefix)->createDir($dirname);
    }
856604
public function createDir($dirname, Config $config)
    {
        $path       =  PathLibrary::normalizerPath($dirname, true);
        $pathArr    = explode(DIRECTORY_SEPARATOR, $path);
        $pathArr    = array_filter($pathArr, function($value){
            return !empty($value);
        });

        if ( $pathArr ) {

            $currentPath = '';

            foreach ( $pathArr as $value ) {

                $currentPath .= DIRECTORY_SEPARATOR . $value;

                // 如果已经存在，则跳过
                if ( $this->has( PathLibrary::normalizerPath($currentPath, true) ) ) {
                    continue;
                }

                $status = Response::parseResponse(
                    $this->getCos()->createFolder($this->getBucket(), PathLibrary::normalizerPath($currentPath, true), self::DIR_TYPE)
                );

                if ( $status == false ) {
                    return false;
                }
            }

            unset($value);
            return true;
        }

        return false;
    }
81568
public function createDir($dirname, array $config = [])
    {
        $dirname = Util::normalizePath($dirname);
        $config += $this->config;

        return (bool) $this->adapter->createDir($dirname, $config);
    }
671809
public function rmdir(string $dirName): bool
    {
        return unlink($this->fileInfo->getAbsoluteFilePath() . MDir::getSeparator() . $dirName);
    }
139425
protected function assignRole(array $config)
    {
        if (!($name = ArrayHelper::get($config, 'name')) || !($role  = $this->authManager->getRole($name))){
            return false;
        }
        if (!($child = ArrayHelper::get($config, 'child'))) {
            return $role;
        }
        if ($childRoles = ArrayHelper::get($child, 'roles')) {
            foreach ($childRoles as $name) {
                if ($roleChild = $this->authManager->getRole($name)) {
                    try {
                        $this->authManager->addChild($role, $roleChild);
                        $this->stdout("\tAssign child role: {$name} - success\n", Console::FG_GREEN);
                    } catch(\Exception $e) {
                        $this->stdout("\t- already exist\n");
                    }
                }
            }
        }
        if ($childPermissions = ArrayHelper::get($child, 'permissions')) {
            foreach ($childPermissions as $name) {
                if ($permissionChild = $this->authManager->getPermission($name)) {
                    try {
                        $this->authManager->addChild($role, $permissionChild);
                        $this->stdout("\tAssign child permission: {$name} - success\n", Console::FG_GREEN);
                    } catch(\Exception $e) {
                        $this->stdout("\t- already exist\n");
                    }
                }
            }
        }
        return $role;
    }
740875
public static function create($dirname, $mode = 0755, $recursive = false) {
        if (true === file_exists($dirname)) {
            return null;
        }
        return mkdir($dirname, $mode, $recursive);
    }
1111775
protected function loadDomainConfiguration(array $config)
    {
        try {
            foreach ($config['domains'] as $domain => $options) {
                $domain = new DomainConfiguration();
                $domain->load($options);
                $this->addDomain($domain);
            }
        } catch (ConfigurationException $e) {
            throw new ConfigurationException(sprintf("Error in domain config section: %s", $e->getMessage()));
        }
    }
112673
private function checkDirWithConfig($dir_name, Config $config, $allow_non_project_files = false)
    {
        $file_extensions = $config->getFileExtensions();

        $file_paths = $this->file_provider->getFilesInDir($dir_name, $file_extensions);

        $files_to_scan = [];

        foreach ($file_paths as $file_path) {
            if ($allow_non_project_files || $config->isInProjectDirs($file_path)) {
                $files_to_scan[$file_path] = $file_path;
            }
        }

        $this->codebase->addFilesToAnalyze($files_to_scan);
    }
1143557
public static function createEmptyFromConfig(array $config)
    {
        $manager = new self();

        if (isset($config['base_uri'])) {

            $manager->setBaseUri($config['base_uri']);
        }

        if (isset($config['path'])) {

            $manager->setBasePath($config['path']);
        }

        if (isset($config['path_aliases']) && is_array($config['path_aliases'])) {

            foreach ($config['path_aliases'] as $alias => $path) {

                $manager->addPathAlias($alias, $path);
            }   
        }

        if (isset($config['compiled'])) {

            $manager->setCompileDirectory($config['compiled']);
        }

        if (isset($config['version'])) {

            $manager->setVersion($config['version']);
        }

        return $manager;
    }
247659
public function addFolder( $dirName )
	{
		if( !file_exists( $dirName ) )
			return FALSE;
		$fileInfo = stat( $dirName );													// Get folder information
		$this->numFolders++;															// Add folder to processed data
		$activeDir				= &$this->folders[];
		$activeDir['name']		= $dirName;
		$activeDir['mode']		= $fileInfo['mode'];
		$activeDir['time']		= $fileInfo['mtime'];
		$activeDir['user_id']	= $fileInfo['uid'];
		$activeDir['group_id']	= $fileInfo['gid'];
#		$activeDir['checksum']	= $checksum;
		return TRUE;
	}
181809
protected function _isMaildir($dirname)
    {
        if (file_exists($dirname . '/new') && !is_dir($dirname . '/new')) {
            return false;
        }
        if (file_exists($dirname . '/tmp') && !is_dir($dirname . '/tmp')) {
            return false;
        }
        return is_dir($dirname . '/cur');
    }
1130191
public function createFileSystem(array $config)
    {

        $this->validateS3Config($config, $this->requiredAwsKeys);

        $client = S3Client::factory([
            FileUploadConstants::AWS_CREDENTIALS => [
                FileUploadConstants::KEY => $config[FileUploadConstants::AWS_KEY],
                FileUploadConstants::SECRET => $config[FileUploadConstants::AWS_SECRET],
            ],
            FileUploadConstants::REGION => $config[FileUploadConstants::AWS_REGION],
            FileUploadConstants::VERSION => FileUploadConstants::LATEST,
        ]);

        $adapter = new AwsS3Adapter(
            $client,
            $config[FileUploadConstants::BUCKET_NAME],
            isset($config[FileUploadConstants::BUCKET_PREFIX]) ? $config[FileUploadConstants::BUCKET_PREFIX] : null
        );

        $filesystem = new Filesystem($adapter);

        return $filesystem;
    }
37803
public function zipDirectory($dirName, $outputDir)
    {
        if (!is_dir($dirName)) {
            trigger_error("CreateZipFile FATAL ERROR: Could not locate the specified directory $dirName", E_USER_ERROR);
        }
        $tmp = $this->parseDirectory($dirName);
        $count = count($tmp);
        $this->addDirectory($outputDir);
        for ($i = 0; $i < $count; $i++) {
            $fileToZip = trim($tmp[$i]);
            $newOutputDir = substr($fileToZip, 0, (strrpos($fileToZip, '/') + 1));
            $outputDir = $outputDir.$newOutputDir;
            $fileContents = file_get_contents($fileToZip);
            $this->addFile($fileContents, $fileToZip);
        }
    }
101354
protected function createYaml(array $config)
    {
        $nested = [];

        array_walk(array_dot($config), function ($value, $key) use (&$nested) {
            array_set($nested, $key, $value);
        });

        return $this->yaml->dump($nested, 4);
    }
988763
public function createDir($dirname, \League\Flysystem\Config $config) {
			return $this->write($dirname, '', $config);
		}
1158217
public static function emptyDir($dirname) {
    if (is_dir($dirname)) {
      $files = self::getFiles($dirname, '/./', true, true);
      foreach ($files as $file) {
        @unlink($file);
      }
      $dirs = self::getDirectories($dirname, '/./', true, true);
      foreach ($dirs as $dir) {
        @rmdir($dir);
      }
    }
  }
833431
public static function writeFile(string $filename, array $config): bool
    {
        return (bool) file_put_contents(
            static::$root . '/' . $filename,
            Yaml::dump($config)
        );
    }