* See COPYING for more details. * * @package LibreNMS * @subpackage config * @copyright (C) 2006 - 2012 Adam Armstrong * @license http://gnu.org/copyleft/gpl.html GNU GPL */ // // Please don't edit this file -- make changes to the configuration array in config.php // error_reporting(E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR); // set install_dir $config['install_dir'] = realpath(__DIR__ . '/..'); // initialize the class loader and add custom mappings require_once $config['install_dir'] . '/LibreNMS/ClassLoader.php'; $classLoader = new LibreNMS\ClassLoader(); $classLoader->registerClass('Console_Color2', $config['install_dir'] . '/lib/console_colour.php'); $classLoader->registerClass('Console_Table', $config['install_dir'] . '/lib/console_table.php'); $classLoader->registerClass('PHPMailer', $config['install_dir'] . "/lib/phpmailer/class.phpmailer.php"); $classLoader->registerClass('SMTP', $config['install_dir'] . "/lib/phpmailer/class.smtp.php"); $classLoader->registerClass('PasswordHash', $config['install_dir'] . '/html/lib/PasswordHash.php'); $classLoader->register(); // Default directories $config['project_name'] = 'LibreNMS'; $config['project_id'] = strtolower($config['project_name']); $config['temp_dir'] = '/tmp'; $config['log_dir'] = $config['install_dir'] . '/logs'; // MySQL extension to use $config['db']['extension'] = 'mysqli'; //mysql and mysqli available // What is my own hostname (used to identify this host in its own database)
#!/usr/bin/env php <?php use LibreNMS\Proc; $filename = basename(__FILE__); $install_dir = realpath(__DIR__ . '/..'); chdir($install_dir); require_once $install_dir . '/LibreNMS/ClassLoader.php'; $classLoader = new LibreNMS\ClassLoader(); $classLoader->register(); $short_opts = 'lsupch'; $long_opts = array('lint', 'style', 'unit', 'passthru', 'snmpsim', 'commands', 'help'); $options = getopt($short_opts, $long_opts); if (check_opt($options, 'h', 'help')) { echo "LibreNMS Code Tests Script\nRunning {$filename} without options runs all checks.\n -l, --lint Run php lint checks to test for valid syntax\n -s, --style Run phpcs check to check for PSR-2 compliance\n -u, --unit Run phpunit tests\n -p, --passthru Display output from checks as it comes\n --snmpsim Use snmpsim on 127.0.0.1:11161 for unit tests\n -c, --commands Print commands only, no checks\n -h, --help Show this help text.\n"; exit; } // set up some variables $passthru = check_opt($options, 'p', 'passthru'); $command_only = check_opt($options, 'c', 'commands'); $snmpsim = check_opt($options, 'snmpsim'); $ret = 0; $completed_tests = array('lint' => false, 'style' => false, 'unit' => false); $all = !check_opt($options, 'l', 'lint', 's', 'style', 'u', 'unit'); if ($all) { // no test specified, run all tests in this order $options += array('u' => false, 's' => false, 'l' => false); } // run tests in the order they were specified foreach (array_keys($options) as $opt) { if ($opt == 'l' || $opt == 'lint') { $ret += run_check('lint', $passthru, $command_only);
* * @package LibreNMS * @link http://librenms.org * @copyright 2016 Tony Murray * @author Tony Murray <*****@*****.**> */ // get the current LibreNMS install directory $install_dir = realpath(__DIR__ . '/..'); require $install_dir . '/includes/defaults.inc.php'; // definitions, don't want to initialize mysql... $config['install_dir'] = $install_dir; $config['mib_dir'] = $install_dir . '/mibs'; $config['snmpget'] = 'snmpget'; // initialize the class loader and add custom mappings require $install_dir . '/LibreNMS/ClassLoader.php'; $classLoader = new LibreNMS\ClassLoader(); $classLoader->registerDir($install_dir . '/tests', 'LibreNMS\\Tests'); $classLoader->register(); require $install_dir . '/includes/common.php'; require $install_dir . '/html/includes/functions.inc.php'; require $install_dir . '/includes/definitions.inc.php'; require $install_dir . '/includes/rrdtool.inc.php'; require $install_dir . '/includes/syslog.php'; require $install_dir . '/includes/dbFacile.php'; require $install_dir . '/includes/functions.php'; if (getenv('SNMPSIM')) { require $install_dir . '/includes/snmp.inc.php'; } else { require $install_dir . '/tests/mocks/mock.snmp.inc.php'; } ini_set('display_errors', 1);