[Phpfreechat-svn] SF.net SVN: phpfreechat: [1241] trunk/src/containers/file.class.php
Status: Beta
Brought to you by:
kerphi
From: <ke...@us...> - 2008-05-23 20:54:44
|
Revision: 1241 http://phpfreechat.svn.sourceforge.net/phpfreechat/?rev=1241&view=rev Author: kerphi Date: 2008-05-23 13:54:51 -0700 (Fri, 23 May 2008) Log Message: ----------- Add a test on the LOCK_EX feature in the initialisation process. This feature doesn't work on filesystems like NFS. Modified Paths: -------------- trunk/src/containers/file.class.php Modified: trunk/src/containers/file.class.php =================================================================== --- trunk/src/containers/file.class.php 2008-05-16 07:20:26 UTC (rev 1240) +++ trunk/src/containers/file.class.php 2008-05-23 20:54:51 UTC (rev 1241) @@ -70,18 +70,29 @@ $timetowait = 2; if (is_writable(dirname($filename))) { - file_put_contents($filename,'some-data1-'.time(), LOCK_EX); + file_put_contents($filename,'some-data1-'.time()); clearstatcache(); $time1 = filemtime($filename); sleep($timetowait); - file_put_contents($filename,'some-data2-'.time(), LOCK_EX); + file_put_contents($filename,'some-data2-'.time()); clearstatcache(); $time2 = filemtime($filename); unlink($filename); if ($time2-$time1 != $timetowait) - $errors[] = "filemtime php fuction is not usable on your filesystem. Please do not use the 'file' container (try the 'mysql' container) or swith to another filesystem."; + $errors[] = "filemtime php fuction is not usable on your filesystem. Please do not use the 'file' container (try the 'mysql' container) or swith to another filesystem type."; } + // test the LOCK_EX feature because it doesn't work on special filsystem like NFS + $filename = $c->data_private_path.'/filemtime.test'; + if (is_writable(dirname($filename))) + { + $data1 = time(); + file_put_contents($filename, $data1, LOCK_EX); + $data2 = file_get_contents($filename); + if ($data1 != $data2) + $errors[] = "LOCK_EX feature is not usable on your filesystem. Please do not use the 'file' container (try the 'mysql' container) or swith to another filesystem type."; + } + return $errors; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |