You are here

function filehash_save in File Hash 8

Same name and namespace in other branches
  1. 7 filehash.module \filehash_save()

Saves the file hashes.

3 calls to filehash_save()
filehash_file_insert in ./filehash.module
Implements hook_ENTITY_TYPE_insert().
filehash_file_load in ./filehash.module
Implements hook_ENTITY_TYPE_load().
filehash_file_update in ./filehash.module
Implements hook_ENTITY_TYPE_update().

File

./filehash.module, line 226
Generate hashes for each uploaded file.

Code

function filehash_save(FileInterface $file) {
  \Drupal::database()
    ->merge('filehash')
    ->key([
    'fid' => $file
      ->id(),
  ])
    ->fields($file->filehash)
    ->execute();
}