mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-13 13:11:31 +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;
|
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) { /* {{{ */
|
function dskspace($dir) { /* {{{ */
|
||||||
$s = stat($dir);
|
$space = 0;
|
||||||
$space = $s["blocks"]*512;
|
if(is_file($dir)) {
|
||||||
if (is_dir($dir)) {
|
$space = filesize($dir);
|
||||||
$dh = opendir($dir);
|
} elseif (is_dir($dir)) {
|
||||||
while (($file = readdir($dh)) !== false)
|
$dh = opendir($dir);
|
||||||
if ($file != "." and $file != "..")
|
while (($file = readdir($dh)) !== false)
|
||||||
$space += dskspace($dir."/".$file);
|
if ($file != "." and $file != "..")
|
||||||
closedir($dh);
|
$space += dskspace($dir."/".$file);
|
||||||
}
|
closedir($dh);
|
||||||
return $space;
|
}
|
||||||
|
return $space;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
function add_log_line($msg="") { /* {{{ */
|
function add_log_line($msg="") { /* {{{ */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user