mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-03-28 17:42:57 +01:00
+ add a 5 minutes cache to avoid calculating cache size too often * tested with anold PHP 5.5 (could work with earlier versions, but I prefer to not take the risk)
This commit is contained in:
@@ -625,6 +625,28 @@ function get_fs_directories($path, $recursive = true)
|
||||
return $dirs;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the size (in bytes) of a filesystem directory
|
||||
*
|
||||
* @since 11
|
||||
* @param string path
|
||||
* @return int
|
||||
*/
|
||||
function get_fs_directory_size($path)
|
||||
{
|
||||
$bytestotal = 0;
|
||||
$path = realpath($path);
|
||||
|
||||
if ($path !== false && $path != '' && file_exists($path))
|
||||
{
|
||||
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS)) as $object)
|
||||
{
|
||||
$bytestotal += $object->getSize();
|
||||
}
|
||||
}
|
||||
return $bytestotal;
|
||||
}
|
||||
|
||||
/**
|
||||
* save the rank depending on given categories order
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user