[Phpfreechat-svn] SF.net SVN: phpfreechat: [882] trunk/src
Status: Beta
Brought to you by:
kerphi
From: <ke...@us...> - 2006-11-29 16:33:16
|
Revision: 882 http://svn.sourceforge.net/phpfreechat/?rev=882&view=rev Author: kerphi Date: 2006-11-29 08:33:12 -0800 (Wed, 29 Nov 2006) Log Message: ----------- [en] Optimizations: when directories were open for listing, they were not closed using closedir() php function. [1h00] [fr] Optimisation : lorsque les repertoire ?\195?\169taient list?\195?\169s, ils n'?\195?\169tait jamais ferm?\195?\169s avec la fonction closedir() de php. [1h00] Modified Paths: -------------- trunk/src/commands/help.class.php trunk/src/containers/file.class.php trunk/src/pfci18n.class.php trunk/src/pfctools.php Modified: trunk/src/commands/help.class.php =================================================================== --- trunk/src/commands/help.class.php 2006-11-29 14:44:44 UTC (rev 881) +++ trunk/src/commands/help.class.php 2006-11-29 16:33:12 UTC (rev 882) @@ -26,6 +26,7 @@ if (!preg_match("/^([a-z]+).class.php$/i",$file,$res)) continue; if (!in_array($res[1],$ignore)) $cmdlist[] = $res[1]; } + closedir($dh); sort($cmdlist); $str = _pfc("Here is the command list:")."<br/>"; Modified: trunk/src/containers/file.class.php =================================================================== --- trunk/src/containers/file.class.php 2006-11-29 14:44:44 UTC (rev 881) +++ trunk/src/containers/file.class.php 2006-11-29 16:33:12 UTC (rev 882) @@ -134,6 +134,7 @@ $ret["timestamp"][] = filemtime($dir.'/'.$file); $ret["value"][] = $file; } + closedir($dh); } return $ret; } @@ -151,6 +152,7 @@ $ret["timestamp"][] = filemtime($dir.'/'.$file); $ret["value"][] = $file; } + closedir($dh); } return $ret; } @@ -197,10 +199,18 @@ return true; } - $leaffilename = $dir.'/'.$leaf; - + $leaffilename = $dir.'/'.$leaf; if (!file_exists($leaffilename)) return false; unlink($leaffilename); + + // check that the directory is empty or not + // remove it if it doesn't contains anything + $dh = opendir($dir); + readdir($dh); readdir($dh); // skip . and .. directories + $isnotempty = readdir($dh); + closedir($dh); + if ($isnotempty === false) rmdir($dir); + return true; } Modified: trunk/src/pfci18n.class.php =================================================================== --- trunk/src/pfci18n.class.php 2006-11-29 14:44:44 UTC (rev 881) +++ trunk/src/pfci18n.class.php 2006-11-29 16:33:12 UTC (rev 882) @@ -110,6 +110,7 @@ if (file_exists(dirname(__FILE__)."/../i18n/".$file."/admin.php")) $GLOBALS["accepted_admin_languages"][] = $file; } + closedir($dir_handle); return $GLOBALS["accepted_admin_languages"]; } else{ @@ -124,6 +125,7 @@ if ($file == "." || $file == ".." || strpos($file,".")===0) continue; $GLOBALS["accepted_languages"][] = $file; } + closedir($dir_handle); return $GLOBALS["accepted_languages"]; } } Modified: trunk/src/pfctools.php =================================================================== --- trunk/src/pfctools.php 2006-11-29 14:44:44 UTC (rev 881) +++ trunk/src/pfctools.php 2006-11-29 16:33:12 UTC (rev 882) @@ -135,6 +135,7 @@ if($obj=='.' || $obj=='..') continue; if (!@unlink($dir.'/'.$obj)) rm_r($dir.'/'.$obj); } + closedir($dh); @rmdir($dir); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |