You are here

protected function MigrateFileBlob::copyFile in Migrate 7.2

Implementation of MigrateFile::copyFile().

Parameters

$destination: Drupal destination path.

Return value

bool TRUE if the file contents were successfully written, FALSE otherwise.

Overrides MigrateFile::copyFile

File

plugins/destinations/file.inc, line 501
Support for file entity as destination. Note that File Fields have their own destination in fields.inc

Class

MigrateFileBlob
Handle cases where we're handed a blob (i.e., the actual contents of a file, such as image data) to be stored as a real file in Drupal.

Code

protected function copyFile($destination) {
  if (file_put_contents($destination, $this->fileContents)) {
    return TRUE;
  }
  else {
    $migration = Migration::currentMigration();
    $migration
      ->saveMessage(t('Failed to write blob data to %destination', array(
      '%destination' => $destination,
    )));
    return FALSE;
  }
}