drupal_mkdir

Versions
7
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.

See also

http://drupal.org/node/515192

See also

mkdir()

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.

Related topics

▾ 3 functions call drupal_mkdir()

drupal_install_mkdir in includes/install.inc
Create a directory with specified permissions.
file_prepare_directory in includes/file.inc
Check that the directory exists and is writable.
system_check_directory in modules/system/system.module
Checks the existence of the directory specified in $form_element. This function is called from the system_settings form to check both core file directories (file_public_path, file_private_path, file_temporary_path).

Code

includes/file.inc, line 1865

<?php
function drupal_mkdir($uri, $mode = NULL, $recursive = FALSE, $context = NULL) {

  if (is_null($mode)) {
    $mode = variable_get('file_chmod_directory', 0775);
  }

  if (is_null($context)) {
    return mkdir($uri, $mode, $recursive);
  }
  else {
    return mkdir($uri, $mode, $recursive, $context);
  }
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.