function LocalStream::mkdir
Same name in other branches
- 9 core/lib/Drupal/Core/StreamWrapper/LocalStream.php \Drupal\Core\StreamWrapper\LocalStream::mkdir()
- 10 core/lib/Drupal/Core/StreamWrapper/LocalStream.php \Drupal\Core\StreamWrapper\LocalStream::mkdir()
- 11.x core/lib/Drupal/Core/StreamWrapper/LocalStream.php \Drupal\Core\StreamWrapper\LocalStream::mkdir()
Support for mkdir().
Parameters
string $uri: A string containing the URI to the directory to create.
int $mode: Permission flags - see mkdir().
int $options: A bit mask of STREAM_REPORT_ERRORS and STREAM_MKDIR_RECURSIVE.
Return value
bool TRUE if directory was successfully created.
Overrides PhpStreamWrapperInterface::mkdir
See also
http://php.net/manual/streamwrapper.mkdir.php
1 method overrides LocalStream::mkdir()
- LocalReadOnlyStream::mkdir in core/
lib/ Drupal/ Core/ StreamWrapper/ LocalReadOnlyStream.php - Support for mkdir().
File
-
core/
lib/ Drupal/ Core/ StreamWrapper/ LocalStream.php, line 439
Class
- LocalStream
- Defines a Drupal stream wrapper base class for local files.
Namespace
Drupal\Core\StreamWrapperCode
public function mkdir($uri, $mode, $options) {
$this->uri = $uri;
$recursive = (bool) ($options & STREAM_MKDIR_RECURSIVE);
if ($recursive) {
// $this->getLocalPath() fails if $uri has multiple levels of directories
// that do not yet exist.
$localpath = $this->getDirectoryPath() . '/' . $this->getTarget($uri);
}
else {
$localpath = $this->getLocalPath($uri);
}
/** @var \Drupal\Core\File\FileSystemInterface $file_system */
$file_system = \Drupal::service('file_system');
if ($options & STREAM_REPORT_ERRORS) {
return $file_system->mkdir($localpath, $mode, $recursive);
}
else {
return @$file_system->mkdir($localpath, $mode, $recursive);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.