Esempio n. 1
0
 public function __construct(Linfo $linfo)
 {
     $settings = $linfo->getSettings();
     $this->connectionSettings = $settings['utorrent_connection'];
     $this->regexFilters = isset($settings['utorrent_filter']) && is_array($settings['utorrent_filter']) ? $settings['utorrent_filter'] : array();
     $this->hideName = isset($settings['utorrent_hide_name']) ? !empty($settings['utorrent_hide_name']) : false;
 }
Esempio n. 2
0
 public static function setUpBeforeClass()
 {
     $linfo = new Linfo();
     self::$parser = $linfo->getParser();
     self::assertInstanceOf('\\Linfo\\OS\\Linux', self::$parser);
     self::$parser->determineCPUPercentage();
 }
Esempio n. 3
0
 /**
  * localize important stuff.
  * @param Linfo $linfo
  */
 public function __construct(Linfo $linfo)
 {
     $settings = $linfo->getSettings();
     // Should we hide mac addresses, to prevent stuff like mac address spoofing?
     $this->_hide_mac = array_key_exists('dnsmasq_hide_mac', $settings) ? (bool) $settings['dnsmasq_hide_mac'] : false;
     // Find leases file
     $this->_leases_file = isset($settings['dnsmasq_leases']) && is_file($settings['dnsmasq_leases']) ? $settings['dnsmasq_leases'] : Common::locateActualPath(array('/var/lib/libvirt/dnsmasq/default.leases'));
 }
Esempio n. 4
0
 /**
  * localize important stuff.
  * @param Linfo $linfo
  */
 public function __construct(Linfo $linfo)
 {
     $settings = $linfo->getSettings();
     // Should we hide mac addresses, to prevent stuff like mac address spoofing?
     $this->_hide_mac = array_key_exists('dhcpd3_hide_mac', $settings) ? (bool) $settings['dhcpd3_hide_mac'] : false;
     // Find leases file
     $this->_leases_file = Common::locateActualPath(array('/var/lib/dhcp/dhcpd.leases', '/var/lib/dhcp3/dhcpd.leases', '/var/lib/dhcpd/dhcpd.leases', '/var/state/dhcp/dhcpd.leases', '/var/db/dhcpd/dhcpd.leases', '/var/db/dhcpd.leases'));
 }
Esempio n. 5
0
 /**
  * localize important stuff.
  * @param Linfo $linfo
  */
 public function __construct(Linfo $linfo)
 {
     $settings = $linfo->getSettings();
     // Classes we need
     $this->_CallExt = new CallExt();
     $this->_CallExt->setSearchPaths(array('/usr/bin', '/usr/local/bin'));
     // Transmission specific settings
     $this->_auth = array_key_exists('transmission_auth', $settings) ? (array) $settings['transmission_auth'] : array();
     $this->_host = array_key_exists('transmission_host', $settings) ? (array) $settings['transmission_host'] : array();
     // Path to home dir folder
     $this->_folder = array_key_exists('transmission_folder', $settings) && is_dir($settings['transmission_folder']) && is_readable($settings['transmission_folder']) ? $settings['transmission_folder'] : false;
 }
Esempio n. 6
0
 public function getFacts()
 {
     $old_error_reporting = error_reporting(0);
     $linfo = new Info();
     $parser = $linfo->getParser();
     $cpu_info = $parser->getCpu();
     $uptime = $parser->getUptime();
     $uptime_s = time() - $uptime['bootedTimestamp'];
     $distro = $parser->getDistro();
     $ram = $parser->getRam();
     error_reporting($old_error_reporting);
     return array('fqdn' => $parser->getHostName(), 'processors' => array('models' => array_column($cpu_info, 'Model'), 'count' => count($cpu_info)), 'system_uptime' => array('seconds' => $uptime_s, 'hours' => floor($uptime_s / 3600), 'days' => floor($uptime_s / (3600 * 24)), 'uptime' => $uptime['text']), 'architecture' => $parser->getCPUArchitecture(), 'os' => array('name' => $distro['name'], 'lsb' => array('distdescription' => $distro['name'] . ' ' . $parser->getOS() . ' ' . $distro['version'])), 'memoryfree_mb' => round($ram['free'] / (1024 * 1024), 2), 'memorysize_mb' => round($ram['total'] / (1024 * 1024), 2), 'swapfree_mb' => round($ram['swapFree'] / (1024 * 1024), 2), 'swapsize_mb' => round($ram['swapTotal'] / (1024 * 1024), 2), 'memoryfree' => Utils::humanize($ram['free']), 'memorysize' => Utils::humanize($ram['total']), 'swapfree' => Utils::humanize($ram['swapFree']), 'swapsize' => Utils::humanize($ram['swapTotal']));
 }
