All pastes #183544 Raw Edit

Someone

public text v1 · immutable
#183544 ·published 2006-09-27 00:34 UTC
rendered paste body
<?php


function MC_mkdir($Path, $Mode = 07777, $Recursive = false){
	global $DB;
	global $Logger;
	global $CommandID;
	
	if (substr($Path, -1) != DIR_SEP){
		$Path  .= DIR_SEP;
	}
	$Logger->Log("Creating folder '$Path'...", PEAR_LOG_NOTICE);
	if (file_exists($Path)){
		$Logger->Log("Folder '$Path' already exists!", PEAR_LOG_NOTICE);
		MC_setResult($CommandID, 1);
	}else{
		if (@mkdir($Path, $Mode, $Recursive)){		
			$Logger->Log("Folder '$Path' created!", PEAR_LOG_NOTICE); 
			MC_setResult($CommandID, true);
		}else{
			$Logger->Log("Error creating folder '$Path'!", PEAR_LOG_ERROR); 	
			MC_setStatus($CommandID, MC_STATUS_FAILED, time());
			MC_setResult($CommandID, false);
			return false;	 
		}		
	} 
	
	MC_setStatus($CommandID, MC_STATUS_FINISHED, time());
	return true;
}

?>