DrupalLocalStreamWrapper::mkdir

public function DrupalLocalStreamWrapper::mkdir

public DrupalLocalStreamWrapper::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

includes/stream_wrappers.inc, line 627
Drupal stream wrapper interface.

Class

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

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!stream_wrappers.inc/function/DrupalLocalStreamWrapper::mkdir/7.x

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部