创建文件夹

@param string $dirname
@param array $config
@author yangyifan <yangyifanphp@gmail.com>
514794
public function createDir($dirname, Config $config)
    {
        $this->getUpyun()->makeDir(static::normalizerPath($dirname, true));
        return true;
    }
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);
      }
    }
  }
17189
public function connect(array $config = [], $linkNum = 0)
    {
        if (!isset($this->links[$linkNum])) {
            if (empty($config)) {
                $config = $this->config;
            } else {
                $config = array_merge($this->config, $config);
            }

            $this->dbName  = $config['database'];
            $this->typeMap = $config['type_map'];

            if ($config['pk_convert_id'] && '_id' == $config['pk']) {
                $this->config['pk'] = 'id';
            }

            $host = 'mongodb://' . ($config['username'] ? "{$config['username']}" : '') . ($config['password'] ? ":{$config['password']}@" : '') . $config['hostname'] . ($config['hostport'] ? ":{$config['hostport']}" : '') . '/' . ($config['database'] ? "{$config['database']}" : '');

            if ($config['debug']) {
                $startTime = microtime(true);
            }

            $this->links[$linkNum] = new Manager($host, $this->config['params']);

            if ($config['debug']) {
                // 记录数据库连接信息
                $this->logger('[ MongoDb ] CONNECT :[ UseTime:' . number_format(microtime(true) - $startTime, 6) . 's ] ' . $config['dsn']);
            }
        }

        return $this->links[$linkNum];
    }
728821
protected function translateTarget(array $config)
    {
        if (empty($config['dirname'])) {
            throw new Exception('invalid target: dirname has to be configured');
        }
        if (empty($config['filename'])) {
            throw new Exception('invalid target: filename has to be configured');
        }
        $dirname     = $config['dirname'];
        $filename    = $config['filename'];
        $compression = !empty($config['compression']) ? $config['compression'] : null;

        return new Target($dirname, $filename, $compression);
    }
940836
public static function remove($dirname)
    {
        if (!is_dir($dirname)) {
            return false;
        }

        $dir = dir($dirname);

        while (false !== $entry = $dir->read()) {
            if ($entry == '.' || $entry == '..') {
                continue;
            }
            $item = $dirname . '/' . $entry;

            if (is_dir($item)) {
                static::remove($item);
            } else {
                unlink($item);
            }
        }

        return rmdir($dirname);
    }
1085968
public function addChildren($dirPathname)
    {
        $files = new \RecursiveIteratorIterator(
            new \RecursiveDirectoryIterator($dirPathname, \FilesystemIterator::SKIP_DOTS),
            \RecursiveIteratorIterator::SELF_FIRST
        );

        foreach($files as $info)
        {
            $relativePathname = $this->subtractBasedir($info->getPathname(), $dirPathname);
            #echo sprintf("%s\n", $relativePathname);

            if ($info->isDir())
            {
                $this->zip->addEmptyDir($relativePathname);
            }
            else {
                $this->zip->addFile($info->getPathname(), $relativePathname);
            }
        }
    }
424769
public function createDir($dirname, array $config = [])
    {
        list($prefix, $dirname) = $this->getPrefixAndPath($dirname);

        return $this->getFilesystem($prefix)->createDir($dirname);
    }
631990
public function deleteDir($dirName)
    {
        $location = $this->applyPathPrefix($dirName);
        $lists = $this->listContents($location, true);
        if (!$lists) {
            return false;
        }
        $objectList = [];
        foreach ($lists as $value) {
            $objectList[] = $value['path'];
        }
        $this->ossClient->deleteObjects($this->bucket, $objectList);
        return true;
    }
890210
public function makeDirectory($dirname, $mode = 0777)
    {
        $connection = $this->getConnection();

        $directories = explode('/', $dirname);

        foreach ($directories as $directory) {
            if (false === $this->makeActualDirectory($directory, $mode)) {
                $this->setConnectionRoot();
                return false;
            }
            ftp_chdir($connection, $directory);
        }

        $this->setConnectionRoot();

        return true;
    }
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;
	}
833431
public static function writeFile(string $filename, array $config): bool
    {
        return (bool) file_put_contents(
            static::$root . '/' . $filename,
            Yaml::dump($config)
        );
    }
924351
public function createDir($dirname, Config $config)
    {
        return $this->client->putObject([
            'Bucket' => $this->getBucket(),
            'Key'    => $dirname.'/',
            'Body'   => '',
        ]);
    }
1112593
public function deleteDir($dirname)
    {
        $files = $this->listContents($dirname);
        foreach ($files as $file) {
            $this->delete($file['path']);
        }

        return true;
    }
1213100
public function deleteDir($dirname)
    {
        if (substr($dirname, -1, 1) != '/') {
            $dirname = $dirname . '/';
        }
        $result = $this->client->deleteObject($this->bucket, $dirname);

        return true;
    }
366714
public function createDir($dirname, Config $config)
    {
        list ($pdirId, $name) = $this->splitPath($dirname);

        $folder = $this->createDirectory($name, $pdirId);
        if ($folder) {
            $itemId = $folder->getId();
            $this->cacheFileObjectsByName[$pdirId . '/' . $name] = $folder; // for confirmation by getMetaData() oe has() while in this connection
            $this->cacheFileObjects[$itemId] = $folder;
            $this->cacheHasDirs[$itemId] = false;
            $path_parts = $this->splitFileExtension($name);
            $result = [
                'path' => Util::dirname($dirname) . '/' . $itemId,
                'filename' => $path_parts['filename'],
                'extension' => $path_parts['extension']
            ];
            return $result;
        }

        return false;
    }
818024
public static function writeToDisk(Config $config) : void
    {
        $filePath = $config->getPath();
        $file     = new Json($filePath);
        $file->write($config->getJsonData());
    }
1066992
public function makeDirectory($dirname, $mode = 0777, $recursive = false, array $option = [])
    {
        if (is_array($mode)) {
            $option = $mode;

            $mode = 0777;
        }

        if (is_array($recursive)) {
            $option = $recursive;

            $recursive = false;
        }
    }