File tree Expand file tree Collapse file tree
src/Console/Command/System Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -673,10 +673,24 @@ private function getDiskSpace(): string
673673 $ totalSpace = disk_total_space ('. ' );
674674 $ freeSpace = disk_free_space ('. ' );
675675
676+ if ($ totalSpace === false || $ freeSpace === false ) {
677+ return 'Unknown ' ;
678+ }
679+
680+ if ($ totalSpace <= 0 ) {
681+ $ totalGB = 0.0 ;
682+ $ usedGB = 0.0 ;
683+ $ usedPercent = 0.0 ;
684+
685+ return "$ usedGB GB / $ totalGB GB ( $ usedPercent%) " ;
686+ }
687+
676688 $ totalGB = round ($ totalSpace / 1024 / 1024 / 1024 , 2 );
677689 $ freeGB = round ($ freeSpace / 1024 / 1024 / 1024 , 2 );
678690 $ usedGB = round ($ totalGB - $ freeGB , 2 );
679- $ usedPercent = round (($ usedGB / $ totalGB ) * 100 , 2 );
691+ $ usedPercent = $ totalGB > 0.0
692+ ? round (($ usedGB / $ totalGB ) * 100 , 2 )
693+ : 0.0 ;
680694
681695 return "$ usedGB GB / $ totalGB GB ( $ usedPercent%) " ;
682696 }
You can’t perform that action at this time.
0 commit comments