public function ShellOperations::execShellCommand in Image Optimize Binaries 8
Execute a shell command on the local system.
Parameters
$command: The command to execute.
$options: An array of options for the command. This will not be escaped before executing.
$arguments: An array of arguments for the command. These will be escaped.
Return value
bool Returns TRUE if the command completed successfully, FALSE otherwise.
Overrides ImageAPIOptimizeShellOperationsInterface::execShellCommand
File
- src/
ShellOperations.php, line 47
Class
- ShellOperations
- Storage controller class for "image optimize pipeline" configuration entities.
Namespace
Drupal\imageapi_optimize_binariesCode
public function execShellCommand($command, $options, $arguments) {
$output = array();
$return_val = 0;
$option_string = implode(' ', $options);
$argument_string = implode(' ', array_map('escapeshellarg', $arguments));
exec(escapeshellcmd($command) . ' ' . $option_string . ' ' . $argument_string, $output, $return_val);
if ($return_val == 0) {
return TRUE;
}
else {
return FALSE;
}
}