You are here

protected function MigrateDestinationFile::fileDelete in Migrate 7.2

Delete database references to a file without deleting the file itself.

Parameters

$file:

1 call to MigrateDestinationFile::fileDelete()
MigrateDestinationFile::rollback in plugins/destinations/file.inc
Delete a file entry.

File

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

Class

MigrateDestinationFile
Destination class implementing migration into the files table.

Code

protected function fileDelete($file) {

  // Let other modules clean up any references to the deleted file.
  module_invoke_all('file_delete', $file);
  module_invoke_all('entity_delete', $file, 'file');
  db_delete('file_managed')
    ->condition('fid', $file->fid)
    ->execute();
  db_delete('file_usage')
    ->condition('fid', $file->fid)
    ->execute();
}