You are here

function hackedFileIgnoreEndingsHasher::perform_hash in Hacked! 8.2

Returns a hash of the given filename.

Ignores file line endings.

Overrides hackedFileHasher::perform_hash

File

src/hackedFileIgnoreEndingsHasher.php, line 15

Class

hackedFileIgnoreEndingsHasher
Class hackedFileIgnoreEndingsHasher @package Drupal\hacked

Namespace

Drupal\hacked

Code

function perform_hash($filename) {
  if (!hacked_file_is_binary($filename)) {
    $file = file($filename, FILE_IGNORE_NEW_LINES);
    return sha1(serialize($file));
  }
  else {
    return sha1_file($filename);
  }
}