Closed gmourani closed 5 years ago
Download the last fest develop version
Thanks, this fixed the problem. It's normal that running the command "php /var/www/html/cacti/plugins/reportit/runtime.php -d" as apache user, doesn't update the 'Last run (EST)' time in the view.php page and doing the same via the WUI (reports.php), update it ?
It should run the same no matter which method is used. If you run that via sudo, you should see what output appears. Also, check the cacti.log and apache error log to see if any errors appear.
Yes, "Last run (EST)" is updated. I can see the following in CLI, I suppose it's normal.
php /var/www/html/cacti/plugins/reportit/runtime.php -d PHP Notice: Array to string conversion in /var/www/html/cacti/lib/functions.php on line 3648 PHP Notice: Array to string conversion in /var/www/html/cacti/lib/functions.php on line 3648 PHP Warning: trim() expects parameter 1 to be string, array given in /var/www/html/cacti/include/phpmailer/class.phpmailer.php on line 874 PHP Warning: trim() expects parameter 1 to be string, array given in /var/www/html/cacti/include/phpmailer/class.phpmailer.php on line 874
Can you run that again with --debug
after downloading the latest development version?
Just curious to see what occurs.
Here the returning output when executed as apache user in CLI. php /var/www/html/cacti/plugins/reportit/runtime.php -d --debug > result.txt PHP Notice: Undefined offset: 1 in /var/www/html/cacti/lib/functions.php on line 3648 PHP Notice: Array to string conversion in /var/www/html/cacti/lib/functions.php on line 3648 PHP Warning: trim() expects parameter 1 to be string, array given in /var/www/html/cacti/include/phpmailer/class.phpmailer.php on line 874 PHP Notice: Array to string conversion in /var/www/html/cacti/lib/functions.php on line 3648 PHP Notice: Array to string conversion in /var/www/html/cacti/lib/functions.php on line 3648 PHP Warning: trim() expects parameter 1 to be string, array given in /var/www/html/cacti/include/phpmailer/class.phpmailer.php on line 874 PHP Warning: trim() expects parameter 1 to be string, array given in /var/www/html/cacti/include/phpmailer/class.phpmailer.php on line 874
Also, I've attached the result in txt file to this message (~8MB). result.txt
OK so the problem seems to be that the version detection code is making you use the built in mailer. However, ReportIT needs the 1.2 mailer (which has had a bit of an overhaul to function better). As such, it's passing in arrays which the 1.1.x mailer will not understand. To that end, we added v1_2_0_mailer() as a pure ripped copy to reportit's own libraries so that could be used in place of the 1.1.38 version which doesn't handle things the way that's expect.
OK, here is where I must have been confused, I tested the cacti version detection code, and it seems to be inverted to what I've coded. I tested four versions against the '1.2.0' string which said that the following signs were true (1):
1.1.1: [ <] 1 [<=] 1 [ =] [=>] [ >]
1.1.38: [ <] 1 [<=] 1 [ =] [=>] [ >]
1.2.0: [ <] [<=] 1 [ =] 1 [=>] [ >]
1.3.1: [ <] [<=] [ =] [=>] [ >] 1
If you are running 1.1.38, it should have picked the v1_2_0_mailer
, but was instead picking the builtin mailer
.
if (cacti_version_compare(CACTI_VERSION, '1.2.0', '<')) {
$mailer_func = "mailer";
} else {
include_once(__DIR__ . '/funct_mailer.php');
$mailer_func = "v1_2_0_mailer";
}
This is now in the main development code, please check and close if issue is resolved. This was not an issue if you were running 1.2.0 beta as that mailer()
function was already compatible.
Tested with latest dev code and the issue is resolved, thanks.
Plugin reportit : 1.1.2 Cacti : 1.1.38
I've successfully created a new report and this morning when trying to see the result, I can see in the Cacti log the following. Look like Cacti has automatically disable the plugin !
2018/11/22 00:00:02 - CMDPHP ERRORS DETECTED - DISABLING PLUGIN 'reportit'
2018/11/22 00:00:02 - CMDPHP PHP ERROR Backtrace: (CactiShutdownHandler)(/lib/functions.php: 4628 cacti_debug_backtrace) 2018/11/22 00:00:02 - ERROR PHP ERROR in Plugin 'reportit': Call to undefined function cacti_sizeof() in file: /var/www/html/cacti/plugins/reportit/lib/funct_mailer.php on line: 212
Regards,