From 5d826fd558cc737d1593496658b75069bbb77280 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Sat, 20 Feb 2021 17:11:20 -0500 Subject: [PATCH] Don't try to addup/update DIskSpace used by incomplete events. --- web/includes/Storage.php | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/web/includes/Storage.php b/web/includes/Storage.php index 71bc021d2..11519b0e1 100644 --- a/web/includes/Storage.php +++ b/web/includes/Storage.php @@ -132,19 +132,7 @@ class Storage extends ZM_Object { public function event_disk_space() { # This isn't a function like this in php, so we have to add up the space used in each event. if ( (! property_exists($this, 'DiskSpace')) or (!isset($this->{'DiskSpace'})) ) { - $used = dbFetchOne('SELECT SUM(DiskSpace) AS DiskSpace FROM Events WHERE StorageId=? AND DiskSpace IS NOT NULL', 'DiskSpace', array($this->Id())); - - do { - # Do in batches of 1000 so as to not useup all ram, Event will do caching though... - $events = Event::find(array('StorageId'=>$this->Id(), 'DiskSpace'=>null), array('limit'=>1000)); - foreach ( $events as $Event ) { - $Event->Storage($this); // Prevent further db hit - # DiskSpace will update the event - $used += $Event->DiskSpace(); - } #end foreach - Event::clear_cache(); - } while ( count($events) == 1000 ); - $this->{'DiskSpace'} = $used; + $this->{'DiskSpace'} = dbFetchOne('SELECT SUM(DiskSpace) AS DiskSpace FROM Events WHERE StorageId=? AND DiskSpace IS NOT NULL', 'DiskSpace', array($this->Id())); } return $this->{'DiskSpace'}; } // end function event_disk_space