mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
* Implement an autoloader When cleaning up classes for psr2, things got a bit unwieldy, so I implemented a class autoloader. I created a PSR-0 compliant LibreNMS directory and moved all classes there that made sense. Implemented LibreNMS\ClassLoader which supports adding manual class mappings This reduces the file includes needed and only loads classes when needed. * Add teh autoloader to graph.php * Add a small bit of docs Fix incomplete class in includes/discovery/functions.inc.php
62 lines
2.0 KiB
PHP
62 lines
2.0 KiB
PHP
<?php
|
|
|
|
/**
|
|
* LibreNMS
|
|
*
|
|
* This file is part of LibreNMS.
|
|
*
|
|
* @package librenms
|
|
* @subpackage graphing
|
|
* @author Adam Armstrong <adama@memetic.org>
|
|
* @copyright (C) 2006 - 2012 Adam Armstrong
|
|
*/
|
|
|
|
|
|
$start = microtime(true);
|
|
|
|
require_once 'Net/IPv4.php';
|
|
|
|
if (isset($_GET['debug'])) {
|
|
$debug = true;
|
|
ini_set('display_errors', 1);
|
|
ini_set('display_startup_errors', 0);
|
|
ini_set('log_errors', 0);
|
|
ini_set('error_reporting', E_ALL);
|
|
} else {
|
|
$debug = false;
|
|
ini_set('display_errors', 0);
|
|
ini_set('display_startup_errors', 0);
|
|
ini_set('log_errors', 0);
|
|
ini_set('error_reporting', 0);
|
|
}
|
|
|
|
require_once '../includes/defaults.inc.php';
|
|
require_once '../config.php';
|
|
require_once '../includes/definitions.inc.php';
|
|
|
|
// initialize the class loader and add custom mappings
|
|
require_once $config['install_dir'] . '/LibreNMS/ClassLoader.php';
|
|
$classLoader = new LibreNMS\ClassLoader();
|
|
$classLoader->mapClass('Console_Color2', $config['install_dir'] . '/includes/console_colour.php');
|
|
$classLoader->mapClass('PasswordHash', $config['install_dir'] . '/html/lib/PasswordHash.php');
|
|
$classLoader->register();
|
|
|
|
require_once '../includes/common.php';
|
|
require_once '../includes/dbFacile.php';
|
|
require_once '../includes/rewrites.php';
|
|
require_once 'includes/functions.inc.php';
|
|
require_once '../includes/rrdtool.inc.php';
|
|
if ($config['allow_unauth_graphs'] != true) {
|
|
require_once 'includes/authenticate.inc.php';
|
|
}
|
|
require 'includes/graphs/graph.inc.php';
|
|
|
|
$console_color = new Console_Color2();
|
|
|
|
$end = microtime(true);
|
|
$run = ($end - $start);
|
|
|
|
|
|
d_echo('<br />Runtime '.$run.' secs');
|
|
d_echo('<br />MySQL: Cell '.($db_stats['fetchcell'] + 0).'/'.round(($db_stats['fetchcell_sec'] + 0), 3).'s'.' Row '.($db_stats['fetchrow'] + 0).'/'.round(($db_stats['fetchrow_sec'] + 0), 3).'s'.' Rows '.($db_stats['fetchrows'] + 0).'/'.round(($db_stats['fetchrows_sec'] + 0), 3).'s'.' Column '.($db_stats['fetchcol'] + 0).'/'.round(($db_stats['fetchcol_sec'] + 0), 3).'s');
|