better flow in dispatchMetadata function

This commit is contained in:
Martin Konecny 2013-05-09 17:37:23 -04:00
parent 3948964e8d
commit f5fa033207
1 changed files with 3 additions and 7 deletions

View File

@ -520,8 +520,6 @@ class ApiController extends Zend_Controller_Action
//File is not in database anymore.
if (is_null($file)) {
$return_hash['error'] = _("File does not exist in Airtime.");
return $return_hash;
}
//Updating a metadata change.
else {
@ -547,8 +545,6 @@ class ApiController extends Zend_Controller_Action
$return_hash['error'] = _("File doesn't exist in Airtime.");
Logging::warn("Attempt to delete file that doesn't exist.
Path: '$filepath'");
return $return_hash;
} else {
$file->deleteByMediaMonitor();
}
@ -561,11 +557,11 @@ class ApiController extends Zend_Controller_Action
$file->deleteByMediaMonitor();
}
$return_hash['success'] = 1;
return $return_hash;
}
$return_hash['fileid'] = is_null($file) ? '-1' : $file->getId();
if (!isset($return_hash['error'])) {
$return_hash['fileid'] = is_null($file) ? '-1' : $file->getId();
}
$con->commit();
} catch (Exception $e) {
Logging::warn("rolling back");