[Phpfreechat-svn] SF.net SVN: phpfreechat: [612] trunk/src/pfcglobalconfig.class.php
Status: Beta
Brought to you by:
kerphi
From: <ke...@us...> - 2006-06-17 10:19:56
|
Revision: 612 Author: kerphi Date: 2006-06-17 03:19:50 -0700 (Sat, 17 Jun 2006) ViewCVS: http://svn.sourceforge.net/phpfreechat/?rev=612&view=rev Log Message: ----------- Bug fix: the global config was not correctly checked since the cache lock file addition. Modified Paths: -------------- trunk/src/pfcglobalconfig.class.php Modified: trunk/src/pfcglobalconfig.class.php =================================================================== --- trunk/src/pfcglobalconfig.class.php 2006-06-17 09:54:09 UTC (rev 611) +++ trunk/src/pfcglobalconfig.class.php 2006-06-17 10:19:50 UTC (rev 612) @@ -386,7 +386,7 @@ { $cachefile = $this->_getCacheFile(); $cachefile_lock = $cachefile."_lock"; - + if (file_exists($cachefile)) { // if a cache file exists, remove the lock file because config has been succesfully stored @@ -406,7 +406,14 @@ else { if (file_exists($cachefile_lock)) - return false; // do nothing if the lock file exists + { + // delete too old lockfiles (more than 15 seconds) + $locktime = filemtime($cachefile_lock); + if ($locktime+15 < time()) + unlink($cachefile_lock); + else + return false; // do nothing if the lock file exists + } else @touch($cachefile_lock); // create the lockfile @@ -415,6 +422,7 @@ $errors =& $this->getErrors(); if (count($errors) > 0) { + @unlink($cachefile_lock); // destroy the lock file for the next attempt echo "<ul>"; foreach( $errors as $e ) echo "<li>".$e."</li>"; echo "</ul>"; exit; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |