Cacti (home)ForumsRepositoryDocumentation
Cacti: offical forums and support  

 FAQFAQ   SearchSearch   MemberlistMemberlist    RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in    


PIA 2.0 issues - HELP !
Goto page Previous  1, 2
 
Post new topic   Reply to topic    Cacti Forum Index -> Plugin Architecture
Author Message
jofficer



Joined: 04 Feb 2008
Posts: 33

PostPosted: Tue Apr 08, 2008 10:03 am    Post subject: Reply with quote

srossen wrote:
sepp wrote:
hr... any idea on this one?

Code:
Fatal error: Call to undefined function api_plugin_hook() in /usr/share/cacti/site/include/global_arrays.php on line 620


I applied the sql file...


I got around to looking at this and used the pre-patched files and did not have this issue. I did have to change the path to adodb but now up and running fine on 0.8.7b and PIA 2.0


How did you change the adodb path, I seem to be having a similar error:
Code:
Warning: include(/usr/share/webapps/cacti/0.8.7b/htdocs/lib/adodb/adodb.inc.php) [function.include]: failed to open stream: No such file or directory in /usr/share/webapps/cacti/0.8.7b/htdocs/include/global.php on line 201

Warning: include() [function.include]: Failed opening '/usr/share/webapps/cacti/0.8.7b/htdocs/lib/adodb/adodb.inc.php' for inclusion (include_path='.:/usr/share/php5:/usr/share/php') in /usr/share/webapps/cacti/0.8.7b/htdocs/include/global.php on line 201

Fatal error: Call to undefined function NewADOConnection() in /usr/share/webapps/cacti/0.8.7b/htdocs/lib/database.php on line 38
Back to top
Hellever



Joined: 11 Apr 2008
Posts: 1

PostPosted: Fri Apr 11, 2008 4:14 pm    Post subject: Reply with quote

Hello!!!

I have a solution of this error. I installed cacti 0.8.7b-2 with plugin 2.2 and also this error has appeard:

Warning: include(/usr/share/webapps/cacti/0.8.7b/htdocs/lib/adodb/adodb.inc.php) [function.include]: failed to open stream: No such file or directory in /usr/share/webapps/cacti/0.8.7b/htdocs/include/global.php on line 201

Warning: include() [function.include]: Failed opening '/usr/share/webapps/cacti/0.8.7b/htdocs/lib/adodb/adodb.inc.php' for inclusion (include_path='.:/usr/share/php5:/usr/share/php') in /usr/share/webapps/cacti/0.8.7b/htdocs/include/global.php on line 201

Fatal error: Call to undefined function NewADOConnection() in /usr/share/webapps/cacti/0.8.7b/htdocs/lib/database.php on line 38

You have to copy adodb directory to cacti/site/lib/. This removes error. This folder you can download from kola.pl.pl
In global.php check your url path and rra path. In my case $config["rra_path"] = '/var/lib/cacti/rra';

Regards
Back to top
Dyr



Joined: 10 Sep 2007
Posts: 8

PostPosted: Wed Apr 30, 2008 5:43 am    Post subject: Reply with quote

Check rejected patch.
I have global.php.rej after patching with this text:
Code:
***************
*** 179,196 ****
  /* display ALL errors */
  error_reporting(E_ALL);

  /* include base modules */
  include($config["library_path"] . "/adodb/adodb.inc.php");
  include($config["library_path"] . "/database.php");
- include_once($config["library_path"] . "/functions.php");
- include_once($config["include_path"] . "/global_constants.php");
- include_once($config["include_path"] . "/global_arrays.php");
- include_once($config["include_path"] . "/global_settings.php");

  /* connect to the database server */
  db_connect_real($database_hostname, $database_username, $database_password, $database_default, $database_type, $database_port);

  /* include additional modules */
  include_once($config["include_path"] . "/global_form.php");
  include_once($config["library_path"] . "/html.php");
  include_once($config["library_path"] . "/html_form.php");
--- 194,217 ----
  /* display ALL errors */
  error_reporting(E_ALL);

+ /* current cacti version */
+ $config["cacti_version"] = "0.8.7b";
+
  /* include base modules */
  include($config["library_path"] . "/adodb/adodb.inc.php");
  include($config["library_path"] . "/database.php");

  /* connect to the database server */
  db_connect_real($database_hostname, $database_username, $database_password, $database_default, $database_type, $database_port);

  /* include additional modules */
+
+ include_once($config["library_path"] . "/functions.php");
+ include_once($config["include_path"] . "/global_constants.php");
+ include_once($config["library_path"] . "/plugins.php");
+ include_once($config["include_path"] . "/plugins.php");
+ include_once($config["include_path"] . "/global_arrays.php");
+ include_once($config["include_path"] . "/global_settings.php");
  include_once($config["include_path"] . "/global_form.php");
  include_once($config["library_path"] . "/html.php");
  include_once($config["library_path"] . "/html_form.php");

After I inspected code, I manually add and remove neccessary strings and it works!
Back to top
Hezoq



Joined: 30 May 2008
Posts: 1

PostPosted: Fri May 30, 2008 2:55 am    Post subject: Reply with quote

I have the same matter but I think I found where it seems to be defined.

I know nothing about the php but in the file "/cacti/site/lib/plugin.php" there is this whitch seems to be au definition :

/**
* This function executes a hook.
* @param string $name Name of hook to fire
* @return mixed $data
*/
function api_plugin_hook($name) {
global $config, $plugin_hooks;
$data = func_get_args();
$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)) {
$function($data);
}
}
}

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)) {
$function($data);
}
}
}

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



so if it could help...
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Plugin Architecture All times are GMT - 5 Hours
Goto page Previous  1, 2
Page 2 of 2

 



Powered by phpBB © 2001, 2005 phpBB Group