You are here

function drd_server_execute in Drupal Remote Dashboard Server 7.2

Same name and namespace in other branches
  1. 6.2 drd_server.module \drd_server_execute()

This is called to execute one of the actions that are defined on one of the hook_drd_server_actions().

Return value

string The result string to be sent back to DRD.

1 string reference to 'drd_server_execute'
drd_server_xmlrpc in ./drd_server.module
Implementation of hook_xmlrpc().

File

./drd_server.module, line 518
Provides XMLRPC implementation to respond to requests from DRD.

Code

function drd_server_execute() {
  $args = func_get_args();
  $action_name = array_shift($args);
  $valid = _drd_server_validate_request($args, $action_name);
  if ($valid !== TRUE) {
    return $valid;
  }
  $action_name = array_pop($args);
  $actions = module_invoke_all('drd_server_actions');
  if ($action_name == 'drd.actions') {
    return drd_server_result('drd.actions', $actions);
  }
  if (!isset($actions[$action_name])) {
    return drd_server_error(t('Action %action_name does not exist.', array(
      '%action_name' => $action_name,
    )), DRD_SERVER_ERROR_NO_OP);
  }
  $action = $actions[$action_name];
  if (!function_exists($action['callback'])) {
    return drd_server_error(t('Action %action_name does not have any callback.', array(
      '%action_name' => $action_name,
    )), DRD_SERVER_ERROR_NO_FUNC);
  }
  return call_user_func_array($action['callback'], $args);
}