You are here

function drupal_mkdir in Drupal 8

Same name and namespace in other branches
  1. 7 includes/file.inc \drupal_mkdir()

Creates a directory, optionally creating missing components in the path to the directory.

Deprecated

in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\File\FileSystem::mkdir().

See also

https://www.drupal.org/node/2418133

Related topics

1 call to drupal_mkdir()
FileSystemDeprecationTest::testDeprecatedDrupalMkdir in core/tests/Drupal/KernelTests/Core/File/FileSystemDeprecationTest.php
@expectedDeprecation drupal_mkdir() is deprecated in Drupal 8.0.0 and will be removed before Drupal 9.0.0. Use \Drupal\Core\File\FileSystemInterface::mkdir(). See https://www.drupal.org/node/2418133.

File

core/includes/file.inc, line 1085
API for handling file uploads and server file management.

Code

function drupal_mkdir($uri, $mode = NULL, $recursive = FALSE, $context = NULL) {
  @trigger_error('drupal_mkdir() is deprecated in Drupal 8.0.0 and will be removed before Drupal 9.0.0. Use \\Drupal\\Core\\File\\FileSystemInterface::mkdir(). See https://www.drupal.org/node/2418133.', E_USER_DEPRECATED);
  return \Drupal::service('file_system')
    ->mkdir($uri, $mode, $recursive, $context);
}