Merge branch 'cc-5709-airtime-analyzer' of github.com:sourcefabric/Airtime into cc-5709-airtime-analyzer

This commit is contained in:
Albert Santoni 2014-03-21 13:26:47 -04:00
commit f120caa093
3 changed files with 25 additions and 1 deletions

View file

@ -158,7 +158,8 @@ class Rest_MediaController extends Zend_Rest_Controller
//our internal schema. Internally, file path is stored relative to a directory, with the directory
//as a foreign key to cc_music_dirs.
if ($requestData["full_path"]) {
Application_Model_Preference::updateDiskUsage(filesize($requestData["full_path"]));
$fullPath = $requestData["full_path"];
$storDir = Application_Model_MusicDir::getStorDir()->getDirectory();
$pos = strpos($fullPath, $storDir);
@ -198,6 +199,7 @@ class Rest_MediaController extends Zend_Rest_Controller
$file = CcFilesQuery::create()->findPk($id);
if ($file) {
$storedFile = Application_Model_StoredFile($file);
Application_Model_Preference::updateDiskUsage(-1 * abs(filesize($storedFile->getFilePath())));
$storedFile->delete(); //TODO: This checks your session permissions... Make it work without a session?
$file->delete();
$this->getResponse()
@ -375,5 +377,6 @@ class Rest_MediaController extends Zend_Rest_Controller
return $response;
}
}