[pLog-svn] r771 - plog/trunk/class/file
oscar at devel.plogworld.net
oscar at devel.plogworld.net
Thu Jan 20 13:26:33 GMT 2005
Author: oscar
Date: 2005-01-20 13:26:32 +0000 (Thu, 20 Jan 2005)
New Revision: 771
Modified:
plog/trunk/class/file/file.class.php
Log:
fixed mantis issue 155 (http://bugs.plogworld.net/view.php?id=155)
Modified: plog/trunk/class/file/file.class.php
===================================================================
--- plog/trunk/class/file/file.class.php 2005-01-20 06:11:30 UTC (rev 770)
+++ plog/trunk/class/file/file.class.php 2005-01-20 13:26:32 UTC (rev 771)
@@ -198,7 +198,7 @@
*/
function deleteDir( $dirName, $recursive = false )
{
- $log =& LoggerManager::getLogger( "File::createDir" );
+ $log =& LoggerManager::getLogger( "File::deleteDir" );
// if the directory can't be read, then quit with an error
if( !File::isReadable( $dirName ) || !File::exists( $dirName )) {
@@ -249,16 +249,15 @@
*/
function createDir( $dirName, $mode = FILE_DEFAULT_DIRECTORY_CREATION_MODE )
{
+ if(File::exists($dirName)) return true;
- if(file_exists($dirName)) return true;
-
- if(substr($dirName, strlen($dirName)-1) == DIRECTORY_SEPARATOR){
+ if(substr($dirName, strlen($dirName)-1) == "/" ){
$dirName = substr($dirName, 0,strlen($dirName)-1);
}
// for example, we will create dir "/a/b/c"
// $firstPart = "/a/b"
- $firstPart = substr($dirName,0,strrpos($dirName, DIRECTORY_SEPARATOR));
+ $firstPart = substr($dirName,0,strrpos($dirName, "/" ));
if(file_exists($firstPart)){
if(!mkdir($dirName,$mode)) return false;
@@ -267,8 +266,7 @@
File::createDir($firstPart,$mode);
if(!mkdir($dirName,$mode)) return false;
chmod( $dirName, $mode );
- }
-
+ }
return true;
}
More information about the pLog-svn
mailing list