View Single Post
Old Jan 13th, 2008, 2:49 PM   #3
grimpirate
King of Portal
 
grimpirate's Avatar
 
Join Date: Sep 2005
Posts: 431
Rep Power: 4 grimpirate is on a distinguished road
Send a message via Yahoo to grimpirate
Re: File Locking without using flock

The second and third option would not be viable as my forum script needs to remain portable and no client/server communication is necessary. What I'm trying to achieve is a database that locks files so as to prevent accidental overwriting.

This is what I understood in a stepwise fashion:
  1. generate a temporary unique filename in the location of interest
  2. move said file to another temporary location
  3. work on temporary file in temporary location
  4. move temporary file back to location of interest
  5. analyze original file and determine what to do with temporary file
I'm not so sure I'd know where to begin in order to generate a unique filename, it would seem to me that if they're just randomly generated without any inter-dependancy then they might collide. Something like rfc4122 uuids for instance.
__________________
Lo, there do I see my father. 'Lo, there do I see My mother, and my sisters, and my brothers. 'Lo, there do I see The line of my people... Back to the beginning. 'Lo, they do call to me. They bid me take my place among them. In the halls of Valhalla... Where the brave... May live... ...forever.. GrimBB | Mimesis
grimpirate is offline   Reply With Quote