You are here

public function Download::execute in DRD Agent 8.3

Same name and namespace in other branches
  1. 4.0.x src/Agent/Action/Download.php \Drupal\drd_agent\Agent\Action\Download::execute()

Execute an action.

Return value

mixed The response of the action as an array which will be encrypted before returned to DRD.

Overrides Base::execute

File

src/Agent/Action/Download.php, line 16

Class

Download
Offers a download file.

Namespace

Drupal\drd_agent\Agent\Action

Code

public function execute() {
  $args = $this
    ->getArguments();
  $filename = $this->crypt
    ->encryptFile($args['source']);
  $header = Agent::responseHeader();
  $header['X-DRD-Encrypted'] = $filename !== $args['source'];
  return new BinaryFileResponse($filename, 200, $header, FALSE);
}