mirror of
				https://git.code.sf.net/p/seeddms/code
				synced 2025-10-31 13:18:06 +00:00 
			
		
		
		
	replace dskspace() with platform independ version (Bug #156)
This commit is contained in:
		
							parent
							
								
									a20043ff10
								
							
						
					
					
						commit
						9d760dd53f
					
				|  | @ -264,18 +264,27 @@ function createVersionigFile($document) { /* {{{ */ | |||
| 	return true; | ||||
| } /* }}} */ | ||||
| 
 | ||||
| // funcion by shalless at rubix dot net dot au (php.net)
 | ||||
| /** | ||||
|  * Calculate disk space of file or directory | ||||
|  * | ||||
|  * original funcion by shalless at rubix dot net dot au (php.net) | ||||
|  * stat() replace by filesize() to make it work on all platforms. | ||||
|  * | ||||
|  * @param string $dir directory or filename | ||||
|  * @return integer number of bytes | ||||
|  */ | ||||
| function dskspace($dir) { /* {{{ */ | ||||
|    $s = stat($dir); | ||||
|    $space = $s["blocks"]*512; | ||||
|    if (is_dir($dir)) { | ||||
|      $dh = opendir($dir); | ||||
|      while (($file = readdir($dh)) !== false) | ||||
|        if ($file != "." and $file != "..") | ||||
|          $space += dskspace($dir."/".$file); | ||||
|      closedir($dh); | ||||
|    } | ||||
|    return $space; | ||||
| 	$space = 0; | ||||
| 	if(is_file($dir)) { | ||||
| 		$space = filesize($dir); | ||||
| 	} elseif (is_dir($dir)) { | ||||
| 		$dh = opendir($dir); | ||||
| 		while (($file = readdir($dh)) !== false) | ||||
| 			if ($file != "." and $file != "..") | ||||
| 				$space += dskspace($dir."/".$file); | ||||
| 		closedir($dh); | ||||
| 	} | ||||
| 	return $space; | ||||
| } /* }}} */ | ||||
| 
 | ||||
| function add_log_line($msg="") { /* {{{ */ | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Uwe Steinmann
						Uwe Steinmann