/**
  * Get the checksum for a harvested deposit file.
  *
  * @param Deposit $deposit
  *
  * @return string
  */
 private function getChecksum(Deposit $deposit)
 {
     $filePath = $this->filePaths->getHarvestFile($deposit);
     switch (strtoupper($deposit->getChecksumType())) {
         case 'SHA-1':
         case 'SHA1':
             return sha1_file($filePath);
         case 'MD5':
             return md5_file($filePath);
         default:
             $this->logger->error("Deposit checksum type {$deposit->getChecksumType()} unknown.");
     }
 }
Пример #2
0
 /**
  * Process one deposit. Fetch the data and write it to the file system.
  * Updates the deposit status, and may remove the processing files if 
  * LOCKSSOatic reports agreement.
  *
  * @param Deposit $deposit
  *
  * @return type
  */
 protected function processDeposit(Deposit $deposit, $force = false)
 {
     if ($deposit->getPlnState() === 'agreement') {
         $this->logger->notice($deposit->getDepositUuid());
         $this->delFileTree($this->filePaths->getHarvestFile($deposit), $force);
         $this->delFileTree($this->filePaths->getProcessingBagPath($deposit), $force);
         // $this->delFileTree($this->filePaths->getStagingBagPath($deposit), $force);
     }
 }
Пример #3
0
 public function testGetHarvestFile()
 {
     $deposit = $this->references->getReference('deposit');
     $path = $this->fp->getHarvestFile($deposit);
     $this->assertEquals(self::$tmpPath . '/received/C0A65967-32BD-4EE8-96DE-C469743E563A/D38E7ECB-7D7E-408D-94B0-B00D434FDBD2.zip', $path);
 }