PHP-based file check-in/check-out system

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
sejf83
Forum Newbie
Posts: 20
Joined: Fri May 19, 2006 3:53 am

PHP-based file check-in/check-out system

Post 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
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: PHP-based file check-in/check-out system

Post 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!
sejf83
Forum Newbie
Posts: 20
Joined: Fri May 19, 2006 3:53 am

Post 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?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Why not use an actual version control like CVS or SVN?
Post Reply