You are here

protected function FileBlob::getOverwriteMode in Migrate Plus 8.4

Same name and namespace in other branches
  1. 8.5 src/Plugin/migrate/process/FileBlob.php \Drupal\migrate_plus\Plugin\migrate\process\FileBlob::getOverwriteMode()
  2. 8.2 src/Plugin/migrate/process/FileBlob.php \Drupal\migrate_plus\Plugin\migrate\process\FileBlob::getOverwriteMode()
  3. 8.3 src/Plugin/migrate/process/FileBlob.php \Drupal\migrate_plus\Plugin\migrate\process\FileBlob::getOverwriteMode()

Determines how to handle file conflicts.

Return value

int Either FileSystemInterface::EXISTS_REPLACE; (default) or FileSystemInterface::EXISTS_ERROR, depending on the configuration.

1 call to FileBlob::getOverwriteMode()
FileBlob::transform in src/Plugin/migrate/process/FileBlob.php
Performs the associated process.

File

src/Plugin/migrate/process/FileBlob.php, line 200

Class

FileBlob
Copy a file from a blob into a file.

Namespace

Drupal\migrate_plus\Plugin\migrate\process

Code

protected function getOverwriteMode() {

  // TODO: remove after 8.6 is no longer supported in
  // https://www.drupal.org/project/migrate_plus/issues/3035587
  if (isset($this->configuration['reuse']) && !empty($this->configuration['reuse'])) {
    if (version_compare(\Drupal::VERSION, '8.7', '>=')) {
      return FileSystemInterface::EXISTS_ERROR;
    }
    else {
      return FILE_EXISTS_ERROR;
    }
  }
  if (version_compare(\Drupal::VERSION, '8.7', '>=')) {
    return FileSystemInterface::EXISTS_REPLACE;
  }
  else {
    return FILE_EXISTS_REPLACE;
  }
}