W3cubDocs

/Drupal 8

function drupal_install_mkdir

drupal_install_mkdir($file, $mask, $message = TRUE)

Creates a directory with the specified permissions.

Parameters

$file: The name of the directory to create;

$mask: The permissions of the directory to create.

$message: (optional) Whether to output messages. Defaults to TRUE.

Return value

TRUE/FALSE whether or not the directory was successfully created.

File

core/includes/install.inc, line 730
API functions for installing modules and themes.

Code

function drupal_install_mkdir($file, $mask, $message = TRUE) {
  $mod = 0;
  $masks = array(FILE_READABLE, FILE_WRITABLE, FILE_EXECUTABLE, FILE_NOT_READABLE, FILE_NOT_WRITABLE, FILE_NOT_EXECUTABLE);
  foreach ($masks as $m) {
    if ($mask & $m) {
      switch ($m) {
        case FILE_READABLE:
          $mod |= 0444;
          break;
        case FILE_WRITABLE:
          $mod |= 0222;
          break;
        case FILE_EXECUTABLE:
          $mod |= 0111;
          break;
      }
    }
  }

  if (@drupal_mkdir($file, $mod)) {
    return TRUE;
  }
  else {
    return FALSE;
  }
}

© 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/core!includes!install.inc/function/drupal_install_mkdir/8.1.x