"Apply Thresholds" dropdown option doesn't work

Support questions about the Threshold plugin

Moderators: Developers, Moderators

Post Reply
savagemindz
Posts: 10
Joined: Wed Feb 14, 2007 10:39 am

"Apply Thresholds" dropdown option doesn't work

Post by savagemindz »

Hi,

We have upgraded to PA2.1/Thold here but the "Apply Thresholds" dropdown option in host.php still doesn't seem to work on solaris. I believe it is where the PA assigns a variable to a function of itself. Maybe this is a solaris deficiency?

Basically when you select a host, then select "Apply Thresholds" from the dropdown and hit go the list on the next page (entitiled "Apply Thresholds") that appears is empty. Changing the function api_plugin_hook_function to add an extra $retr variable as a holder seems to solve it.

Is this fix safe for everything else? Seems to work for tholds anyway.

Thanks

iain

Function changed to....

Code: Select all

function api_plugin_hook_function ($name, $parm=NULL) {
        global $config, $plugin_hooks;
        $ret = $parm;
        $retr = $ret;
        $p = array();
        $result = db_fetch_assoc("SELECT name, file, function FROM plugin_hooks WHERE status = 1 AND hook = '$name'", false);

        if (count($result)) {
                foreach ($result as $hdata) {
                        $p[] = $hdata['name'];
                        if (file_exists($config['base_path'] . '/plugins/' . $hdata['name'] . '/' . $hdata['file'])) {
                                include_once($config['base_path'] . '/plugins/' . $hdata['name'] . '/' . $hdata['file']);
                        }
                        $function = $hdata['function'];
                        if (function_exists($function)) {
                                $retr = $function($ret);
                        }
                }
        }

        $ret = $retr;

        if (isset($plugin_hooks[$name]) && is_array($plugin_hooks[$name])) {
                foreach ($plugin_hooks[$name] as $pname => $function) {
                        if (function_exists($function)  && !function_exists('plugin_' . $pname . '_install') && !in_array($pname, $p))
 {
                                $retr = $function($ret);
                        }
                }
        }

        /* Variable-length argument lists have a slight problem when */
        /* passing values by reference. Pity. This is a workaround.  */
        return $retr;
}
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest