Ejemplo n.º 1
0
 /**
  * @covers Aws\Common\Hash\TreeHash::validateChecksum
  */
 public function testValidatingChecksumWorksCorrectly()
 {
     $d = $this->getTestData();
     $this->assertTrue(TreeHash::validateChecksum($d->content, $d->checksum));
 }
Ejemplo n.º 2
0
function downloadJob(Job $job)
{
    $filename = "E:/glacier/storage/" . $job->get('start') . "-" . $job->get('end');
    $oResult = client()->getJobOutput(array('accountId' => '-', 'vaultName' => VAULT, 'jobId' => $job->get('jobId'), 'saveAs' => $filename));
    $contents = file_get_contents($filename);
    $checksum = $oResult->get('checksum');
    $equal = \Aws\Common\Hash\TreeHash::validateChecksum($contents1, $checksum);
    if (!$equal) {
        echo "Restarting job due to incorrect checksum: {$resulting_checksum} is not equal to {$checksum}";
        $job->set('finished', 0);
        $job->set('running', 0);
    } else {
        echo "downloaded job: " . $job->get('jobId') . PHP_EOL;
        $job->set('hash', $oResult->get('checksum'));
        $job->set('finished', 1);
        $job->set('running', 0);
    }
}