Page 1 of 1
PHP-based file check-in/check-out system
Posted: Fri May 19, 2006 3:58 am
by sejf83
Hi all,
I'd like to a build a PHP-based interface for sharing documents (MS Office docs, latex, etc). I need to be able to allow users to "check-out" the files for their exclusive use and then go through a "check in" process when they re-upload the doc so it's accessible again to everyone else. I'd also like to implement some form of version control where older versions of the docs can be in some sort of repository. I'm not quite sure how to approach either concept. I'm wondering if anyone can give me tips on how I might go about this.
Thanks.
sejf83
Re: PHP-based file check-in/check-out system
Posted: Fri May 19, 2006 8:33 am
by Chris Corbyn
sejf83 wrote:Hi all,
I'd like to a build a PHP-based interface for sharing documents (MS Office docs, latex, etc). I need to be able to allow users to "check-out" the files for their exclusive use and then go through a "check in" process when they re-upload the doc so it's accessible again to everyone else. I'd also like to implement some form of version control where older versions of the docs can be in some sort of repository. I'm not quite sure how to approach either concept. I'm wondering if anyone can give me tips on how I might go about this.
Thanks.
sejf83
It's not overly simple with your version control requirement.
Off the top of my head:
-------------
Users must login and have a unique userid.
If a user uploads a report it is stored on the filesystem and recorded against their userid in the database with a name the user defines, and a revision number starting at "1".
Save the file in a directory unique to that user, name it according to the document name they give you, appended with the revision number.
Next time the user goes to upload a document you read the database for all document (names) they have uploaded in the past and say "either revise on of these or upload a new document".
If they chooses an existing document from the dropdown before uploading you then record it, increment the revision number by one and store the file like you did before <name>_<revision>.ext
When it comes to downloading you'll need to got through all the documents you have in the database and reproduce the paths to them using the naming constraints you used when uploading.
----------------------
That will certainly need some enhancing but like I say that's what spring into my head
Good luck!
Posted: Fri May 19, 2006 12:49 pm
by sejf83
Thanks so much. That will certainly get me started. Any advice on the "check-in" and "check-out" requirement? I'm thinking I need to somehow mark downloaded file as "checked out" in the DB, then exclude the file name from an array....but I also want to "check out" previous versions, too. Then, when the user "checks in" the doc, I could delete the notation in the DB? Or maybe there's an easier way?
Posted: Fri May 19, 2006 1:52 pm
by feyd
Why not use an actual version control like CVS or SVN?