function FileSystemInterface::prepareDirectory

Same name in other branches
  1. 9 core/lib/Drupal/Core/File/FileSystemInterface.php \Drupal\Core\File\FileSystemInterface::prepareDirectory()
  2. 8.9.x core/lib/Drupal/Core/File/FileSystemInterface.php \Drupal\Core\File\FileSystemInterface::prepareDirectory()
  3. 11.x core/lib/Drupal/Core/File/FileSystemInterface.php \Drupal\Core\File\FileSystemInterface::prepareDirectory()

Checks that the directory exists and is writable.

Directories need to have execute permissions to be considered a directory by FTP servers, etc.

Parameters

string $directory: A string reference containing the name of a directory path or URI. A trailing slash will be trimmed from a path.

int $options: A bitmask to indicate if the directory should be created if it does not exist (FileSystemInterface::CREATE_DIRECTORY) or made writable if it is read-only (FileSystemInterface::MODIFY_PERMISSIONS).

Return value

bool TRUE if the directory exists (or was created) and is writable. FALSE otherwise.

File

core/lib/Drupal/Core/File/FileSystemInterface.php, line 414

Class

FileSystemInterface
Provides an interface for helpers that operate on files and stream wrappers.

Namespace

Drupal\Core\File

Code

public function prepareDirectory(&$directory, $options = self::MODIFY_PERMISSIONS);

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.