diff --git a/airtime_mvc/application/models/StoredFile.php b/airtime_mvc/application/models/StoredFile.php index 2ac3b6092..fdba489da 100644 --- a/airtime_mvc/application/models/StoredFile.php +++ b/airtime_mvc/application/models/StoredFile.php @@ -372,9 +372,6 @@ SQL; { $filepath = $this->getFilePath(); - //Update the user's disk usage - Application_Model_Preference::updateDiskUsage(-1 * abs(filesize($filepath))); - // Check if the file is scheduled to be played in the future if (Application_Model_Schedule::IsFileScheduledInTheFuture($this->getId())) { throw new DeleteScheduledFileException(); @@ -394,6 +391,9 @@ SQL; if (file_exists($filepath) && $type == "stor") { try { + //Update the user's disk usage + Application_Model_Preference::updateDiskUsage(-1 * abs(filesize($filepath))); + unlink($filepath); } catch (Exception $e) { Logging::error($e->getMessage());