Merge branch 'cc-5709-airtime-analyzer' into saas
Conflicts: airtime_mvc/application/models/StoredFile.php
This commit is contained in:
commit
755df62a00
1 changed files with 15 additions and 17 deletions
|
@ -370,9 +370,7 @@ SQL;
|
|||
*
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
$filepath = $this->getFilePath();
|
||||
|
||||
{
|
||||
// Check if the file is scheduled to be played in the future
|
||||
if (Application_Model_Schedule::IsFileScheduledInTheFuture($this->getId())) {
|
||||
throw new DeleteScheduledFileException();
|
||||
|
@ -390,20 +388,21 @@ SQL;
|
|||
assert($music_dir);
|
||||
$type = $music_dir->getType();
|
||||
|
||||
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());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Logging::info($_SERVER["HTTP_HOST"].": User ".$user->getLogin()." is deleting file: ".$this->_file->getDbTrackTitle()." - file id: ".$this->_file->getDbId());
|
||||
|
||||
try {
|
||||
if ($this->existsOnDisk() && $type == "stor") {
|
||||
$filepath = $this->getFilePath();
|
||||
//Update the user's disk usage
|
||||
Application_Model_Preference::updateDiskUsage(-1 * abs(filesize($filepath)));
|
||||
unlink($filepath);
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
Logging::warning($e->getMessage());
|
||||
//If the file didn't exist on disk, that's fine, we still want to
|
||||
//remove it from the database, so we continue here.
|
||||
}
|
||||
|
||||
// need to explicitly update any playlist's and block's length
|
||||
// that contains the file getting deleted
|
||||
$fileId = $this->_file->getDbId();
|
||||
|
@ -421,8 +420,7 @@ SQL;
|
|||
$bl->save();
|
||||
}
|
||||
|
||||
// We were setting file_exists to false and leaving it at that
|
||||
// but we should actually delete the file
|
||||
//We actually do want to delete the file from the database here
|
||||
$this->_file->delete();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue