Пример #1
0
 /**
  * Checks if the ProcessedFile needs reprocessing
  *
  * @return bool
  */
 public function needsReprocessing()
 {
     $fileMustBeRecreated = false;
     // if original is missing we can not reprocess the file
     if ($this->originalFile->isMissing()) {
         return false;
     }
     // processedFile does not exist
     if (!$this->usesOriginalFile() && !$this->exists()) {
         $fileMustBeRecreated = true;
     }
     // hash does not match
     if (array_key_exists('checksum', $this->properties) && $this->calculateChecksum() !== $this->properties['checksum']) {
         $fileMustBeRecreated = true;
     }
     // original file changed
     if ($this->originalFile->getSha1() !== $this->originalFileSha1) {
         $fileMustBeRecreated = true;
     }
     if (!array_key_exists('uid', $this->properties)) {
         $fileMustBeRecreated = true;
     }
     // remove outdated file
     if ($fileMustBeRecreated && $this->exists()) {
         $this->delete();
     }
     return $fileMustBeRecreated;
 }
Пример #2
0
 /**
  * Returns the Sha1 of this file
  *
  * @return string
  */
 public function getSha1()
 {
     return $this->originalFile->getSha1();
 }