function _make_verify_checksums

8.0.x _make_verify_checksums($info, $filename)
6.x _make_verify_checksums($info, $filename)
7.x _make_verify_checksums($info, $filename)
5.x _make_verify_checksums($info, $filename)
master _make_verify_checksums($info, $filename)

Test that any supplied hash values match the hash of the file content.

Unsupported hash algorithms are reported as failure.

2 calls to _make_verify_checksums()
DrushMakeProject::applyPatches in commands/make/
Retrieve and apply any patches specified by the makefile to this project.
make_download_file in commands/make/
Downloads a file to the specified location.


commands/make/, line 459
Download-specific functions for Drush Make.


function _make_verify_checksums($info, $filename) {
  $hash_algos = array('md5', 'sha1', 'sha256', 'sha512');
  // We only have something to do if a key is an
  // available function.
  if (array_intersect(array_keys($info), $hash_algos)) {
    $content = file_get_contents($filename);
    foreach ($hash_algos as $algo) {
      if (!empty($info[$algo])) {
        $hash = _make_hash($algo, $content);
        if ($hash !== $info[$algo]) {
          $args = array(
            '@algo' => $algo,
            '@file' => basename($filename),
            '@expected' => $info[$algo],
            '@hash' => $hash,
          make_error('DOWNLOAD_ERROR', dt('Checksum @algo verification failed for @file. Expected @expected, received @hash.', $args));
          return FALSE;
  return TRUE;