drupal_mkdir

  1. drupal
    1. 8
    2. 7
Versions
7 – 8 drupal_mkdir($uri, $mode = NULL, $recursive = FALSE, $context = NULL)

Creates a directory using Drupal's default mode.

PHP's mkdir() does not respect Drupal's default permissions mode. If a mode is not provided, this function will make sure that Drupal's is used.

Compatibility: normal paths and stream wrappers.

Parameters

$uri A URI or pathname.

$mode By default the Drupal mode is used.

$recursive Default to FALSE.

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

Return value

Boolean TRUE on success, or FALSE on failure.

See also

http://drupal.org/node/515192

mkdir()

Related topics

▾ 7 functions call drupal_mkdir()

Archive_Tar::_dirCheck in modules/system/system.tar.inc
Check if a directory exists and create it (including parent dirs) if not.
Archive_Tar::_extractList in modules/system/system.tar.inc
drupal_install_mkdir in includes/install.inc
Create a directory with specified permissions.
FileTestCase::createDirectory in modules/simpletest/tests/file.test
Create a directory and assert it exists.
file_prepare_directory in includes/file.inc
Check that the directory exists and is writable.
RetrieveFileTestCase::testFileRetrieving in modules/system/system.test
Invokes system_retrieve_file() in several scenarios.
system_check_directory in modules/system/system.module
Checks the existence of the directory specified in $form_element.

Code

includes/file.inc, line 2293

<?php
function drupal_mkdir($uri, $mode = NULL, $recursive = FALSE, $context = NULL) {
  if (!isset($mode)) {
    $mode = variable_get('file_chmod_directory', 0775);
  }

  if (!isset($context)) {
    return mkdir($uri, $mode, $recursive);
  }
  else {
    return mkdir($uri, $mode, $recursive, $context);
  }
}
?>