Cacti (home)ForumsDocumentation
Cacti: offical forums and support
It is currently Fri Feb 15, 2019 10:25 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Call to undefined function api_tree_branch_exists()
PostPosted: Mon Feb 11, 2019 2:03 pm 
Offline
User avatar

Joined: Thu Mar 24, 2011 2:54 pm
Posts: 9
Location: Ankara / Turkey
From the log file:
- CMDPHP PHP ERROR Backtrace: (CactiShutdownHandler())
- ERROR PHP ERROR: Call to undefined function api_tree_branch_exists() in file: /usr/local/share/cacti/lib/api_automation.php on line: 2611

I recently upgraded Cacti from 1.1.37 to 1.2.1 and I started to get this error when I wanted to create graphs manually. The problem is solved (in a rough way) and I just wanted to share just in case anybody else experiences the same problem.

The 2611th line in the file api_automation.php is:
Code:
        if (api_tree_branch_exists($rule['tree_id'], $parent_tree_item_id, $title)) {
                $new_item = api_tree_get_branch_id($rule['tree_id'], $parent_tree_item_id, $title);


I added
Code:
        include_once($config['base_path'] . '/lib/api_tree.php');

to the function (right before the local variable declarations)

My Cacti runs in a jail on FreeBSD 12.0-p3 (custom kernel, stripped off some extras)
Dependencies were installed using "pkg, pkg-static" and Cacti code was downloaded from the Cacti home site. I have no other warnings on tech support (php, mysql are all good). The only thing that I can say is I use an older version of spine (v1.1.35) but I believe this is unrelated with this issue.

Once again thank you guys for this amazing program. Keep up the good work.

_________________
There are 10 kinds of people in the world. Those who understand binary, and those who don't...


Top
 Profile  
 
 Post subject: Re: Call to undefined function api_tree_branch_exists()
PostPosted: Tue Feb 12, 2019 5:20 am 
Offline
Cacti Guru User

Joined: Sun Aug 27, 2017 12:05 am
Posts: 2054
If you haven't already, could you either raise this as an issue on the GitHub site, or even better, create a pull request with the proposed fix (your name will forever be in the code history as the person who resolved it).

_________________
Official Cacti Developer

Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation

My resources:
How to submit Pull Requests
Development Wiki and How To's
Updated NetSNMP Memory template for Cacti 1.x
Cisco SFP template for Cacti 0.8.8


Top
 Profile  
 
 Post subject: Re: Call to undefined function api_tree_branch_exists()
PostPosted: Wed Feb 13, 2019 10:47 am 
Offline
User avatar

Joined: Thu Mar 24, 2011 2:54 pm
Posts: 9
Location: Ankara / Turkey
I did not do that and that actually sounds amazing.

To be honest, my solution does not look like a proper one, it is more like a workaround. I believe that the file I included in the code should be included in a more global location (not in a function). Additionally, I think I am the only one having this problem and it was a very obvious one (cannot create graphs). So may be it is because of my setup and not because of the code.

_________________
There are 10 kinds of people in the world. Those who understand binary, and those who don't...


Top
 Profile  
 
 Post subject: Re: Call to undefined function api_tree_branch_exists()
PostPosted: Wed Feb 13, 2019 11:19 am 
Offline
Cacti Guru User

Joined: Sun Aug 27, 2017 12:05 am
Posts: 2054
Submit it anyway, and it'll be reviewed :)

_________________
Official Cacti Developer

Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation

My resources:
How to submit Pull Requests
Development Wiki and How To's
Updated NetSNMP Memory template for Cacti 1.x
Cisco SFP template for Cacti 0.8.8


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group