diff --git a/web/includes/Storage.php b/web/includes/Storage.php index 94b1df3d0..c31b5b2f1 100644 --- a/web/includes/Storage.php +++ b/web/includes/Storage.php @@ -105,13 +105,18 @@ class Storage { # This isn't a function like this in php, so we have to add up the space used in each event. if ( ! array_key_exists( 'disk_used_space', $this ) ) { $used = 0; - foreach ( Event::find_all( array( 'StorageId'=>$this->Id() ) ) as $Event ) { - $Event->Storage( $this ); // Prevent further db hit - $used += $Event->DiskSpace(); - } - + if ( $this->{'type'} == 's3' ) { + foreach ( Event::find_all( array( 'StorageId'=>$this->Id() ) ) as $Event ) { + $Event->Storage( $this ); // Prevent further db hit + $used += $Event->DiskSpace(); + } + } else { + $path = $this->Path(); + $used = disk_total_space( $path ) - disk_free_space( $path );; + } $this->{'disk_used_space'} = $used; } + return $this->{'disk_used_space'}; } }