Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

Commit

Permalink
fix(helper) fix check command helper with option (#8268)
Browse files Browse the repository at this point in the history
  • Loading branch information
loiclau committed Jan 22, 2020
1 parent 3ae4672 commit e57a8c8
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions www/include/configuration/configObject/command/minHelpCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@

$aCmd = explode(" ", $cmd["command_line"]);
$fullLine = $aCmd[0];
$plugin = array_values(preg_grep('/^\-\-plugin\=(\w+)/i', $aCmd))[0];
$mode = array_values(preg_grep('/^\-\-mode\=(\w+)/i', $aCmd))[0];
$aCmd = explode("/", $fullLine);
$resourceInfo = $aCmd[0];

Expand All @@ -81,8 +83,13 @@
$command = str_replace("#BS#", "\\", $command);

$tab = explode(' ', $command);
$command = realpath($tab[0]);
$stdout = shell_exec($command . " --help 2>&1");
if (realpath($tab[0])) {
$command = realpath($tab[0]) . ' ' . $plugin . ' ' . $mode . ' --help';
} else {
$command = $tab[0] . ' ' . $plugin . ' ' . $mode . ' --help';
}

$stdout = shell_exec($command . " 2>&1");
$msg = str_replace("\n", "<br />", $stdout);

$attrsText = array("size" => "25");
Expand All @@ -109,7 +116,7 @@
$form->accept($renderer);
$tpl->assign('form', $renderer->toArray());
$tpl->assign('o', $o);
$tpl->assign('command_line', $command . " --help");
$tpl->assign('command_line', $command);
if (isset($msg) && $msg) {
$tpl->assign('msg', $msg);
}
Expand Down

0 comments on commit e57a8c8

Please sign in to comment.