Merge pull request #7825 from owncloud/hash-stream

Use streams when generating hashes of remote files
This commit is contained in:
Vincent Petry 2014-04-10 10:42:04 +02:00
commit 8d05848391
1 changed files with 5 additions and 3 deletions

View File

@ -159,9 +159,11 @@ abstract class Common implements \OC\Files\Storage\Storage {
} }
public function hash($type, $path, $raw = false) { public function hash($type, $path, $raw = false) {
$tmpFile = $this->getLocalFile($path); $fh = $this->fopen($path, 'rb');
$hash = hash_file($type, $tmpFile, $raw); $ctx = hash_init($type);
return $hash; hash_update_stream($ctx, $fh);
fclose($fh);
return hash_final($ctx, $raw);
} }
public function search($query) { public function search($query) {