You are here

protected function EntityFile::writeFile in Zircon Profile 8.0

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

Tries to move or copy a file.

Parameters

string $source: The source path or URI.

string $destination: The destination path or URI.

integer $replace: FILE_EXISTS_REPLACE (default) or FILE_EXISTS_RENAME.

Return value

bool TRUE on success, FALSE on failure.

1 call to EntityFile::writeFile()
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 157
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 writeFile($source, $destination, $replace = FILE_EXISTS_REPLACE) {
  if ($this->configuration['move']) {
    return (bool) file_unmanaged_move($source, $destination, $replace);
  }
  else {
    $destination = file_destination($destination, $replace);
    $source = $this
      ->urlencode($source);
    return @copy($source, $destination);
  }
}