You are here

function multiversion_prepare_file_destination in Multiversion 8.2

Same name and namespace in other branches
  1. 8 multiversion.module \multiversion_prepare_file_destination()

Prepares a file destination directory.

If the directory doesn't exist it tries to create it, if the directory is not writable it tries to make it writable. In case it can't create the directory or make it writable, logs the error message and returns FALSE. When the directory exists and it is writable returns TRUE.

Parameters

string $destination:

Return value

bool

1 call to multiversion_prepare_file_destination()
ContentEntityStorageTrait::save in src/Entity/Storage/ContentEntityStorageTrait.php

File

./multiversion.module, line 388

Code

function multiversion_prepare_file_destination($destination) {
  $dirname = \Drupal::service('file_system')
    ->dirname($destination);
  return file_prepare_directory($dirname, FILE_MODIFY_PERMISSIONS | FILE_CREATE_DIRECTORY);
}