You are here

public function FileSystemInterface::mkdir in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/File/FileSystemInterface.php \Drupal\Core\File\FileSystemInterface::mkdir()

Creates a directory, optionally creating missing components in the path to the directory.

When PHP's mkdir() creates a directory, the requested mode is affected by the process's umask. This function overrides the umask and sets the mode explicitly for all directory components created.

@todo Update with open_basedir compatible recursion logic from \Drupal\Component\PhpStorage\FileStorage::ensureDirectory().

Parameters

string $uri: A URI or pathname.

int $mode: Mode given to created directories. Defaults to the directory mode configured in the Drupal installation. It must have a leading zero.

bool $recursive: Create directories recursively, defaults to FALSE. Cannot work with a mode which denies writing or execution to the owner of the process.

resource $context: Refer to http://php.net/manual/ref.stream.php

Return value

bool Boolean TRUE on success, or FALSE on failure.

See also

mkdir()

https://www.drupal.org/node/515192

Related topics

1 method overrides FileSystemInterface::mkdir()
FileSystem::mkdir in core/lib/Drupal/Core/File/FileSystem.php
Creates a directory, optionally creating missing components in the path to the directory.

File

core/lib/Drupal/Core/File/FileSystemInterface.php, line 190

Class

FileSystemInterface
Provides an interface for helpers that operate on files and stream wrappers.

Namespace

Drupal\Core\File

Code

public function mkdir($uri, $mode = NULL, $recursive = FALSE, $context = NULL);