Esempio n. 1
0
 public function setHash(FileHash $fh)
 {
     $fn = $fh->getFilename();
     $hash = $fh->getHash();
     print_r($fn);
     foreach ($this->data->file as $file) {
         if ($file->name == $fn) {
             $file->hash = $hash;
             return TRUE;
         }
     }
     $db = $this->data[0];
     $f = $db->addChild('file');
     $f->addChild('name', $fn);
     $f->addChild('hash', $hash);
 }
Esempio n. 2
0
 /**
  * Stores the hash and filename specified by FileHash.  Overwrites the stored hash, if it exists.
  * @param FileHash $fh
  */
 public function setHash(FileHash $fh)
 {
     $fn = $fh->getFilename();
     $hash = $fh->getHash();
     $this->data[$fn] = $hash;
 }
Esempio n. 3
0
 /**
  * Compares the stored hash with the FileHash hash.
  * @param FileHash $fh
  * @return boolean Returns TRUE if the hashes match, FALSE if they are different.
  */
 public function compareHash(FileHash $fh)
 {
     $oldhash = $this->getHash($fh->getFilename());
     return $oldhash == $fh->getHash();
 }