1 file.entity.inc public FileStorageController::preDelete($entities)

Overrides EntityDatabaseStorageController::preDelete().

Parameters

File[] $entities: The file entities about to be deleted.

Overrides EntityDatabaseStorageController::preDelete

File

core/modules/file/file.entity.inc, line 319
Entity controller and class for files.

Class

FileStorageController
File storage controller for files.

Code

public function preDelete($entities) {
  foreach ($entities as $entity) {
    // Delete the actual file. Failures due to invalid files and files that
    // were already deleted are logged to watchdog but ignored, the
    // corresponding file entity will be deleted.
    file_unmanaged_delete($entity->uri);
  }
  // Delete corresponding file usage entries.
  db_delete('file_usage')
    ->condition('fid', array_keys($entities), 'IN')
    ->execute();
}