public function Download::execute in DRD Agent 4.0.x
Same name and namespace in other branches
- 8.3 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\ActionCode
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);
}