Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Driver.php
Go to the documentation of this file.
1 <?php
8 
10 
14 class Driver
15 {
19  private $commandRenderer;
20 
24  public function __construct(CommandRendererInterface $commandRenderer)
25  {
26  $this->commandRenderer = $commandRenderer;
27  }
28 
37  public function execute($command, $arguments)
38  {
39  $disabled = explode(',', str_replace(' ', ',', ini_get('disable_functions')));
40  if (in_array('exec', $disabled)) {
41  throw new LocalizedException(new \Magento\Framework\Phrase('The exec function is disabled.'));
42  }
43 
44  $command = $this->commandRenderer->render($command, $arguments);
45  exec($command, $output, $exitCode);
46  $output = implode(PHP_EOL, $output);
47  return new Response(['output' => $output, 'exit_code' => $exitCode, 'escaped_command' => $command]);
48  }
49 }
exec($command, array &$output=null, &$return_var=null)
__construct(CommandRendererInterface $commandRenderer)
Definition: Driver.php:24
$arguments
execute($command, $arguments)
Definition: Driver.php:37