cc-4105: small improvement in reloadMetadataGroupAction. We give more detailed responses and log bad requests in a little more detail as well
This commit is contained in:
parent
f348652f0e
commit
0ddc8497c3
|
@ -539,7 +539,7 @@ class ApiController extends Zend_Controller_Action
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
// extract all file metadata params from the request.
|
// extract all file metadata params from the request.
|
||||||
// The value is a json encoded hash that has all the information related to this action
|
// The value is a json encoded hash that has all the information related to this action
|
||||||
// The key does not have any meaning as of yet but it could potentially correspond
|
// The key(mdXXX) does not have any meaning as of yet but it could potentially correspond
|
||||||
// to some unique id.
|
// to some unique id.
|
||||||
$responses = array();
|
$responses = array();
|
||||||
$params = $request->getParams();
|
$params = $request->getParams();
|
||||||
|
@ -548,9 +548,11 @@ class ApiController extends Zend_Controller_Action
|
||||||
if( !preg_match('/^md\d+$/', $k) ) { continue; }
|
if( !preg_match('/^md\d+$/', $k) ) { continue; }
|
||||||
$info_json = json_decode($raw_json, $assoc=true);
|
$info_json = json_decode($raw_json, $assoc=true);
|
||||||
if( !array_key_exists('mode', $info_json) ) {
|
if( !array_key_exists('mode', $info_json) ) {
|
||||||
Logging::log("Received bad request, no 'mode' parameter. Bad request is:");
|
Logging::log("Received bad request(key=$k), no 'mode' parameter. Bad request is:");
|
||||||
Logging::log( $info_json );
|
Logging::log( $info_json );
|
||||||
array_push( $responses, array('error' => "Bad request. no 'mode' parameter passed.") );
|
array_push( $responses, array(
|
||||||
|
'error' => "Bad request. no 'mode' parameter passed.",
|
||||||
|
'key' => $k));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Removing 'mode' key from $info_json might not be necessary...
|
// Removing 'mode' key from $info_json might not be necessary...
|
||||||
|
@ -558,6 +560,9 @@ class ApiController extends Zend_Controller_Action
|
||||||
unset( $info_json['mode'] );
|
unset( $info_json['mode'] );
|
||||||
// TODO : remove the $dry_run parameter after finished testing
|
// TODO : remove the $dry_run parameter after finished testing
|
||||||
$response = $this->dispatchMetadataAction($info_json, $mode, $dry_run=true);
|
$response = $this->dispatchMetadataAction($info_json, $mode, $dry_run=true);
|
||||||
|
// We attack the 'key' back to every request in case the would like to associate
|
||||||
|
// his requests with particular responses
|
||||||
|
$response['key'] = $k;
|
||||||
array_push($responses, $response);
|
array_push($responses, $response);
|
||||||
// On recorded show requests we do some extra work here. Not sure what it actually is and it
|
// On recorded show requests we do some extra work here. Not sure what it actually is and it
|
||||||
// was usually called from the python api. Now we just call it straight from the controller to
|
// was usually called from the python api. Now we just call it straight from the controller to
|
||||||
|
|
Loading…
Reference in New Issue