Commit 53af319e authored by Côme Chilliet's avatar Côme Chilliet

Merge branch...

Merge branch '6068-we-should-have-an-option-on-triggers-to-only-show-the-result-and-not-the-full-trigger-error' into '1.4-dev'

Resolve "We should have an option on triggers to only show the result and not the full trigger error message"

See merge request fusiondirectory/fd!737
parents 20978899 c68e01d3
......@@ -1515,22 +1515,25 @@ class simplePlugin implements SimpleTab
$command = templateHandling::parseString($command, $addAttrs, 'escapeshellarg');
@DEBUG(DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, $command, "Execute");
@DEBUG(DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, $command, 'Execute');
exec($command, $arr, $returnCode);
$returnOutput = $arr;
if ($returnCode != 0) {
$str = implode("\n", $arr);
@DEBUG(DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, $command, "Execution failed code: ".$returnCode);
$message = msgPool::cmdexecfailed($cmd, $command, get_class($this));
@DEBUG(DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, $command, 'Execution failed code: '.$returnCode);
@DEBUG(DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, $command, 'Output: '.$str);
$message = msgPool::cmdexecfailed($cmd, '', get_class($this));
$message .= '<br/><br/>'."\n";
$message .= 'Exit code: '.$returnCode.'<br/>'."\n";
if (!empty($str)) {
$message .= "Result: ".$str;
$message .= 'Result: '.$str."\n";
}
$messages[] = $message;
} elseif (is_array($arr)) {
$str = implode("\n", $arr);
@DEBUG(DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, $command, "Result: ".$str);
if (!empty($str) && $config->get_cfg_value("displayHookOutput", "FALSE") == "TRUE") {
@DEBUG(DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, $command, 'Output: '.$str);
if (!empty($str) && $config->get_cfg_value('displayHookOutput', 'FALSE') == 'TRUE') {
msg_dialog::display('['.get_class($this).' '.strtolower($cmd).'trigger] '.$command, $str, INFO_DIALOG);
}
}
......@@ -1561,8 +1564,7 @@ class simplePlugin implements SimpleTab
$error = $this->callHook('CHECK', ['nbCheckErrors' => count($messages)], $returnOutput);
if (!empty($error)) {
$messages = array_merge($messages, $error);
}
if (!empty($returnOutput)) {
} elseif (!empty($returnOutput)) {
$messages[] = join("\n", $returnOutput);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment