[Xerte-dev] Re: Lockfiles
David Goodwin
david at palepurple.co.uk
Wed Feb 29 00:34:18 GMT 2012
On 28 Feb 2012, at 23:50, Pat Lockley wrote:
> Stop concurrent access
>
$fp = fopen('/path/to/something.xml.lock', 'w');
if(flock($fp, LOCK_EX, FALSE)) {
// we have an exclusive lock on someting.xml.lock; within the scope of this webserver.
}
else {
// someone else has access.
}
See also http://php.net/flock - note it's behaviour is slightly different on Windows, and it wouldn't scale past more than one web server.
David.
> On 28 Feb 2012, at 23:45, David Goodwin <david at palepurple.co.uk> wrote:
>
>> What do you mean by "lock an XML file down"
>>
>> Are you trying to stop concurrent access to it, or something else?
>>
>> David.
>>
>> On 28 Feb 2012, at 22:26, Pat Lockley wrote:
>>
>>> Hi all,
>>>
>>> Thoughts on how to lock an XML file down?
>>>
>>> I think it might be the session expiring, or the js might not fire properly. I am pretty sure the lockfile remove code doesn't use the session anymore.
>>>
>>>
>>>
>>
>> Pale Purple Ltd. (Company No: 5580814)
>> 'Business Web Application Development and Training in PHP'
>>
>> http://www.palepurple.co.uk
>> Office: 0845 0046746 Mobile: 07792380669
>>
>> Follow us on Twitter: @PalePurpleLtd
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> Xerte-dev mailing list
>> Xerte-dev at lists.nottingham.ac.uk
>> http://lists.nottingham.ac.uk/mailman/listinfo/xerte-dev
>>
>> This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it. Please do not use, copy or disclose the information contained in this message or in any attachment. Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham.
>>
>> This message has been checked for viruses but the contents of an attachment
>> may still contain software viruses which could damage your computer system:
>> you are advised to perform your own checks. Email communications with the
>> University of Nottingham may be monitored as permitted by UK legislation.
>>
>
> _______________________________________________
> Xerte-dev mailing list
> Xerte-dev at lists.nottingham.ac.uk
> http://lists.nottingham.ac.uk/mailman/listinfo/xerte-dev
Pale Purple Ltd. (Company No: 5580814)
'Business Web Application Development and Training in PHP'
http://www.palepurple.co.uk
Office: 0845 0046746 Mobile: 07792380669
Follow us on Twitter: @PalePurpleLtd
More information about the Xerte-dev
mailing list