One of the neater features of Dropbox is that it keeps previous versions of the files you upload.
Part of our site is a similar file repository (customers upload their files to store them offsite), and we'd like to implement a similar feature.
How does Dropbox manage revisions? Do they use some off the shelve revision software that autocommits each file? Or did they just roll their own solution?
I'm hoping there's a 3rd party library I can use for this as it's not the sort of thing we have time to do from scratch ourselves.
Thanks for any help you guys can provide!
More than likely they used a custom solution. Possible methods you can look at are storing a separate file on filesystem for each version, store a separate file in the database for each version, or calculate the diff for the revised file and store that.
The third option is the best as it uses the least space.
Take a look at xdiff_file_bdiff(), it calculates a binary diff of two files (The old version and the new version). The xdiff library should give you the tools you need to do this. You could also look at using something like git for version control, just automate the process using PHP. You'd probably want to run some benchmarks to see what solution works the fastest.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With