You are here

class FailedCheckumFilter in Automatic Updates 7

Same name and namespace in other branches
  1. 8 vendor/drupal/php-signify/src/FailedCheckumFilter.php \Drupal\Signify\FailedCheckumFilter

Hierarchy

Expanded class hierarchy of FailedCheckumFilter

2 files declare their use of FailedCheckumFilter
InPlaceUpdate.php in ./InPlaceUpdate.php
ModifiedFilesService.php in ./ModifiedFilesService.php

File

vendor/drupal/php-signify/src/FailedCheckumFilter.php, line 7

Namespace

Drupal\Signify
View source
class FailedCheckumFilter extends \FilterIterator {
  protected $workingDirectory;
  public function __construct(Iterator $iterator, $working_directory) {
    parent::__construct($iterator);
    $this->workingDirectory = $working_directory;
  }

  /**
   * {@inheritdoc}
   */
  public function accept() {

    /** @var \Drupal\Signify\VerifierFileChecksum $checksum */
    $checksum = $this
      ->current();
    $hash_file_path = $this->workingDirectory . DIRECTORY_SEPARATOR . $checksum->filename;
    $algorithm = strtolower($checksum->algorithm);
    $hash = @hash_file($algorithm, $hash_file_path);
    return $hash !== $checksum->hex_hash;
  }

}

Members