only count event size when s3
This commit is contained in:
parent
e16d852248
commit
3f01f887aa
|
@ -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'};
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue