Comment 1 for bug 1350602

Revision history for this message
Steven Barre (slashterix) wrote :

Doing this to the function seems to fix it, but I'm sure this is an ugly hack.

function ss_get_mysql_stats( $options ) {
   # Process connection options.
   global $debug, $mysql_user, $mysql_pass, $cache_dir, $poll_time, $chk_options,
          $mysql_port, $mysql_ssl, $mysql_ssl_key, $mysql_ssl_cert, $mysql_ssl_ca,
          $heartbeat, $heartbeat_table, $heartbeat_server_id, $heartbeat_utc;

   # If called from the script server, reparse the args
   if (!is_array($options)) {
      $options = parse_cmdline(func_get_args());
   }

   # Chech for the cnf files
   if ( file_exists('/etc/cacti/' . basename(__FILE__) . '.cnf' ) ) {
      require('/etc/cacti/' . basename(__FILE__) . '.cnf');
      debug('Found configuration file /etc/cacti/' . basename(__FILE__) . '.cnf');
   }
   elseif ( file_exists(__FILE__ . '.cnf' ) ) {
      require(__FILE__ . '.cnf');
      debug('Found configuration file ' . __FILE__ . '.cnf');
   }

   $user = isset($options['user']) ? $options['user'] : $mysql_user;
   $pass = isset($options['pass']) ? $options['pass'] : $mysql_pass;
   $host = $options['host'];
   $port = isset($options['port']) ? $options['port'] : $mysql_port;
   $heartbeat_server_id = isset($options['server-id']) ? $options['server-id'] : $heartbeat_server_id;