Public method mkcol

Creates a new collection/directory on a webdav server
@param string path
@return int status code received as response from webdav server (see rfc 2518)
774900
function mkcol($path) {
        $this->_path = $this->translate_uri($path);
        $this->header_unset();
        $this->create_basic_request('MKCOL');
        $this->send_request();
        $this->get_respond();
        $response = $this->process_respond();
        // validate the response ...
        // check http-version
        $http_version = $response['status']['http-version'];
        if ($http_version == 'HTTP/1.1' || $http_version == 'HTTP/1.0') {
            /** seems to be http ... proceed
             * just return what server gave us
             * rfc 2518 says:
             * 201 (Created) - The collection or structured resource was created in its entirety.
             * 403 (Forbidden) - This indicates at least one of two conditions:
             *    1) the server does not allow the creation of collections at the given location in its namespace, or
             *    2) the parent collection of the Request-URI exists but cannot accept members.
             * 405 (Method Not Allowed) - MKCOL can only be executed on a deleted/non-existent resource.
             * 409 (Conflict) - A collection cannot be made at the Request-URI until one or more intermediate
             *                  collections have been created.
             * 415 (Unsupported Media Type)- The server does not support the request type of the body.
             * 507 (Insufficient Storage) - The resource does not have sufficient space to record the state of the
             *                              resource after the execution of this method.
             */
            return $response['status']['status-code'];
        }

    }
312767
protected function createDir($path) {
        if (!is_dir($path)) {
            $this->log->info('Create directory %s', $path);

            $status = mkdir($path, 0775, true);

            if ($status === false) {
                throw new Exception(sprintf(
                    'Unable to create directory %s',
                    $path
                ), ExitApp::RUNTIME_ERROR);
            }
        }

        return $this;
    }
716954
private function makePath($path)
    {
        $path = dirname($path);
        if (!is_dir($path) && !mkdir($path, 0700, true)) {
            throw new MkdirErrorException(Lang::get('_CREATE_DIR_ERROR_') . "[{$path}]");
        }
        return true;
    }
923013
public function addCommandDir(string $path) : self
    {
        $declared = get_declared_classes();

        $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(rtrim($path)));
        $files = new RegexIterator($iterator, '`^.*\.php$`', RegexIterator::GET_MATCH);

        foreach ($files as $file) {
            if (array_search($file[0], get_included_files()) === false) {
                require $file[0];
            }
        }

        $currentClasses = get_declared_classes();

        foreach (array_diff($currentClasses, $declared) as $class) {
            $reflection = new \ReflectionClass($class);
            if ($reflection->isInstantiable() && is_subclass_of($class, Command::class)) {
                self::$application->add(new $class());
            }
        }

        return $this;
    }
909911
public static function createFromPath(
        $path,
        $method = 'GET',
        $query = [],
        $post = []
    ) {
        $request = new ServerRequest(
            [],
            [],
            new Uri($path),
            $method ?: 'GET',
            'php://input',
            []
        );

        return $request
            ->withQueryParams($query)
            ->withParsedBody($post);
    }
153152
static function createDirectories($path) {

		if (!$path) throw new \InvalidArgumentException("\$path can not be empty.");

		/*
		$parts=explode("/",$path);
		$pathPart="";
		foreach($parts as $i=>$p) {
			if ($i) $pathPart.="/";
			$pathPart.=$p;
			if ($pathPart) {
				if (@file_exists($pathPart) and !is_dir($pathPart)) {
					throw new FileException("\"$pathPart\" is a regular file!");
				}
				if (!(@file_exists($pathPart))) {
					self::mkdir($pathPart,false);
				}
			}
		}
		return $pathPart;
		 *
		 */

		if (file_exists($path)) {
			if (is_dir($path)) {
				return $path;
			}
			throw new FileException("\"$path\" is a regular file!");
		}

		$ret = @mkdir($path, 0777, true);
		if (!$ret) {
			throw new FileException("Directory \"$path\ could not be created.");
		}

		return $path;
	}
