You are here

protected function EntityFile::getDirectory in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/file/src/Plugin/migrate/destination/EntityFile.php \Drupal\file\Plugin\migrate\destination\EntityFile::getDirectory()

Returns the directory component of a URI or path.

For URIs like public://foo.txt, the full physical path of public:// will be returned, since a scheme by itself will trip up certain file API functions (such as file_prepare_directory()).

Parameters

string $uri: The URI or path.

Return value

string|false The directory component of the path or URI, or FALSE if it could not be determined.

1 call to EntityFile::getDirectory()
EntityFile::import in core/modules/file/src/Plugin/migrate/destination/EntityFile.php
Import the row.

File

core/modules/file/src/Plugin/migrate/destination/EntityFile.php, line 201
Contains \Drupal\file\Plugin\migrate\destination\EntityFile.

Class

EntityFile
Every migration that uses this destination must have an optional dependency on the d6_file migration to ensure it runs first.

Namespace

Drupal\file\Plugin\migrate\destination

Code

protected function getDirectory($uri) {
  $dir = $this->fileSystem
    ->dirname($uri);
  if (substr($dir, -3) == '://') {
    return $this->fileSystem
      ->realpath($dir);
  }
  else {
    return $dir;
  }
}