dskspace() checks if directory could be opened

This commit is contained in:
Uwe Steinmann 2015-07-28 07:50:37 +02:00
parent d653c516ea
commit 0c48b342a5

View File

@ -329,11 +329,12 @@ function dskspace($dir) { /* {{{ */
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);
if($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false)
if ($file != "." and $file != "..")
$space += dskspace($dir."/".$file);
closedir($dh);
}
}
return $space;
} /* }}} */