MCPcopy Create free account
hub / github.com/error311/FileRise / mkdir

Method mkdir

src/FileRise/Storage/WebDavAdapter.php:320–348  ·  view source on GitHub ↗
(string $path, int $mode = 0775, bool $recursive = true)

Source from the content-addressed store, hash-verified

318 }
319
320 public function mkdir(string $path, int $mode = 0775, bool $recursive = true): bool
321 {
322 $rel = trim($this->relativePath($path), '/');
323 if ($rel === '') {
324 return true;
325 }
326 $parts = array_values(array_filter(explode('/', $rel), fn($p) => $p !== ''));
327 if (!$parts) {
328 return true;
329 }
330
331 $acc = '';
332 foreach ($parts as $part) {
333 $acc = ($acc === '') ? $part : ($acc . '/' . $part);
334 if (!$recursive && $acc !== $rel) {
335 continue;
336 }
337 $url = $this->buildUrlForRelative($acc);
338 $status = $this->request('MKCOL', $url, null, []);
339 if ($status >= 200 && $status < 300) {
340 continue;
341 }
342 if ($status === 405) {
343 continue;
344 }
345 return false;
346 }
347 return true;
348 }
349
350 private static function ensureSabreLoaded(): void
351 {

Callers 15

ensureParentExistsMethod · 0.95
ensureRemoteUploadDirMethod · 0.45
resolveFolderPathMethod · 0.45
deleteFilesMethod · 0.45
saveFileMethod · 0.45
restoreFilesMethod · 0.45
deleteTrashFilesMethod · 0.45
resolveFolderPathMethod · 0.45

Calls 3

relativePathMethod · 0.95
buildUrlForRelativeMethod · 0.95
requestMethod · 0.95

Tested by

no test coverage detected