892723
@Override
  public int mkdir(String path, @mode_t long mode) {
    final AlluxioURI turi = mPathResolverCache.getUnchecked(path);
    LOG.trace("mkdir({}) [Alluxio: {}]", path, turi);
    try {
      mFileSystem.createDirectory(turi);
    } catch (FileAlreadyExistsException e) {
      LOG.debug("Failed to create directory {}, directory already exists", path);
      return -ErrorCodes.EEXIST();
    } catch (InvalidPathException e) {
      LOG.debug("Failed to create directory {}, path is invalid", path);
      return -ErrorCodes.ENOENT();
    } catch (Throwable t) {
      LOG.error("Failed to create directory {}", path, t);
      return AlluxioFuseUtils.getErrorCode(t);
    }

    return 0;
  }
1134769
function mkdir( $path, /* Optional args are ignored */ $chmod = false, $chown = false, $chgrp = false ) {
		$path = trailingslashit( $path );

		$parent_node = $this->locate_parent_node( $path );
		if ( ! $parent_node ) {
			$dirname = str_replace( '\\', '/', dirname( $path ) );
			$this->mkdir( $dirname );
			$parent_node = $this->locate_parent_node( $path );
			if ( ! $parent_node )
				return false;
		}

		$node = new MockFS_Directory_Node( $path );

		$parent_node->children[ $node->name ] = $node;
		$this->fs_map[ $path ] = $node;

		return true;
	}
676471
public function makeDir($path, $auto_mkdir = false) {/*{{{*/
        $headers = array('Folder' => 'true');
        if ($auto_mkdir) $headers['Mkdir'] = 'true';
        return $this->_do_request('PUT', $path, $headers);
    }
777618
public function plainTextAction($path)
    {
        try {
            $this->setPath($path);
        } catch (NotFoundException $e) {
            throw $e;
        }

        $dbfile = new WDBFile($this->getpath());
        if (!$dbfile->isFile()) {
            throw new NotFoundException(
                'Can not send raw content of a directory!',
                0, null, TemplateHelper::getRoute($dbfile->getWDBPath())
            );
        }

        $response = $this->wdb->getResponse();

        // mime header
        $finfo = finfo_open(FILEINFO_MIME_TYPE);
        $mime = finfo_file($finfo, $this->getPath());
        if ( ! in_array($mime, $response::$content_types)) {
            $mime = 'text/plain';
        }
        finfo_close($finfo);

        // content
        $ctt = $response->flush(file_get_contents($this->getPath()), $mime);
        return array('layout_empty_txt', $ctt);
    }
78051
public function createResource($path)
    {
        $response = $this->httpRequest($path, Requests::POST, $this);

        return $this->populate($response);
    }
281611
public static function createDir($path) {

        $dir  = explode('/', $path);
        $path = '';
        foreach ($dir as $element) {
            $path .= $element . '/';
            if (!is_dir($path) && !mkdir($path)) {
                throw new BadRequestException(
                    T('create file path Error: {filePath}', array('filepath' => $path))
                );
            }
        }
    }
83528
private function createDir($path)
    {
        if (!is_dir($path)) {
            $success = mkdir($path, 0775, true);
            if (!$success) {
                throw new \Exception("Cannot create folder {$path}. Check file system permissions.");
            }
        }
    }
754654
public void makeDirectory(String path) throws SftpStatusException,
			SshException {
		makeDirectory(path, new SftpFileAttributes(this,
				SftpFileAttributes.SSH_FILEXFER_TYPE_DIRECTORY));
	}
915594
public function makeDirectory($path, $mode, $options): ?EntityInterface
    {
        $result = null;

        $entity = $this->getEntity($path);
        if (null === $entity && $options & STREAM_MKDIR_RECURSIVE) {
            $this->makeDirectory(dirname($path), $mode, $options);

            $entity = $this->getEntity($path);
        }
        if (null !== $entity) {
            if (!$entity->file_exists()) {
                $dir = $this->tempnam();
                $this->fs->mkdir($dir, $mode);

                $result = Virtual::newInstance($entity, $dir);

                $changes = $this->getChanges();
                $changes->add($path, $result);
            }
        }

        if (null === $result && ($options & STREAM_REPORT_ERRORS)) {
            trigger_error(
                "Could not create directory '$path'", E_USER_WARNING
            );
        }

        return $result;
    }
1235064
public function archive(?string $id, string $path)
    {
        $url = self::$base_url.'/'.($id ?? $this->container_id).'/archive?'.http_build_query(['path' => $path]);

        return self::$curl->get($url);
    }
120034
public static function createFolder($path)
    {
        $path = self::resolve($path);

        return $path && (is_dir($path) || mkdir($path, 0700, true));
    }