mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-08-05 00:13:05 +02:00
This algorithm does not work for Windows and when "exec" is disabled. But not having this cache size is not a major issue. What is a problem is when calculating the cache size breaks the execution, which must be avoided.
This commit is contained in:
@@ -637,13 +637,17 @@ function get_fs_directory_size($path)
|
||||
$bytestotal = 0;
|
||||
$path = realpath($path);
|
||||
|
||||
if ($path !== false && $path != '' && file_exists($path))
|
||||
if (!function_exists('exec'))
|
||||
{
|
||||
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS)) as $object)
|
||||
{
|
||||
$bytestotal += $object->getSize();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@exec('du -sk '.$path, $returnarray);
|
||||
if (is_array($returnarray) and !empty($returnarray[0]) and preg_match('/^(\d+)\s/', $returnarray[0], $matches))
|
||||
{
|
||||
$bytestotal = $matches[1] * 1024;
|
||||
}
|
||||
|
||||
return $bytestotal;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user