Implement an autoloader (#4140)

* 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
This commit is contained in:
Tony Murray
2016-08-21 08:07:14 -05:00
committed by Neil Lathwood
parent c2f7602cc5
commit b8e9b2d917
55 changed files with 891 additions and 503 deletions

View File

@@ -11,8 +11,7 @@
* the source code distribution for details.
*/
require_once "../includes/component.php";
$component = new component();
$component = new LibreNMS\Component();
$options = array();
$options['filter']['ignore'] = array('=',0);
$options['type'] = 'ntp';

View File

@@ -32,9 +32,8 @@ echo('
<div class="col-md-6">
');
require 'includes/dev-overview-data.inc.php';
use LibreNMS\Plugins;
Plugins::call('device_overview_container', array($device));
LibreNMS\Plugins::call('device_overview_container', array($device));
require 'overview/ports.inc.php';
echo('

View File

@@ -88,8 +88,7 @@ if (dbFetchCell("SELECT COUNT(*) FROM `ports_vlans` WHERE `port_id` = '".$port['
}
// Are there any CBQoS components for this device?
require_once "../includes/component.php";
$component = new component();
$component = new LibreNMS\Component();
$options = array(); // Re-init array in case it has been declared previously.
$options['filter']['type'] = array('=','Cisco-CBQOS');
$components = $component->getComponents($device['device_id'], $options);

View File

@@ -1,7 +1,6 @@
<?php
require_once "../includes/component.php";
$component = new component();
$component = new LibreNMS\Component();
$options = array();
$options['filter']['ignore'] = array('=',0);
$options['type'] = 'Cisco-OTV';