diff --git a/web/includes/Storage.php b/web/includes/Storage.php index 84949e988..68d2e516e 100644 --- a/web/includes/Storage.php +++ b/web/includes/Storage.php @@ -113,7 +113,9 @@ class Storage { if ( ! array_key_exists( 'disk_used_space', $this ) ) { $used = 0; if ( $this->{'Type'} == 's3fs' ) { - foreach ( Event::find_all( array( 'StorageId'=>$this->Id() ) ) as $Event ) { + $used = dbFetchOne('SELECT SUM(DiskSpace) FROM EVents WHERE StorageId=? AND DiskSpace IS NOT NULL', 'DiskSpace', array($this-Id()) ); + + foreach ( Event::find_all( array( 'StorageId'=>$this->Id(), 'DiskSpace'=>null ) ) as $Event ) { $Event->Storage( $this ); // Prevent further db hit $used += $Event->DiskSpace(); }