diff --git a/airtime_mvc/application/models/StoredFile.php b/airtime_mvc/application/models/StoredFile.php index b54cedfa5..3096b99a1 100644 --- a/airtime_mvc/application/models/StoredFile.php +++ b/airtime_mvc/application/models/StoredFile.php @@ -384,11 +384,11 @@ SQL; throw new FileNoPermissionException(); } + $music_dir = Application_Model_MusicDir::getDirByPK($this->_file->getDbDirectory()); assert($music_dir); $type = $music_dir->getType(); - if (file_exists($filepath) && $type == "stor") { try { //Update the user's disk usage @@ -402,11 +402,7 @@ SQL; } Logging::info($_SERVER["HTTP_HOST"].": User ".$user->getLogin()." is deleting file: ".$this->_file->getDbTrackTitle()." - file id: ".$this->_file->getDbId()); - // set hidden flag to true - //$this->_file->setDbHidden(true); - $this->_file->setDbFileExists(false); - $this->_file->save(); - + // need to explicitly update any playlist's and block's length // that contains the file getting deleted $fileId = $this->_file->getDbId(); @@ -423,6 +419,10 @@ SQL; $bl->setDbLength($bl->computeDbLength(Propel::getConnection(CcBlockPeer::DATABASE_NAME))); $bl->save(); } + + // We were setting file_exists to false and leaving it at that + // but we should actually delete the file + $this->_file->delete(); } /** diff --git a/airtime_mvc/application/modules/rest/controllers/MediaController.php b/airtime_mvc/application/modules/rest/controllers/MediaController.php index 9586d36ea..dd0497745 100644 --- a/airtime_mvc/application/modules/rest/controllers/MediaController.php +++ b/airtime_mvc/application/modules/rest/controllers/MediaController.php @@ -277,7 +277,6 @@ class Rest_MediaController extends Zend_Rest_Controller if ($storedFile->existsOnDisk()) { $storedFile->delete(); //TODO: This checks your session permissions... Make it work without a session? } - $file->delete(); $this->getResponse() ->setHttpResponseCode(204); } else {