[Phpfreechat-svn] SF.net SVN: phpfreechat: [1075] trunk/src
Status: Beta
Brought to you by:
kerphi
From: <gpi...@us...> - 2007-08-02 16:28:35
|
Revision: 1075 http://phpfreechat.svn.sourceforge.net/phpfreechat/?rev=1075&view=rev Author: gpinzone Date: 2007-08-02 09:27:50 -0700 (Thu, 02 Aug 2007) Log Message: ----------- Updated debug logging to honor file locking on appends. Modified Paths: -------------- trunk/src/containers/file.class.php trunk/src/containers/mysql.class.php trunk/src/proxies/log.class.php Modified: trunk/src/containers/file.class.php =================================================================== --- trunk/src/containers/file.class.php 2007-08-01 20:14:09 UTC (rev 1074) +++ trunk/src/containers/file.class.php 2007-08-02 16:27:50 UTC (rev 1075) @@ -73,7 +73,7 @@ $c =& pfcGlobalConfig::Instance(); if ($c->debug) - file_put_contents("/tmp/debug", "\nsetMeta(".$group.",".$subgroup.",".$leaf.",".$leafvalue.")", FILE_APPEND); + file_put_contents("/tmp/debug", "\nsetMeta(".$group.",".$subgroup.",".$leaf.",".$leafvalue.")", FILE_APPEND | LOCK_EX); // create directories $dir_base = $c->container_cfg_server_dir; @@ -107,7 +107,7 @@ { $c =& pfcGlobalConfig::Instance(); if ($c->debug) - file_put_contents("/tmp/debug", "\ngetMeta(".$group.",".$subgroup.",".$leaf.",".$withleafvalue.")", FILE_APPEND); + file_put_contents("/tmp/debug", "\ngetMeta(".$group.",".$subgroup.",".$leaf.",".$withleafvalue.")", FILE_APPEND | LOCK_EX); // read data from metadata file $ret = array(); @@ -167,7 +167,7 @@ { $c =& pfcGlobalConfig::Instance(); if ($c->debug) - file_put_contents("/tmp/debug", "\nrmMeta(".$group.",".$subgroup.",".$leaf.")", FILE_APPEND); + file_put_contents("/tmp/debug", "\nrmMeta(".$group.",".$subgroup.",".$leaf.")", FILE_APPEND | LOCK_EX); $dir = $c->container_cfg_server_dir; Modified: trunk/src/containers/mysql.class.php =================================================================== --- trunk/src/containers/mysql.class.php 2007-08-01 20:14:09 UTC (rev 1074) +++ trunk/src/containers/mysql.class.php 2007-08-02 16:27:50 UTC (rev 1075) @@ -158,7 +158,7 @@ $c =& pfcGlobalConfig::Instance(); if ($c->debug) - file_put_contents("/tmp/debug.txt", "\nsetMeta(".$group.",".$subgroup.",".$leaf.",".$leafvalue.")", FILE_APPEND); + file_put_contents("/tmp/debug.txt", "\nsetMeta(".$group.",".$subgroup.",".$leaf.",".$leafvalue.")", FILE_APPEND | LOCK_EX); $server = $c->serverid; $db = $this->_connect(); @@ -173,7 +173,7 @@ if( !(mysql_num_rows($res)>0) ) { if ($c->debug) - file_put_contents("/tmp/debug.txt", "\nsetSQL(".$sql_insert.")", FILE_APPEND); + file_put_contents("/tmp/debug.txt", "\nsetSQL(".$sql_insert.")", FILE_APPEND | LOCK_EX); mysql_query($sql_insert, $db); return 0; // value created @@ -183,7 +183,7 @@ if ($sql_update != "") { if ($c->debug) - file_put_contents("/tmp/debug.txt", "\nsetSQL(".$sql_update.")", FILE_APPEND); + file_put_contents("/tmp/debug.txt", "\nsetSQL(".$sql_update.")", FILE_APPEND | LOCK_EX); mysql_query($sql_update, $db); } @@ -197,7 +197,7 @@ $c =& pfcGlobalConfig::Instance(); if ($c->debug) - file_put_contents("/tmp/debug.txt", "\ngetMeta(".$group.",".$subgroup.",".$leaf.",".$withleafvalue.")", FILE_APPEND); + file_put_contents("/tmp/debug.txt", "\ngetMeta(".$group.",".$subgroup.",".$leaf.",".$withleafvalue.")", FILE_APPEND | LOCK_EX); $ret = array(); $ret["timestamp"] = array(); @@ -234,7 +234,7 @@ $sql_select="SELECT `$value`, `timestamp` FROM ".$c->container_cfg_mysql_table." WHERE `server`='$server' $sql_where $sql_group_by ORDER BY timestamp"; if ($c->debug) - file_put_contents("/tmp/debug.txt", "\ngetSQL(".$sql_select.")", FILE_APPEND); + file_put_contents("/tmp/debug.txt", "\ngetSQL(".$sql_select.")", FILE_APPEND | LOCK_EX); if ($sql_select != "") { @@ -266,7 +266,7 @@ { $c =& pfcGlobalConfig::Instance(); if ($c->debug) - file_put_contents("/tmp/debug.txt", "\nrmMeta(".$group.",".$subgroup.",".$leaf.")", FILE_APPEND); + file_put_contents("/tmp/debug.txt", "\nrmMeta(".$group.",".$subgroup.",".$leaf.")", FILE_APPEND | LOCK_EX); $server = $c->serverid; $db = $this->_connect(); @@ -283,7 +283,7 @@ $sql_delete .= " AND `leaf`='$leaf'"; if ($c->debug) - file_put_contents("/tmp/debug.txt", "\nrmSQL(".$sql_delete.")", FILE_APPEND); + file_put_contents("/tmp/debug.txt", "\nrmSQL(".$sql_delete.")", FILE_APPEND | LOCK_EX); mysql_query($sql_delete, $db); return true; Modified: trunk/src/proxies/log.class.php =================================================================== --- trunk/src/proxies/log.class.php 2007-08-01 20:14:09 UTC (rev 1074) +++ trunk/src/proxies/log.class.php 2007-08-02 16:27:50 UTC (rev 1075) @@ -59,7 +59,7 @@ $log .= date("H:i:s")."\t"; $log .= $sender."\t"; $log .= $param."\n"; - file_put_contents($logfile, $log, FILE_APPEND); + file_put_contents($logfile, $log, FILE_APPEND | LOCK_EX); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |