Commit 8d745baa authored by Franco Fichtner's avatar Franco Fichtner

plugins: simplify this before next step

parent ddcc54f4
......@@ -74,8 +74,7 @@ function plugins_services()
try { include_once $path; } catch (ParseError $e) { error_log($e); }
$func = sprintf('%s_services', $name);
if (function_exists($func)) {
$workers = $func();
foreach ($workers as $work) {
foreach ($func() as $work) {
$services[] = $work;
}
}
......@@ -92,8 +91,7 @@ function plugins_cron()
try { include_once $path; } catch (ParseError $e) { error_log($e); }
$func = sprintf('%s_cron', $name);
if (function_exists($func)) {
$workers = $func();
foreach ($workers as $work) {
foreach ($func() as $work) {
$jobs[] = $work;
}
}
......@@ -110,8 +108,7 @@ function plugins_syslog()
try { include_once $path; } catch (ParseError $e) { error_log($e); }
$func = sprintf('%s_syslog', $name);
if (function_exists($func)) {
$workers = $func();
foreach ($workers as $plugin_syslog => $plugin_details) {
foreach ($func() as $plugin_syslog => $plugin_details) {
$syslogs[$plugin_syslog] = $plugin_details;
}
}
......@@ -201,8 +198,7 @@ function plugins_configure($hook, $verbose = false, $args = array())
try { include_once $path; } catch (ParseError $e) { error_log($e); }
$func = sprintf('%s_configure', $name);
if (function_exists($func)) {
$workers = $func();
foreach ($workers as $when => $worker) {
foreach ($func() as $when => $worker) {
if ($hook == $when && is_array($worker)) {
foreach ($worker as $task) {
/*
......
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