plugins, log executed tasks in configute and run. closes https://github.com/opnsense/core/issues/3771

This commit is contained in:
Ad Schellevis 2019-10-18 08:34:35 +02:00
parent fa6bec1725
commit b609eed0c7

View File

@ -240,6 +240,10 @@ function plugins_configure($hook, $verbose = false, $args = array())
if ($argc > count($args)) {
$argc = count($args);
}
syslog(LOG_NOTICE, sprintf(
'plugins_configure %s (execute task : %s(%s))',
$hook, $argf, implode(',', array_slice($args, 0, $argc))
));
call_user_func_array($argf, array_slice($args, 0, $argc));
}
}
@ -253,6 +257,8 @@ function plugins_run($hook, $verbose = false, $args = array())
array_unshift($args, $verbose);
$ret = [];
syslog(LOG_NOTICE, sprintf('plugins_run %s (%s)', $hook, implode(',', $args)));
foreach (plugins_scan() as $name => $path) {
try {
include_once $path;
@ -275,6 +281,9 @@ function plugins_run($hook, $verbose = false, $args = array())
if ($argc > count($args)) {
$argc = count($args);
}
syslog(LOG_NOTICE, sprintf(
'plugins_run %s (execute task : %s(%s))', $hook, $argf, implode(',', array_slice($args, 0, $argc))
));
$ret[$name] = call_user_func_array($argf, array_slice($args, 0, $argc));
}
}