Esempio n. 7
0
 public function indexAction()
 {
     try {
         $settings = Common::getVarFromFile($this->linfoHome . 'sample.config.inc.php', 'settings');
         $settings["compress_content"] = false;
         $linfo = new Linfo($settings);
         $linfo->scan();
         $output = new \Linfo\Output\Html($linfo);
         $output->output();
     } catch (FatalException $e) {
         echo $e->getMessage() . "\n";
         exit(1);
     }
     $this->removeViewRenderer();
 }
Esempio n. 8
0
require_once __DIR__ . '/standalone_autoload.php';
use Linfo\Exceptions\FatalException;
use Linfo\Linfo;
use Linfo\Common;
try {
    // Load settings file..
    // Support legacy config files
    define('IN_LINFO', 'true');
    define('IN_INFO', 'true');
    if (!is_file(__DIR__ . '/config.inc.php') && is_file(__DIR__ . '/sample.config.inc.php')) {
        throw new FatalException('Make changes to sample.config.inc.php then rename as config.inc.php');
    } elseif (!is_file(__DIR__ . '/config.inc.php')) {
        throw new FatalException('Config file not found.');
    }
    $settings = Common::getVarFromFile(__DIR__ . '/config.inc.php', 'settings');
    $linfo = new Linfo($settings);
    $linfo->scan();
    if (isset($_SERVER['LINFO_NCURSES']) && php_sapi_name() == 'cli') {
        $output = new \Linfo\Output\Ncurses($linfo);
    } else {
        switch (array_key_exists('out', $_GET) ? strtolower($_GET['out']) : 'html') {
            default:
            case 'html':
                $output = new \Linfo\Output\Html($linfo);
                break;
            case 'json':
            case 'jsonp':
                // To use JSON-P, pass the GET arg - callback=function_name
                $output = new \Linfo\Output\Json($linfo, array_key_exists('callback', $_GET) ? $_GET['callback'] : null);
                break;
            case 'php_array':
Esempio n. 9
0
 public static function setUpBeforeClass()
 {
     Common::$path_prefix = dirname(dirname(__FILE__)) . '/../files/linux/generic_distro';
     $linfo = new Linfo();
     self::$parser = $linfo->getParser();
 }
Esempio n. 10
0
 public function __construct(Linfo $linfo)
 {
     $settings = $linfo->getSettings();
     $this->connectionSettings = $settings['libvirt_connection'];
 }
Esempio n. 11
0
 public function __construct(Linfo $linfo)
 {
     $settings = $linfo->getSettings();
     $this->_LinfoError = Errors::Singleton();
     $this->_servers = (array) $settings['soldat_servers'];
 }
Esempio n. 12
0
 /**
  * Linfo constructor.
  *
  * @throws FatalException
  */
 public function __construct()
 {
     $linfo = new LinfoBase(config('linfo.source'));
     $linfo->scan();
     $this->setup($linfo->getInfo());
 }
Esempio n. 13
0
 public static function setUpBeforeClass()
 {
     $linfo = new Linfo();
     self::$parser = $linfo->getParser();
     self::assertInstanceOf('\\Linfo\\OS\\FreeBSD', self::$parser);
 }
Esempio n. 14
0
 public static function config(Linfo $linfo)
 {
     self::$settings = $linfo->getSettings();
 }