mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-15 09:04:39 +00:00
plugins: plugins_run() has no workers concept
"Workers" are chains of commands, but with run we want defined output from the plugin itself so only one function/endpoint returning the data.
This commit is contained in:
parent
715ad3f253
commit
05622d5a93
@ -227,23 +227,21 @@ function plugins_run($hook, $verbose = false, $args = array())
|
||||
try { include_once $path; } catch (ParseError $e) { error_log($e); }
|
||||
$func = sprintf('%s_run', $name);
|
||||
if (function_exists($func)) {
|
||||
foreach ($func() as $when => $worker) {
|
||||
if ($hook == $when && is_array($worker)) {
|
||||
foreach ($worker as $task) {
|
||||
/*
|
||||
* An optional argument count parameter can be
|
||||
* given by the plugin, which allows to securely
|
||||
* pull more info from the configure call spot.
|
||||
*/
|
||||
list($argf, $argc) = explode(':', $task);
|
||||
if (empty($argc) || !is_numeric($argc)) {
|
||||
$argc = 1;
|
||||
}
|
||||
if ($argc > count($args)) {
|
||||
$argc = count($args);
|
||||
}
|
||||
$ret[$name] = call_user_func_array($argf, array_slice($args, 0, $argc));
|
||||
foreach ($func() as $when => $task) {
|
||||
if ($hook == $when) {
|
||||
/*
|
||||
* An optional argument count parameter can be
|
||||
* given by the plugin, which allows to securely
|
||||
* pull more info from the configure call spot.
|
||||
*/
|
||||
list($argf, $argc) = explode(':', $task);
|
||||
if (empty($argc) || !is_numeric($argc)) {
|
||||
$argc = 1;
|
||||
}
|
||||
if ($argc > count($args)) {
|
||||
$argc = count($args);
|
||||
}
|
||||
$ret[$name] = call_user_func_array($argf, array_slice($args, 0, $argc));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -301,7 +301,7 @@ function dpinger_configure_do($verbose = false, $gwname = null)
|
||||
function dpinger_run()
|
||||
{
|
||||
return array(
|
||||
'return_gateways_status' => array('dpinger_status'),
|
||||
'return_gateways_status' => 'dpinger_status',
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user