You are here

private function MediaMigrateCommands::isLocalUri in Migrate File Entities to Media Entities 8

Determines if the given URI or path is considered local.

A URI or path is considered local if it either has no scheme component, or the scheme is implemented by a stream wrapper which extends \Drupal\Core\StreamWrapper\LocalStream.

Parameters

string $uri: The URI or path to test.

Return value

bool

1 call to MediaMigrateCommands::isLocalUri()
MediaMigrateCommands::duplicateImageDetection in src/Commands/MediaMigrateCommands.php
Find duplicate file entities.

File

src/Commands/MediaMigrateCommands.php, line 498

Class

MediaMigrateCommands
Drush 9 commands for migrate_file_to_media.

Namespace

Drupal\migrate_file_to_media\Commands

Code

private function isLocalUri($uri) {
  $scheme = $this->streamWrapperManager
    ->getScheme($uri);

  // The vfs scheme is vfsStream, which is used in testing. vfsStream is a
  // simulated file system that exists only in memory, but should be treated
  // as a local resource.
  if ($scheme == 'vfs') {
    $scheme = FALSE;
  }
  return $scheme === FALSE || $this->streamWrapperManager
    ->getViaScheme($scheme) instanceof LocalStream;
}