md5_file is being called 2x per file.

enricodias4654

Member
YetiShare User
Jan 13, 2015
411
1
16
Hello.

I just notice that the script is calling md5_file 2 times on each upload. It's called in the method _storeFile and then again in the method moveIntoStorage, both in the uploader class. The moveIntoStorage method calls the _storeFile method. It doesn't need to calculate the md5 again.

I'm changing the line $fileUpload->hash = md5_file($tmpFile); to $fileUpload->hash = $fileHash; in the moveIntoStorage method.
 

paypal1352

New Member
YetiShare User
Wurlie User
Mar 2, 2012
297
2
0
Are you sure about this, while i'm no expert it should take md5_file() 20+ seconds for a 1GB file, so theoretically if you're correct this would be a good performance boost. Although I've uploaded really large files and never noticed any kind of strange delays.

I personally don't want to make this change as I don't have too much time to beta test and make sure everything works well, maybe Adam or Simon can confirm.

Reference: http://php.net/manual/en/function.md5-file.php
 

enricodias4654

Member
YetiShare User
Jan 13, 2015
411
1
16
I only tested small files so far, but there are 2 calls of md5_file for each upload. Search it on your code and you will find it.