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