修复在用户未初始化保险箱时计算容量出错的bug
This commit is contained in:
parent
2baea47164
commit
043e70ab7d
@ -17,6 +17,9 @@ class FileSizeHelper
|
|||||||
*/
|
*/
|
||||||
public static function getDirectorySize(string $directory): int
|
public static function getDirectorySize(string $directory): int
|
||||||
{
|
{
|
||||||
|
if (!is_dir($directory)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
$size = 0;
|
$size = 0;
|
||||||
$files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory));
|
$files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory));
|
||||||
foreach ($files as $file) {
|
foreach ($files as $file) {
|
||||||
|
Loading…
Reference in New Issue
Block a user