1 stream_wrappers.inc public BackdropLocalStreamWrapper::mkdir($uri, $mode, $options)

Support for mkdir().

Parameters

$uri: A string containing the URI to the directory to create.

$mode: Permission flags - see mkdir().

$options: A bit mask of STREAM_REPORT_ERRORS and STREAM_MKDIR_RECURSIVE.

Return value

TRUE if directory was successfully created.:

Overrides StreamWrapperInterface::mkdir

See also

http://php.net/manual/streamwrapper.mkdir.php

File

core/includes/stream_wrappers.inc, line 779
Backdrop stream wrapper interface.

Class

BackdropLocalStreamWrapper
Backdrop stream wrapper base class for local files.

Code

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.
    $local_path = $this->getDirectoryPath() . '/' . $this->getTarget($uri);
  }
  else {
    $local_path = $this->getLocalPath($uri);
  }
  if ($options & STREAM_REPORT_ERRORS) {
    return mkdir($local_path, $mode, $recursive);
  }
  else {
    return @mkdir($local_path, $mode, $recursive);
  }
}