From 8c9866fdaf539c3f021a992f13a30742cfd4ba91 Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Thu, 20 Apr 2023 12:45:35 +0200 Subject: [PATCH] system: finish simplifying plugins_run() We don't need to mask parameters here. The providers should use the same argument count or default parameters if needed. A single call cannot pass different arguments for different providers of the same run task. For most cases a single provider is set anyway or the data is simple enough. The reason this code existed was because plugins_run() was once copied from plugins_configure() which may require this behaviour but also has no return data. --- src/etc/inc/plugins.inc | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/src/etc/inc/plugins.inc b/src/etc/inc/plugins.inc index 6d9904333..f98fb2881 100644 --- a/src/etc/inc/plugins.inc +++ b/src/etc/inc/plugins.inc @@ -326,25 +326,8 @@ function plugins_run($hook, $args = []) if (function_exists($func)) { 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. - */ - if (substr_count($task, ':')) { - list($argf, $argc) = explode(':', $task); - } else { - $argf = $task; - $argc = null; - } - if (empty($argc) || !is_numeric($argc)) { - $argc = 1; - } - if ($argc > count($args)) { - $argc = count($args); - } try { - $result = call_user_func_array($argf, array_slice($args, 0, $argc)); + $result = call_user_func_array($task, $args); if (!empty($result)) { $ret[$name] = $result; }