putty Posted April 7, 2008 Share Posted April 7, 2008 I am creating a simple File Locking/Version Control system on a project I am working on. I have been using the database to check files in and out and stop users from overwrite each other's changes, however I wanted to put an additional level of security on the files themselves. Is there a function or method similar to Flock() that can hold a lock on a file longer than just the script execution time? Thanks, Levi Link to comment https://forums.phpfreaks.com/topic/99928-file-locking/ Share on other sites More sharing options...
haku Posted April 7, 2008 Share Posted April 7, 2008 This is entirely hypothetical, as I've never done it, but maybe you could set up files to be downloaded with a 'force download' script (http://w-shadow.com/blog/2007/08/12/how-to-force-file-download-with-php/). How this works is that when you set up a link for a file to be downloaded, you don't make the href point at the file, but rather at the script, and pass a reference-variable to that script. When you do this, people cannot see the real location of the file being downloaded, only the location of the script. So if you set up the script to check to see if the file is checked out before serving it up to the user, this would prevent the user from checking out any scripts that are checked out already. Link to comment https://forums.phpfreaks.com/topic/99928-file-locking/#findComment-510999 Share on other sites More sharing options...
rhodesa Posted April 7, 2008 Share Posted April 7, 2008 Before you go through the trouble of creating your own version control system, have you checked out (pun-intended) the many open-source solutions that already exist out there? Subversion (my preference), and CVS are just a couple of the popular ones. Unless you have some special needs that these don't meet, I would recommend using these instead. Link to comment https://forums.phpfreaks.com/topic/99928-file-locking/#findComment-511156 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.