[Phpfreechat-svn] SF.net SVN: phpfreechat: [613] trunk/src/pfcglobalconfig.class.php
Status: Beta
Brought to you by:
kerphi
From: <ke...@us...> - 2006-06-17 10:54:21
|
Revision: 613 Author: kerphi Date: 2006-06-17 03:54:12 -0700 (Sat, 17 Jun 2006) ViewCVS: http://svn.sourceforge.net/phpfreechat/?rev=613&view=rev Log Message: ----------- Be sure the copy_r and rm_r function works Modified Paths: -------------- trunk/src/pfcglobalconfig.class.php Modified: trunk/src/pfcglobalconfig.class.php =================================================================== --- trunk/src/pfcglobalconfig.class.php 2006-06-17 10:19:50 UTC (rev 612) +++ trunk/src/pfcglobalconfig.class.php 2006-06-17 10:54:12 UTC (rev 613) @@ -198,6 +198,43 @@ $this->errors = array_merge($this->errors, @test_writable_dir($this->data_private_path, "data_private_path")); $this->errors = array_merge($this->errors, @install_dir($this->jspath, $this->data_public_path."/javascript")); $this->errors = array_merge($this->errors, @test_writable_dir($this->data_private_path."/cache", "data_private_path/cache")); + + // check the copyr and rm_r function works + if (count($this->errors) == 0) + { + $copyr_ok = true; + $dir1 = $this->data_private_path."/copyr1"; + $file1 = $dir1."/dummy"; + $dir2 = $this->data_private_path."/copyr2"; + $file2 = $dir2."/dummy"; + // create a dummy directory + mkdir($dir1); + // check the directory exists + if (!file_exists($dir1) || !is_dir($dir1)) $copyr_ok = false; + // create a dummy file + touch($file1); + // check the file exists + if (!file_exists($file1)) $copyr_ok = false; + // copyr the dummy dir + copyr($dir1,$dir2); + // check the directory exists + if (!file_exists($dir2) || !is_dir($dir2)) $copyr_ok = false; + // check the file exists + if (!file_exists($file2)) $copyr_ok = false; + if (!$copyr_ok) + $this->errors[] = _pfc("Recursive copy doesn't works"); + + // try to remove recursively the directory + $rm_r_ok = true; + rm_r($dir2); + rm_r($dir1); + // check the directory doesn't exists + if (file_exists($dir1) || file_exists($dir2)) $rm_r_ok = false; + // check the file doesn't exists + if (file_exists($file1) || file_exists($file2)) $rm_r_ok = false; + if (!$copyr_ok) + $this->errors[] = _pfc("Recursive remove doesn't works"); + } // --- // test xajax lib existance This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |