7 if (isset($_POST[
'command'])) {
8 $command = urldecode($_POST[
'command']);
9 if (array_key_exists(
"arguments", $_POST)) {
14 $php = PHP_BINDIR ? PHP_BINDIR .
'/php' :
'php';
18 escapeCommand($php .
' -f ../../../../bin/magento ' . $command) .
" $arguments" .
" 2>&1",
23 http_response_code(202);
25 http_response_code(500);
29 http_response_code(403);
30 echo
"Given command not found valid in Magento CLI Command list.";
33 http_response_code(412);
34 echo(
"Command parameter is not set.");
46 '> /dev/null &' =>
'--dev-null-amp--' 49 $command = escapeshellcmd(
50 str_replace(array_keys($escapeExceptions), array_values($escapeExceptions), $command)
53 return str_replace(array_values($escapeExceptions), array_keys($escapeExceptions), $command);
63 $php = PHP_BINDIR ? PHP_BINDIR .
'/php' :
'php';
64 exec($php .
' -f ../../../../bin/magento list', $commandList);
66 $commandList = array_map(
"trimAfterWhitespace", $commandList);
77 return strtok($string,
' ');
exec($command, array &$output=null, &$return_var=null)
validateCommand($command)
trimAfterWhitespace($string)