summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: cab11b3)
raw | patch | inline | side by side (parent: cab11b3)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 1 Jul 2010 14:16:34 +0000 (14:16 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 1 Jul 2010 14:16:34 +0000 (14:16 +0000) |
-Added ability to receive returnVar and returnCode, additionally fixed error messages
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@18907 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@18907 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-core/include/class_plugin.inc | patch | blob | history |
index 9bef3cb81665a14de8c5ada76c67bbe127302881..436aee0da1fac639264f176181c7d26d2de16971 100644 (file)
* Replaces placeholder by class values of this plugin instance.
* @param Allows to a add special replacements.
*/
- static function callHook($plugin, $cmd, $addAttrs= array())
+ static function callHook($plugin, $cmd, $addAttrs= array(), &$returnOutput = array(), &$returnCode = NULL)
{
global $config;
$command = $config->configRegistry->getPropertyValue(get_class($plugin),$cmd);
}
if (check_command($command)){
+
@DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__,$command,"Execute");
- exec($command,$arr);
- if(is_array($arr)){
+ 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($plugin));
+ msg_dialog::display(_("Error"), $message, ERROR_DIALOG);
+ }elseif(is_array($arr)){
$str = implode("\n",$arr);
@DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, $command, "Result: ".$str);
}
} else {
- $message= msgPool::cmdnotfound("POSTCREATE", get_class($plugin));
+ $message= msgPool::cmdinvalid($cmd,$command, get_class($plugin));
msg_dialog::display(_("Error"), $message, ERROR_DIALOG);
}
}