mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-29 00:34:46 +02:00
Merge branch 'ent-4755-base-de-datos-historico-revision' into 'develop'
DBMainainer, fixed Websockets library placement See merge request artica/pandorafms!3797
This commit is contained in:
commit
6413f6d551
@ -74,4 +74,7 @@ enterprise/extensions/ipam
|
||||
enterprise/extensions/disabled/visual_console_manager.php
|
||||
enterprise/extensions/visual_console_manager.php
|
||||
pandora_console/extensions/net_tools.php
|
||||
include/lib/WSManager.php
|
||||
include/lib/WebSocketServer.php
|
||||
include/lib/WebSocketUser.php
|
||||
operation/network/network_explorer.php
|
||||
|
@ -29,7 +29,10 @@
|
||||
|
||||
// Load global vars.
|
||||
global $config;
|
||||
require_once 'include/config.php';
|
||||
require_once $config['homedir'].'/include/config.php';
|
||||
require_once $config['homedir'].'/vendor/autoload.php';
|
||||
|
||||
use PandoraFMS\Core\Config;
|
||||
|
||||
check_login();
|
||||
|
||||
@ -388,44 +391,11 @@ if ($config['history_db_enabled'] == 1) {
|
||||
);
|
||||
}
|
||||
|
||||
$config_history = false;
|
||||
if ($config['history_db_connection']) {
|
||||
$history_connect = mysql_db_process_sql(
|
||||
'DESCRIBE tconfig',
|
||||
'affected_rows',
|
||||
$config['history_db_connection'],
|
||||
false
|
||||
);
|
||||
|
||||
if ($history_connect !== false) {
|
||||
$config_history_array = mysql_db_process_sql(
|
||||
'SELECT * FROM tconfig',
|
||||
'affected_rows',
|
||||
$config['history_db_connection'],
|
||||
false
|
||||
);
|
||||
|
||||
if (isset($config_history_array) && is_array($config_history_array)) {
|
||||
foreach ($config_history_array as $key => $value) {
|
||||
$config_history[$value['token']] = $value['value'];
|
||||
$config_history = true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
echo ui_print_error_message(
|
||||
__('The tconfig table does not exist in the historical database')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ($config_history === false) {
|
||||
$config_history = [];
|
||||
$config_history['days_purge'] = 180;
|
||||
$config_history['days_compact'] = 120;
|
||||
$config_history['step_compact'] = 1;
|
||||
$config_history['event_purge'] = 180;
|
||||
$config_history['string_purge'] = 180;
|
||||
}
|
||||
$config_history['days_purge'] = Config::get('days_purge', 180, true);
|
||||
$config_history['days_compact'] = Config::get('days_compact', 120, true);
|
||||
$config_history['step_compact'] = Config::get('step_compact', 1, true);
|
||||
$config_history['event_purge'] = Config::get('event_purge', 180, true);
|
||||
$config_history['string_purge'] = Config::get('string_purge', 180, true);
|
||||
|
||||
$table_historical = new StdClass();
|
||||
$table_historical->width = '100%';
|
||||
|
@ -337,6 +337,18 @@ if (isset($config['error_config_update_config'])) {
|
||||
ui_print_success_message(__('Correct update the setup options'));
|
||||
}
|
||||
|
||||
if (is_array($config['error_config_update_config']['errors']) === true) {
|
||||
foreach ($config['error_config_update_config']['errors'] as $msg) {
|
||||
ui_print_error_message($msg);
|
||||
}
|
||||
}
|
||||
|
||||
if (is_array($config['error_config_update_config']['warnings']) === true) {
|
||||
foreach ($config['error_config_update_config']['warnings'] as $msg) {
|
||||
ui_print_warning_message($msg);
|
||||
}
|
||||
}
|
||||
|
||||
unset($config['error_config_update_config']);
|
||||
}
|
||||
|
||||
|
@ -88,6 +88,11 @@ if (is_ajax()) {
|
||||
$file_dest = $config['homedir']."/extras/mr/updated/$number.sql";
|
||||
|
||||
copy($file, $file_dest);
|
||||
|
||||
// After successfully update, schedule history
|
||||
// database upgrade.
|
||||
enterprise_include_once('include/functions_config.php');
|
||||
enterprise_hook('history_db_install');
|
||||
}
|
||||
} else {
|
||||
$error_file = fopen($config['homedir'].'/extras/mr/error.txt', 'w');
|
||||
|
@ -148,7 +148,8 @@ class ConsoleSupervisor
|
||||
*/
|
||||
public function runBasic()
|
||||
{
|
||||
global $config;
|
||||
// Ensure functions are installed and up to date.
|
||||
enterprise_hook('cron_extension_install_functions');
|
||||
|
||||
/*
|
||||
* PHP configuration warnings:
|
||||
|
@ -236,6 +236,7 @@ class HelpFeedBack extends Wizard
|
||||
*/
|
||||
public function sendMailMethod()
|
||||
{
|
||||
global $config;
|
||||
$suggestion = get_parameter('type', 'false');
|
||||
$feedback_text = get_parameter('feedback_text', null);
|
||||
$feedback_mail = get_parameter('feedback_email', null);
|
||||
|
@ -97,7 +97,7 @@ require_once $ownDir.'functions.php';
|
||||
// We need a timezone BEFORE calling config_process_config.
|
||||
// If not we will get ugly warnings. Set Europe/Madrid by default
|
||||
// Later will be replaced by the good one.
|
||||
if (!is_dir($_SERVER['DOCUMENT_ROOT'].$config['homeurl']) || !is_dir($_SERVER['DOCUMENT_ROOT'].$config['homeurl_static'])) {
|
||||
if (!is_dir($config['homedir'])) {
|
||||
$url = explode('/', $_SERVER['REQUEST_URI']);
|
||||
$flag_url = 0;
|
||||
foreach ($url as $key => $value) {
|
||||
|
@ -1496,6 +1496,7 @@ function db_run_sql_file($location)
|
||||
// Undo results
|
||||
}
|
||||
|
||||
$config['db_run_sql_file_error'] = $mysqli->error;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,12 @@
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Config functions.
|
||||
// Config functions.
|
||||
require_once __DIR__.'/../vendor/autoload.php';
|
||||
require_once __DIR__.'/functions.php';
|
||||
enterprise_include_once('include/functions_config.php');
|
||||
use PandoraFMS\Core\DBMaintainer;
|
||||
use PandoraFMS\Core\Config;
|
||||
|
||||
|
||||
/**
|
||||
@ -147,6 +152,8 @@ function config_update_config()
|
||||
}
|
||||
|
||||
$error_update = [];
|
||||
$errors = [];
|
||||
$warnings = [];
|
||||
|
||||
$sec2 = get_parameter('sec2');
|
||||
|
||||
@ -1452,6 +1459,31 @@ function config_update_config()
|
||||
break;
|
||||
|
||||
case 'hist_db':
|
||||
if ($config['dbname'] == get_parameter('history_db_name')
|
||||
&& $config['dbport'] == get_parameter('history_db_port')
|
||||
&& $config['dbhost'] == io_input_password(get_parameter('history_db_host'))
|
||||
) {
|
||||
// Same definition for active and historical database!
|
||||
// This is a critical error.
|
||||
$config['error_config_update_config']['correct'] = false;
|
||||
$config['error_config_update_config']['message'] = __(
|
||||
'Active and historical database cannot be the same.'
|
||||
);
|
||||
return;
|
||||
} else {
|
||||
if (!config_update_value('history_db_host', get_parameter('history_db_host'))) {
|
||||
$error_update[] = __('Host');
|
||||
}
|
||||
|
||||
if (!config_update_value('history_db_port', get_parameter('history_db_port'))) {
|
||||
$error_update[] = __('Port');
|
||||
}
|
||||
|
||||
if (!config_update_value('history_db_name', get_parameter('history_db_name'))) {
|
||||
$error_update[] = __('Database name');
|
||||
}
|
||||
}
|
||||
|
||||
if (!config_update_value('history_db_enabled', get_parameter('history_db_enabled'))) {
|
||||
$error_update[] = __('Enable history database');
|
||||
}
|
||||
@ -1460,18 +1492,6 @@ function config_update_config()
|
||||
$error_update[] = __('Enable history event');
|
||||
}
|
||||
|
||||
if (!config_update_value('history_db_host', get_parameter('history_db_host'))) {
|
||||
$error_update[] = __('Host');
|
||||
}
|
||||
|
||||
if (!config_update_value('history_db_port', get_parameter('history_db_port'))) {
|
||||
$error_update[] = __('Port');
|
||||
}
|
||||
|
||||
if (!config_update_value('history_db_name', get_parameter('history_db_name'))) {
|
||||
$error_update[] = __('Database name');
|
||||
}
|
||||
|
||||
if (!config_update_value('history_db_user', get_parameter('history_db_user'))) {
|
||||
$error_update[] = __('Database user');
|
||||
}
|
||||
@ -1511,6 +1531,68 @@ function config_update_config()
|
||||
) {
|
||||
$error_update[] = __('Delay');
|
||||
}
|
||||
|
||||
if ((bool) $config['history_db_enabled'] === true) {
|
||||
$dbm = new DBMaintainer(
|
||||
[
|
||||
'host' => $config['history_db_host'],
|
||||
'port' => $config['history_db_port'],
|
||||
'name' => $config['history_db_name'],
|
||||
'user' => $config['history_db_user'],
|
||||
'pass' => $config['history_db_pass'],
|
||||
]
|
||||
);
|
||||
|
||||
// Performs several checks and installs if needed.
|
||||
if ($dbm->checkDatabaseDefinition() === true
|
||||
&& $dbm->isInstalled() === false
|
||||
) {
|
||||
// Target is ready but several tasks are pending.
|
||||
$dbm->process();
|
||||
} else if ($dbm->check() !== true) {
|
||||
$errors[] = $dbm->getLastError();
|
||||
}
|
||||
}
|
||||
|
||||
// Historical configuration tokens (stored in historical db).
|
||||
if (Config::set(
|
||||
'days_purge',
|
||||
get_parameter('history_dbh_purge'),
|
||||
true
|
||||
) !== true
|
||||
) {
|
||||
$error_update[] = __('Historical database purge');
|
||||
}
|
||||
|
||||
if (Config::set(
|
||||
'history_partitions_auto',
|
||||
get_parameter_switch('history_partitions_auto', 0),
|
||||
true
|
||||
) !== true
|
||||
) {
|
||||
$error_update[] = __('Historical database partitions');
|
||||
}
|
||||
|
||||
if (Config::set(
|
||||
'event_purge',
|
||||
get_parameter('history_dbh_events_purge'),
|
||||
true
|
||||
) !== true
|
||||
) {
|
||||
$error_update[] = __('Historical database events purge');
|
||||
}
|
||||
|
||||
if (Config::set(
|
||||
'string_purge',
|
||||
get_parameter('history_dbh_string_purge'),
|
||||
true
|
||||
) !== true
|
||||
) {
|
||||
$error_update[] = __('Historical database string purge');
|
||||
}
|
||||
|
||||
// Disable history db in history db.
|
||||
Config::set('history_db_enabled', 0, true);
|
||||
break;
|
||||
|
||||
case 'ehorus':
|
||||
@ -1685,6 +1767,14 @@ function config_update_config()
|
||||
$config['error_config_update_config']['correct'] = true;
|
||||
}
|
||||
|
||||
if (count($errors) > 0) {
|
||||
$config['error_config_update_config']['errors'] = $errors;
|
||||
}
|
||||
|
||||
if (count($warnings) > 0) {
|
||||
$config['error_config_update_config']['warnings'] = $warnings;
|
||||
}
|
||||
|
||||
enterprise_include_once('include/functions_policies.php');
|
||||
$enterprise = enterprise_include_once('include/functions_skins.php');
|
||||
if ($enterprise !== ENTERPRISE_NOT_HOOK) {
|
||||
|
@ -3770,6 +3770,7 @@ function ui_print_event_priority(
|
||||
* @param string $attributes_switch Switch attributes.
|
||||
* @param string $toggl_attr Main box extra attributes.
|
||||
* @param boolean|null $switch_on Switch enabled disabled or depending on hidden_Default.
|
||||
* @param string|null $switch_name Use custom switch input name or generate one.
|
||||
*
|
||||
* @return string HTML.
|
||||
*/
|
||||
@ -3790,7 +3791,8 @@ function ui_toggle(
|
||||
$switch=false,
|
||||
$attributes_switch='',
|
||||
$toggl_attr='',
|
||||
$switch_on=null
|
||||
$switch_on=null,
|
||||
$switch_name=null
|
||||
) {
|
||||
// Generate unique Id.
|
||||
$uniqid = uniqid('');
|
||||
@ -3826,7 +3828,7 @@ function ui_toggle(
|
||||
$main_class = '';
|
||||
}
|
||||
|
||||
if (empty($container_class) === true) {
|
||||
if ($container_class == 'white-box-content') {
|
||||
$container_class = 'white-box-content-clean';
|
||||
}
|
||||
}
|
||||
@ -3836,11 +3838,15 @@ function ui_toggle(
|
||||
$output .= '<div class="'.$header_class.'" style="cursor: pointer;" id="tgl_ctrl_'.$uniqid.'">';
|
||||
if ($reverseImg === false) {
|
||||
if ($switch === true) {
|
||||
if (empty($switch_name) === true) {
|
||||
$switch_name = 'box_enable_toggle'.$uniqid;
|
||||
}
|
||||
|
||||
$output .= html_print_div(
|
||||
[
|
||||
'class' => 'float-left',
|
||||
'content' => html_print_checkbox_switch_extended(
|
||||
'box_enable_toggle'.$uniqid,
|
||||
$switch_name,
|
||||
1,
|
||||
($switch_on === null) ? (($hidden_default === true) ? 0 : 1) : $switch_on,
|
||||
false,
|
||||
@ -3910,7 +3916,7 @@ function ui_toggle(
|
||||
$output .= ' var hide_tgl_ctrl_'.$uniqid.' = '.(int) $hidden_default.";\n";
|
||||
$output .= ' /* <![CDATA[ */'."\n";
|
||||
$output .= " $(document).ready (function () {\n";
|
||||
$output .= " $('#checkbox-box_enable_toggle".$uniqid."').click(function() {\n";
|
||||
$output .= " $('#checkbox-".$switch_name."').click(function() {\n";
|
||||
$output .= ' if (hide_tgl_ctrl_'.$uniqid.") {\n";
|
||||
$output .= ' hide_tgl_ctrl_'.$uniqid." = 0;\n";
|
||||
$output .= " $('#tgl_div_".$uniqid."').toggle();\n";
|
||||
@ -3925,13 +3931,13 @@ function ui_toggle(
|
||||
$output .= ' hide_tgl_ctrl_'.$uniqid." = 0;\n";
|
||||
$output .= " $('#tgl_div_".$uniqid."').toggle();\n";
|
||||
$output .= " $('#image_".$uniqid."').attr({src: '".$image_a."'});\n";
|
||||
$output .= " $('#checkbox-box_enable_toggle".$uniqid."').prop('checked', true);\n";
|
||||
$output .= " $('#checkbox-".$switch_name."').prop('checked', true);\n";
|
||||
$output .= " }\n";
|
||||
$output .= " else {\n";
|
||||
$output .= ' hide_tgl_ctrl_'.$uniqid." = 1;\n";
|
||||
$output .= " $('#tgl_div_".$uniqid."').toggle();\n";
|
||||
$output .= " $('#image_".$uniqid."').attr({src: '".$image_b."'});\n";
|
||||
$output .= " $('#checkbox-box_enable_toggle".$uniqid."').prop('checked', false);\n";
|
||||
$output .= " $('#checkbox-".$switch_name."').prop('checked', false);\n";
|
||||
$output .= " }\n";
|
||||
$output .= " });\n";
|
||||
$output .= " });\n";
|
||||
@ -3951,23 +3957,24 @@ function ui_toggle(
|
||||
* Simplified way of ui_toggle ussage.
|
||||
*
|
||||
* @param array $data Arguments:
|
||||
* 'content'
|
||||
* 'name'
|
||||
* 'title'
|
||||
* 'id'
|
||||
* 'hidden_default'
|
||||
* 'return'
|
||||
* 'toggle_class'
|
||||
* 'container_class'
|
||||
* 'main_class'
|
||||
* 'img_a'
|
||||
* 'img_b'
|
||||
* 'clean'
|
||||
* 'reverseImg'
|
||||
* 'switch'
|
||||
* 'attributes_switch'
|
||||
* 'toggl_attr'
|
||||
* 'switch_on'.
|
||||
* - content
|
||||
* - name
|
||||
* - title
|
||||
* - id
|
||||
* - hidden_default
|
||||
* - return
|
||||
* - toggle_class
|
||||
* - container_class
|
||||
* - main_class
|
||||
* - img_a
|
||||
* - img_b
|
||||
* - clean
|
||||
* - reverseImg
|
||||
* - switch
|
||||
* - attributes_switch
|
||||
* - toggl_attr
|
||||
* - switch_on
|
||||
* - switch_name.
|
||||
*
|
||||
* @return string HTML code with toggle content.
|
||||
*/
|
||||
@ -3990,7 +3997,8 @@ function ui_print_toggle($data)
|
||||
(isset($data['switch']) === true) ? $data['switch'] : false,
|
||||
(isset($data['attributes_switch']) === true) ? $data['attributes_switch'] : '',
|
||||
(isset($data['toggl_attr']) === true) ? $data['toggl_attr'] : '',
|
||||
(isset($data['switch_on']) === true) ? $data['switch_on'] : null
|
||||
(isset($data['switch_on']) === true) ? $data['switch_on'] : null,
|
||||
(isset($data['switch_name']) === true) ? $data['switch_name'] : null
|
||||
);
|
||||
}
|
||||
|
||||
@ -5705,6 +5713,12 @@ function ui_print_module_string_value(
|
||||
$value = io_safe_input($value);
|
||||
}
|
||||
|
||||
$is_snapshot = is_snapshot_data($module['datos']);
|
||||
$is_large_image = is_text_to_black_string($module['datos']);
|
||||
if (($config['command_snapshot']) && ($is_snapshot || $is_large_image)) {
|
||||
$row[7] = ui_get_snapshot_image($link, $is_snapshot).' ';
|
||||
}
|
||||
|
||||
$is_snapshot = is_snapshot_data($value);
|
||||
$is_large_image = is_text_to_black_string($value);
|
||||
if (($config['command_snapshot']) && ($is_snapshot || $is_large_image)) {
|
||||
|
188
pandora_console/include/lib/Core/Config.php
Normal file
188
pandora_console/include/lib/Core/Config.php
Normal file
@ -0,0 +1,188 @@
|
||||
<?php
|
||||
/**
|
||||
* Config class.
|
||||
*
|
||||
* @category Class
|
||||
* @package Pandora FMS
|
||||
* @subpackage OpenSource
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for version 2.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Begin.
|
||||
namespace PandoraFMS\Core;
|
||||
|
||||
require_once __DIR__.'/../../config.php';
|
||||
require_once __DIR__.'/../../functions_config.php';
|
||||
|
||||
/**
|
||||
* Config class to operate console configuration.
|
||||
*/
|
||||
final class Config
|
||||
{
|
||||
|
||||
/**
|
||||
* History database settings (tconfig).
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private static $settings = [];
|
||||
|
||||
|
||||
/**
|
||||
* Load history database settings.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private static function loadHistoryDBSettings()
|
||||
{
|
||||
global $config;
|
||||
|
||||
if ((bool) $config['history_db_enabled'] === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Connect if needed.
|
||||
if (isset($config['history_db_connection']) === false
|
||||
|| $config['history_db_connection'] === false
|
||||
) {
|
||||
ob_start();
|
||||
$config['history_db_connection'] = db_connect(
|
||||
$config['history_db_host'],
|
||||
$config['history_db_name'],
|
||||
$config['history_db_user'],
|
||||
io_output_password($config['history_db_pass']),
|
||||
$config['history_db_port'],
|
||||
false
|
||||
);
|
||||
|
||||
ob_get_clean();
|
||||
}
|
||||
|
||||
if ($config['history_db_connection'] !== false) {
|
||||
$data = \db_get_all_rows_sql(
|
||||
'SELECT * FROM `tconfig`',
|
||||
false,
|
||||
false,
|
||||
$config['history_db_connection']
|
||||
);
|
||||
}
|
||||
|
||||
if (is_array($data) !== true) {
|
||||
return [];
|
||||
}
|
||||
|
||||
self::$settings = array_reduce(
|
||||
$data,
|
||||
function ($carry, $item) {
|
||||
$carry[$item['token']] = $item['value'];
|
||||
return $carry;
|
||||
},
|
||||
[]
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieve configuration token.
|
||||
*
|
||||
* @param string $token Token to retrieve.
|
||||
* @param mixed $default Default value if not found.
|
||||
* @param boolean $history_db Search for token in history_db.
|
||||
*
|
||||
* @return mixed Configuration token.
|
||||
*/
|
||||
public static function get(
|
||||
string $token,
|
||||
$default=null,
|
||||
bool $history_db=false
|
||||
) {
|
||||
if ($history_db === true) {
|
||||
self::loadHistoryDBSettings();
|
||||
|
||||
if (isset(self::$settings[$token]) === true) {
|
||||
return self::$settings[$token];
|
||||
}
|
||||
|
||||
return $default;
|
||||
} else {
|
||||
global $config;
|
||||
|
||||
if (isset($config[$token]) === true) {
|
||||
return $config[$token];
|
||||
}
|
||||
}
|
||||
|
||||
return $default;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set configuration token.
|
||||
*
|
||||
* @param string $token Token to set.
|
||||
* @param mixed $value Value to be.
|
||||
* @param boolean $history_db Save to history_db settings.
|
||||
*
|
||||
* @return boolean Success or not.
|
||||
*/
|
||||
public static function set(string $token, $value, bool $history_db=false)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$rs = false;
|
||||
|
||||
if ($history_db !== false) {
|
||||
if (self::get($token, null, $history_db) === null) {
|
||||
// Create.
|
||||
$rs = \db_process_sql(
|
||||
sprintf(
|
||||
'INSERT INTO `tconfig` (`token`, `value`)
|
||||
VALUES ("%s", "%s")',
|
||||
$token,
|
||||
$value
|
||||
),
|
||||
'affected_rows',
|
||||
$config['history_db_connection']
|
||||
);
|
||||
} else {
|
||||
// Update.
|
||||
$rs = \db_process_sql(
|
||||
sprintf(
|
||||
'UPDATE `tconfig`
|
||||
SET `value`= "%s"
|
||||
WHERE `token` = "%s"',
|
||||
$value,
|
||||
$token
|
||||
),
|
||||
'affected_rows',
|
||||
$config['history_db_connection']
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$rs = \config_update_value($token, $value);
|
||||
}
|
||||
|
||||
return ($rs !== false);
|
||||
}
|
||||
|
||||
|
||||
}
|
765
pandora_console/include/lib/Core/DBMaintainer.php
Normal file
765
pandora_console/include/lib/Core/DBMaintainer.php
Normal file
@ -0,0 +1,765 @@
|
||||
<?php
|
||||
/**
|
||||
* Database mantainer class.
|
||||
*
|
||||
* @category Class
|
||||
* @package Pandora FMS
|
||||
* @subpackage OpenSource
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for version 2.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Begin.
|
||||
namespace PandoraFMS\Core;
|
||||
|
||||
/**
|
||||
* Class to handle database mantainer (not queries).
|
||||
*/
|
||||
final class DBMaintainer
|
||||
{
|
||||
const ESSENTIAL_TABLES = [
|
||||
'tagente_datos',
|
||||
'tagente_datos_string',
|
||||
'tevento',
|
||||
'tconfig',
|
||||
];
|
||||
|
||||
/**
|
||||
* Database user.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $user;
|
||||
|
||||
/**
|
||||
* Database pass.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $pass;
|
||||
|
||||
/**
|
||||
* Database port.
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
private $port;
|
||||
|
||||
/**
|
||||
* Database name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* Database host.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $host;
|
||||
|
||||
/**
|
||||
* Charset forced.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $charset;
|
||||
|
||||
/**
|
||||
* Verifies if PandoraFMS DB schema is installed.
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $installed;
|
||||
|
||||
/**
|
||||
* Verifies if endpoint is connected.
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $connected;
|
||||
|
||||
/**
|
||||
* Connection link.
|
||||
*
|
||||
* @var mixed|null
|
||||
*/
|
||||
private $dbh;
|
||||
|
||||
/**
|
||||
* Last error registered.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $lastError;
|
||||
|
||||
/**
|
||||
* Connected to engine and database.
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $ready;
|
||||
|
||||
|
||||
/**
|
||||
* Initialize DBMaintainer object.
|
||||
*
|
||||
* @param array $params Database connection definition, including:
|
||||
* - user
|
||||
* - pass
|
||||
* - database name
|
||||
* - host (default 127.0.0.1)
|
||||
* - port (default 3306)
|
||||
* If not defined some fields will use default values.
|
||||
*/
|
||||
public function __construct(array $params)
|
||||
{
|
||||
$this->user = $params['user'];
|
||||
$this->pass = $params['pass'];
|
||||
$this->host = $params['host'];
|
||||
$this->port = $params['port'];
|
||||
$this->name = $params['name'];
|
||||
$this->charset = $params['charset'];
|
||||
|
||||
// Try to connect.
|
||||
$this->connect();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Connects (if not connected) to current definition.
|
||||
*
|
||||
* @return boolean True if successfully connected, false if not.
|
||||
*/
|
||||
private function connect()
|
||||
{
|
||||
if ($this->connected === true) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$dbc = new \mysqli(
|
||||
$this->host,
|
||||
$this->user,
|
||||
$this->pass,
|
||||
null,
|
||||
$this->port
|
||||
);
|
||||
|
||||
if ((bool) $dbc->connect_error === true) {
|
||||
$this->dbh = null;
|
||||
$this->connected = false;
|
||||
$this->lastError = $dbc->connect_errno.': '.$dbc->connect_error;
|
||||
} else {
|
||||
$this->dbh = $dbc;
|
||||
if (empty($this->charset) === false) {
|
||||
$dbc->set_charset($this->charset);
|
||||
}
|
||||
|
||||
if ($this->dbh->select_db($this->name) === false) {
|
||||
$this->lastError = $this->dbh->errno.': '.$this->dbh->error;
|
||||
$this->ready = false;
|
||||
} else {
|
||||
$this->lastError = null;
|
||||
$this->ready = true;
|
||||
}
|
||||
|
||||
$this->connected = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return connection statuis.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isConnected()
|
||||
{
|
||||
return $this->connected;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieve last error.
|
||||
*
|
||||
* @return string Error message.
|
||||
*/
|
||||
public function getLastError()
|
||||
{
|
||||
if ($this->lastError !== null) {
|
||||
return $this->lastError;
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieve all rows from given query in array format.
|
||||
*
|
||||
* @param string $query Query.
|
||||
*
|
||||
* @return array Results.
|
||||
*/
|
||||
private function getAllRows(string $query)
|
||||
{
|
||||
if ($this->ready !== true) {
|
||||
$this->lastError = $this->dbh->errno.': '.$this->dbh->error;
|
||||
return [];
|
||||
}
|
||||
|
||||
$rs = $this->dbh->query($query);
|
||||
|
||||
$results = [];
|
||||
|
||||
if ($rs !== false) {
|
||||
do {
|
||||
$row = $rs->fetch_array(MYSQLI_ASSOC);
|
||||
if ((bool) $row !== false) {
|
||||
$results[] = $row;
|
||||
}
|
||||
} while ((bool) $row !== false);
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return first row available for given query.
|
||||
*
|
||||
* @param string $query Query to retrieve (1 row only).
|
||||
*
|
||||
* @return array Row.
|
||||
*/
|
||||
private function getRow(string $query)
|
||||
{
|
||||
if ($this->ready !== true) {
|
||||
$this->lastError = $this->dbh->errno.': '.$this->dbh->error;
|
||||
return [];
|
||||
}
|
||||
|
||||
$query .= ' LIMIT 1';
|
||||
$rs = $this->dbh->query($query);
|
||||
if ($rs !== false) {
|
||||
return $rs->fetch_array(MYSQLI_ASSOC);
|
||||
}
|
||||
|
||||
// Error.
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieve value from given query.
|
||||
*
|
||||
* @param string $table Table to query.
|
||||
* @param string $key Field to retrieve.
|
||||
* @param array $filter Filters to apply.
|
||||
* @param string $join AND by default.
|
||||
*
|
||||
* @return mixed|null Value retrieved or null if not found.
|
||||
*/
|
||||
private function getValue(
|
||||
string $table,
|
||||
string $key,
|
||||
array $filter,
|
||||
string $join='AND'
|
||||
) {
|
||||
$query = sprintf(
|
||||
'SELECT %s FROM %s WHERE %s',
|
||||
$key,
|
||||
$table,
|
||||
\db_format_array_where_clause_sql($filter, $join)
|
||||
);
|
||||
$result = $this->getRow($query);
|
||||
if ($result !== false) {
|
||||
return $result[$key];
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Verifies schema against running db.
|
||||
*
|
||||
* @return boolean Success or not.
|
||||
*/
|
||||
public function verifySchema()
|
||||
{
|
||||
if ($this->ready !== true) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$missing_essential_tables = $this->verifyTables();
|
||||
|
||||
return !(bool) count($missing_essential_tables);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Verifies tables against running db.
|
||||
*
|
||||
* @return boolean Applied or not.
|
||||
*/
|
||||
public function verifyTables()
|
||||
{
|
||||
global $config;
|
||||
|
||||
$t = \db_get_all_rows_sql(
|
||||
sprintf(
|
||||
'SHOW TABLES FROM %s',
|
||||
$config['dbname']
|
||||
)
|
||||
);
|
||||
|
||||
$tables = [];
|
||||
foreach ($t as $v) {
|
||||
$tables[] = array_shift($v);
|
||||
}
|
||||
|
||||
$t = $this->getAllRows(
|
||||
sprintf(
|
||||
'SHOW TABLES FROM %s',
|
||||
$this->name
|
||||
)
|
||||
);
|
||||
$myTables = [];
|
||||
foreach ($t as $k => $v) {
|
||||
$myTables[] = array_shift($v);
|
||||
}
|
||||
|
||||
$differences = array_diff($tables, $myTables);
|
||||
|
||||
if (count($differences) > 0) {
|
||||
$this->lastError = sprintf(
|
||||
'Warning, following tables does not exist in target: %s',
|
||||
join(', ', $differences)
|
||||
);
|
||||
}
|
||||
|
||||
// Exclude extension tables.
|
||||
$differences = array_intersect($differences, self::ESSENTIAL_TABLES);
|
||||
|
||||
return $differences;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Updates or creates a token in remote tconfig.
|
||||
*
|
||||
* @param string $token Token to be set.
|
||||
* @param mixed $value Value for given token.
|
||||
*
|
||||
* @return boolean Success or not.
|
||||
*/
|
||||
private function setConfigToken(string $token, $value)
|
||||
{
|
||||
$prev = $this->getValue('tconfig', 'value', ['token' => $token]);
|
||||
// If failed or not found, then insert.
|
||||
if ($prev === false || $prev === null) {
|
||||
// Create.
|
||||
$rs = $this->dbh->query(
|
||||
sprintf(
|
||||
'INSERT INTO `tconfig` (`token`, `value`)
|
||||
VALUES ("%s", "%s")',
|
||||
$token,
|
||||
$value
|
||||
)
|
||||
);
|
||||
} else {
|
||||
// Update.
|
||||
$rs = $this->dbh->query(
|
||||
sprintf(
|
||||
'UPDATE `tconfig`
|
||||
SET `value`= "%s"
|
||||
WHERE `token` = "%s"',
|
||||
$value,
|
||||
$token
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return ($rs !== false);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create database only (not schema) in target.
|
||||
*
|
||||
* @return boolean Success or not.
|
||||
*/
|
||||
public function checkDatabaseDefinition()
|
||||
{
|
||||
if ($this->ready === true) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($this->dbh === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$rc = $this->dbh->query(
|
||||
sprintf(
|
||||
'CREATE DATABASE %s',
|
||||
$this->name
|
||||
)
|
||||
);
|
||||
|
||||
if ($rc === false) {
|
||||
$this->lastError = $this->dbh->errno.': '.$this->dbh->error;
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->dbh->select_db($this->name) === false) {
|
||||
$this->lastError = $this->dbh->errno.': '.$this->dbh->error;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Already connected and ready to execute commands.
|
||||
$this->ready = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Install PandoraFMS database schema in current target.
|
||||
*
|
||||
* @param boolean $check_only Check and return, do not perform actions.
|
||||
*
|
||||
* @return boolean Installation is success or not.
|
||||
*/
|
||||
public function install(bool $check_only=false)
|
||||
{
|
||||
if ($this->connect() !== true) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->installed === true) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($this->ready !== true) {
|
||||
// Not ready, create database in target.
|
||||
if ($check_only === true) {
|
||||
$this->lastError = 'Database does not exist in target';
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->checkDatabaseDefinition() === false) {
|
||||
return false;
|
||||
}
|
||||
} else if ($this->verifySchema() === true) {
|
||||
$this->installed = true;
|
||||
$this->lastError = null;
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($check_only === true) {
|
||||
$this->lastError = 'Schema not applied in target';
|
||||
return false;
|
||||
}
|
||||
|
||||
$result = $this->applyDump(Config::get('homedir', '').'/pandoradb.sql');
|
||||
|
||||
// Set MR version according pandoradb_data.
|
||||
$data_content = file_get_contents(
|
||||
Config::get('homedir', '').'/pandoradb_data.sql'
|
||||
);
|
||||
if (preg_match('/\(\'MR\'\,\s*(\d+)\)/', $data_content, $matches) > 0) {
|
||||
$target_mr = $matches[1];
|
||||
}
|
||||
|
||||
$cnf_update = $this->setConfigToken('MR', (int) $target_mr);
|
||||
|
||||
return $result && $cnf_update;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Updates PandoraFMS database schema in current target.
|
||||
*
|
||||
* @param boolean $check_only Perform only test without update.
|
||||
*
|
||||
* @return boolean Current installation is up to date.
|
||||
*/
|
||||
public function update(bool $check_only=false)
|
||||
{
|
||||
if ($this->connect() !== true) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->install($check_only) !== true) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Set MR version according pandoradb_data.
|
||||
$data_content = file_get_contents(
|
||||
Config::get('homedir', '').'/pandoradb_data.sql'
|
||||
);
|
||||
if (preg_match('/\(\'MR\'\,\s*(\d+)\)/', $data_content, $matches) > 0) {
|
||||
$target_mr = $matches[1];
|
||||
}
|
||||
|
||||
// Active database MR version.
|
||||
$active_mr = (int) Config::get('MR', 0);
|
||||
|
||||
// Historical database MR version.
|
||||
$last_mr_curr = (int) $this->getValue(
|
||||
'tconfig',
|
||||
'value',
|
||||
['token' => 'MR']
|
||||
);
|
||||
|
||||
if ($check_only === true) {
|
||||
if ($active_mr === $last_mr_curr) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$this->lastError = sprintf(
|
||||
'Database schema not up to date: #%d should be #%d',
|
||||
$last_mr_curr,
|
||||
$active_mr
|
||||
);
|
||||
if ($active_mr < $target_mr) {
|
||||
$this->lastError .= sprintf(
|
||||
' (latest available: #%d)',
|
||||
$target_mr
|
||||
);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($last_mr_curr < $active_mr) {
|
||||
while ($last_mr_curr < $active_mr) {
|
||||
$last_mr_curr++;
|
||||
|
||||
$path = Config::get('homedir', '');
|
||||
$file = sprintf('/extras/mr/%d.sql', $last_mr_curr);
|
||||
$updated_file = sprintf(
|
||||
'/extras/mr/updated/%d.sql',
|
||||
$last_mr_curr
|
||||
);
|
||||
|
||||
$filename = $path.$file;
|
||||
if (file_exists($path.$file) !== true) {
|
||||
// File does not exist, maybe already udpated in active DB?
|
||||
$filename = $path.$updated_file;
|
||||
if (file_exists($filename) !== false) {
|
||||
$this->lastError = 'Unable to locate MR update #';
|
||||
$this->lastError .= $last_mr_curr;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->applyDump($filename, true) !== true) {
|
||||
$err = 'Unable to apply MR update #';
|
||||
$err .= $last_mr_curr.': ';
|
||||
$this->lastError = $err.$this->lastError;
|
||||
return false;
|
||||
} else {
|
||||
// Update MR value.
|
||||
$this->setConfigToken('MR', $last_mr_curr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($last_mr_curr !== $active_mr) {
|
||||
$this->lastError = 'Unknown database schema version, check MR in both active and historical database';
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Process database checks perform required actions.
|
||||
* Returns true if it is connected, installed and updated.
|
||||
*
|
||||
* @return boolean Status of the installation.
|
||||
*/
|
||||
public function process()
|
||||
{
|
||||
if ($this->connect() !== true) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->install() !== true) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->update() !== true) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if target has schema updated.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isUpdated()
|
||||
{
|
||||
return $this->update(true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if target has schema installed.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isInstalled()
|
||||
{
|
||||
return $this->install(true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks if target is ready to connect.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isReady()
|
||||
{
|
||||
if ($this->ready === true) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$this->connect();
|
||||
|
||||
return $this->ready;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks if current target is connected, installed and updated.
|
||||
*
|
||||
* @return boolean Status of the database schema.
|
||||
*/
|
||||
public function check()
|
||||
{
|
||||
if ($this->connect() !== true) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->isInstalled() !== true) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->isUpdated() !== true) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This function keeps same functionality as install.php:parse_mysqli_dump.
|
||||
*
|
||||
* @param string $path Path where SQL dump file is stored.
|
||||
* @param boolean $transactional Use transactions from file (true) (MRs).
|
||||
*
|
||||
* @return boolean Success or not.
|
||||
*/
|
||||
private function applyDump(string $path, bool $transactional=false)
|
||||
{
|
||||
if (file_exists($path) === true) {
|
||||
if ($transactional === true) {
|
||||
global $config;
|
||||
|
||||
// Adapt to PandoraFMS classic way to do things...
|
||||
$backup_dbhost = $config['dbhost'];
|
||||
$backup_dbuser = $config['dbuser'];
|
||||
$backup_dbpass = $config['dbpass'];
|
||||
$backup_dbname = $config['dbname'];
|
||||
$backup_dbport = $config['dbport'];
|
||||
$backup_mysqli = $config['mysqli'];
|
||||
|
||||
$config['dbhost'] = $this->host;
|
||||
$config['dbuser'] = $this->user;
|
||||
$config['dbpass'] = $this->pass;
|
||||
$config['dbname'] = $this->name;
|
||||
$config['dbport'] = $this->port;
|
||||
|
||||
// Not using mysqli in > php 7 is a completely non-sense.
|
||||
$config['mysqli'] = true;
|
||||
|
||||
// MR are loaded in transactions.
|
||||
include_once $config['homedir'].'/include/db/mysql.php';
|
||||
$return = db_run_sql_file($path);
|
||||
if ($return === false) {
|
||||
$this->lastError = $config['db_run_sql_file_error'];
|
||||
}
|
||||
|
||||
// Revert global variable.
|
||||
$config['dbhost'] = $backup_dbhost;
|
||||
$config['dbuser'] = $backup_dbuser;
|
||||
$config['dbpass'] = $backup_dbpass;
|
||||
$config['dbname'] = $backup_dbname;
|
||||
$config['dbport'] = $backup_dbport;
|
||||
$config['mysqli'] = $backup_mysqli;
|
||||
|
||||
return (bool) $return;
|
||||
} else {
|
||||
$file_content = file($path);
|
||||
$query = '';
|
||||
foreach ($file_content as $sql_line) {
|
||||
if (trim($sql_line) !== ''
|
||||
&& strpos($sql_line, '-- ') === false
|
||||
) {
|
||||
$query .= $sql_line;
|
||||
if ((bool) preg_match("/;[\040]*\$/", $sql_line) === true) {
|
||||
$result = $this->dbh->query($query);
|
||||
if ((bool) $result === false) {
|
||||
$this->lastError = $this->dbh->errno.': ';
|
||||
$this->lastError .= $this->dbh->error;
|
||||
return false;
|
||||
}
|
||||
|
||||
$query = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// File does not exist.
|
||||
$this->lastError = sprintf(
|
||||
'File %s does not exist',
|
||||
$path
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -40,14 +40,12 @@
|
||||
*/
|
||||
|
||||
// Begin.
|
||||
namespace PandoraFMS\WebSockets;
|
||||
namespace PandoraFMS\Websockets;
|
||||
|
||||
use \PandoraFMS\Websockets\WebSocketServer;
|
||||
use \PandoraFMS\Websockets\WebSocketUser;
|
||||
use \PandoraFMS\User;
|
||||
|
||||
|
||||
require_once __DIR__.'/../functions.php';
|
||||
require_once __DIR__.'/../../functions.php';
|
||||
|
||||
/**
|
||||
* Redirects ws communication between two endpoints.
|
||||
@ -212,7 +210,7 @@ class WSManager extends WebSocketServer
|
||||
*/
|
||||
public function readSocket($user)
|
||||
{
|
||||
$buffer;
|
||||
$buffer = '';
|
||||
|
||||
$numBytes = socket_recv(
|
||||
$user->socket,
|
||||
@ -271,7 +269,7 @@ class WSManager extends WebSocketServer
|
||||
{
|
||||
global $config;
|
||||
|
||||
$match;
|
||||
$match = [];
|
||||
$php_session_id = '';
|
||||
\preg_match(
|
||||
'/PHPSESSID=(.*)/',
|
@ -805,6 +805,11 @@ select:-internal-list-box {
|
||||
.flex-nowrap {
|
||||
flex-wrap: nowrap;
|
||||
}
|
||||
|
||||
.flex-evenly {
|
||||
justify-content: space-evenly;
|
||||
}
|
||||
|
||||
.flex-row-baseline {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
|
33
pandora_console/include/styles/setup.css
Normal file
33
pandora_console/include/styles/setup.css
Normal file
@ -0,0 +1,33 @@
|
||||
span.subtitle {
|
||||
font-size: 1.3em;
|
||||
font-weight: normal;
|
||||
font-family: "lato-bolder";
|
||||
}
|
||||
|
||||
span.subtitle-2 {
|
||||
font-size: 1em;
|
||||
font-weight: normal;
|
||||
font-family: "lato-bolder";
|
||||
}
|
||||
|
||||
.no-borders {
|
||||
border: 0 !important;
|
||||
}
|
||||
|
||||
input[type="text"],
|
||||
input[type="number"] {
|
||||
width: 220px;
|
||||
}
|
||||
|
||||
.fit > tbody > tr > td img {
|
||||
width: 15px;
|
||||
}
|
||||
|
||||
.clean-toggles .white_table_graph_header {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.dbhist tr td:first-child {
|
||||
width: 45%;
|
||||
min-width: 450px;
|
||||
}
|
@ -37,8 +37,8 @@ namespace Composer\Autoload;
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||
* @see http://www.php-fig.org/psr/psr-0/
|
||||
* @see http://www.php-fig.org/psr/psr-4/
|
||||
* @see https://www.php-fig.org/psr/psr-0/
|
||||
* @see https://www.php-fig.org/psr/psr-4/
|
||||
*/
|
||||
class ClassLoader
|
||||
{
|
||||
@ -60,7 +60,7 @@ class ClassLoader
|
||||
public function getPrefixes()
|
||||
{
|
||||
if (!empty($this->prefixesPsr0)) {
|
||||
return call_user_func_array('array_merge', $this->prefixesPsr0);
|
||||
return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
|
||||
}
|
||||
|
||||
return array();
|
||||
|
@ -6,6 +6,7 @@ $vendorDir = dirname(dirname(__FILE__));
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
|
||||
'DeepCopy\\DeepCopy' => $vendorDir . '/myclabs/deep-copy/src/DeepCopy/DeepCopy.php',
|
||||
'DeepCopy\\Exception\\CloneException' => $vendorDir . '/myclabs/deep-copy/src/DeepCopy/Exception/CloneException.php',
|
||||
'DeepCopy\\Exception\\PropertyException' => $vendorDir . '/myclabs/deep-copy/src/DeepCopy/Exception/PropertyException.php',
|
||||
@ -44,7 +45,6 @@ return array(
|
||||
'Egulias\\EmailValidator\\Exception\\DomainHyphened' => $vendorDir . '/egulias/email-validator/EmailValidator/Exception/DomainHyphened.php',
|
||||
'Egulias\\EmailValidator\\Exception\\DotAtEnd' => $vendorDir . '/egulias/email-validator/EmailValidator/Exception/DotAtEnd.php',
|
||||
'Egulias\\EmailValidator\\Exception\\DotAtStart' => $vendorDir . '/egulias/email-validator/EmailValidator/Exception/DotAtStart.php',
|
||||
'Egulias\\EmailValidator\\Exception\\ExpectedQPair' => $vendorDir . '/egulias/email-validator/EmailValidator/Exception/ExpectingQPair.php',
|
||||
'Egulias\\EmailValidator\\Exception\\ExpectingAT' => $vendorDir . '/egulias/email-validator/EmailValidator/Exception/ExpectingAT.php',
|
||||
'Egulias\\EmailValidator\\Exception\\ExpectingATEXT' => $vendorDir . '/egulias/email-validator/EmailValidator/Exception/ExpectingATEXT.php',
|
||||
'Egulias\\EmailValidator\\Exception\\ExpectingCTEXT' => $vendorDir . '/egulias/email-validator/EmailValidator/Exception/ExpectingCTEXT.php',
|
||||
@ -309,49 +309,22 @@ return array(
|
||||
'Mpdf\\Utils\\PdfDate' => $vendorDir . '/mpdf/mpdf/src/Utils/PdfDate.php',
|
||||
'Mpdf\\Utils\\UtfString' => $vendorDir . '/mpdf/mpdf/src/Utils/UtfString.php',
|
||||
'PandoraFMS\\Agent' => $baseDir . '/include/lib/Agent.php',
|
||||
'PandoraFMS\\Dashboard\\AgentModuleWidget' => $baseDir . '/include/lib/Dashboard/Widgets/agent_module.php',
|
||||
'PandoraFMS\\Dashboard\\AlertsFiredWidget' => $baseDir . '/include/lib/Dashboard/Widgets/alerts_fired.php',
|
||||
'PandoraFMS\\Core\\Config' => $baseDir . '/include/lib/Core/Config.php',
|
||||
'PandoraFMS\\Core\\DBMaintainer' => $baseDir . '/include/lib/Core/DBMaintainer.php',
|
||||
'PandoraFMS\\Dashboard\\Cell' => $baseDir . '/include/lib/Dashboard/Cell.php',
|
||||
'PandoraFMS\\Dashboard\\ClockWidget' => $baseDir . '/include/lib/Dashboard/Widgets/clock.php',
|
||||
'PandoraFMS\\Dashboard\\CustomGraphWidget' => $baseDir . '/include/lib/Dashboard/Widgets/custom_graph.php',
|
||||
'PandoraFMS\\Dashboard\\EventsListWidget' => $baseDir . '/include/lib/Dashboard/Widgets/events_list.php',
|
||||
'PandoraFMS\\Dashboard\\GraphModuleHistogramWidget' => $baseDir . '/include/lib/Dashboard/Widgets/graph_module_histogram.php',
|
||||
'PandoraFMS\\Dashboard\\GroupsStatusWidget' => $baseDir . '/include/lib/Dashboard/Widgets/groups_status.php',
|
||||
'PandoraFMS\\Dashboard\\Manager' => $baseDir . '/include/lib/Dashboard/Manager.php',
|
||||
'PandoraFMS\\Dashboard\\MapsMadeByUser' => $baseDir . '/include/lib/Dashboard/Widgets/maps_made_by_user.php',
|
||||
'PandoraFMS\\Dashboard\\MapsStatusWidget' => $baseDir . '/include/lib/Dashboard/Widgets/maps_status.php',
|
||||
'PandoraFMS\\Dashboard\\ModuleIconWidget' => $baseDir . '/include/lib/Dashboard/Widgets/module_icon.php',
|
||||
'PandoraFMS\\Dashboard\\ModuleStatusWidget' => $baseDir . '/include/lib/Dashboard/Widgets/module_status.php',
|
||||
'PandoraFMS\\Dashboard\\ModuleTableValueWidget' => $baseDir . '/include/lib/Dashboard/Widgets/module_table_value.php',
|
||||
'PandoraFMS\\Dashboard\\ModuleValueWidget' => $baseDir . '/include/lib/Dashboard/Widgets/module_value.php',
|
||||
'PandoraFMS\\Dashboard\\MonitorHealthWidget' => $baseDir . '/include/lib/Dashboard/Widgets/monitor_health.php',
|
||||
'PandoraFMS\\Dashboard\\NetworkMapWidget' => $baseDir . '/include/lib/Dashboard/Widgets/network_map.php',
|
||||
'PandoraFMS\\Dashboard\\PostWidget' => $baseDir . '/include/lib/Dashboard/Widgets/post.php',
|
||||
'PandoraFMS\\Dashboard\\ReportsWidget' => $baseDir . '/include/lib/Dashboard/Widgets/reports.php',
|
||||
'PandoraFMS\\Dashboard\\SLAPercentWidget' => $baseDir . '/include/lib/Dashboard/Widgets/sla_percent.php',
|
||||
'PandoraFMS\\Dashboard\\ServiceMapWidget' => $baseDir . '/include/lib/Dashboard/Widgets/service_map.php',
|
||||
'PandoraFMS\\Dashboard\\SingleGraphWidget' => $baseDir . '/include/lib/Dashboard/Widgets/single_graph.php',
|
||||
'PandoraFMS\\Dashboard\\SystemGroupStatusWidget' => $baseDir . '/include/lib/Dashboard/Widgets/system_group_status.php',
|
||||
'PandoraFMS\\Dashboard\\TacticalWidget' => $baseDir . '/include/lib/Dashboard/Widgets/tactical.php',
|
||||
'PandoraFMS\\Dashboard\\TopNEventByGroupWidget' => $baseDir . '/include/lib/Dashboard/Widgets/top_n_events_by_group.php',
|
||||
'PandoraFMS\\Dashboard\\TopNEventByModuleWidget' => $baseDir . '/include/lib/Dashboard/Widgets/top_n_events_by_module.php',
|
||||
'PandoraFMS\\Dashboard\\TopNWidget' => $baseDir . '/include/lib/Dashboard/Widgets/top_n.php',
|
||||
'PandoraFMS\\Dashboard\\TreeViewWidget' => $baseDir . '/include/lib/Dashboard/Widgets/tree_view.php',
|
||||
'PandoraFMS\\Dashboard\\UrlWidget' => $baseDir . '/include/lib/Dashboard/Widgets/url.php',
|
||||
'PandoraFMS\\Dashboard\\WelcomeWidget' => $baseDir . '/include/lib/Dashboard/Widgets/example.php',
|
||||
'PandoraFMS\\Dashboard\\Widget' => $baseDir . '/include/lib/Dashboard/Widget.php',
|
||||
'PandoraFMS\\Dashboard\\WuxStatsWidget' => $baseDir . '/include/lib/Dashboard/Widgets/wux_transaction_stats.php',
|
||||
'PandoraFMS\\Dashboard\\WuxWidget' => $baseDir . '/include/lib/Dashboard/Widgets/wux_transaction.php',
|
||||
'PandoraFMS\\Entity' => $baseDir . '/include/lib/Entity.php',
|
||||
'PandoraFMS\\Event' => $baseDir . '/include/lib/Event.php',
|
||||
'PandoraFMS\\Group' => $baseDir . '/include/lib/Group.php',
|
||||
'PandoraFMS\\Module' => $baseDir . '/include/lib/Module.php',
|
||||
'PandoraFMS\\ModuleStatus' => $baseDir . '/include/lib/ModuleStatus.php',
|
||||
'PandoraFMS\\ModuleType' => $baseDir . '/include/lib/ModuleType.php',
|
||||
'PandoraFMS\\User' => $baseDir . '/include/lib/User.php',
|
||||
'PandoraFMS\\View' => $baseDir . '/include/lib/View.php',
|
||||
'PandoraFMS\\WebSockets\\WSManager' => $baseDir . '/include/lib/WSManager.php',
|
||||
'PandoraFMS\\Websockets\\WebSocketServer' => $baseDir . '/include/lib/WebSocketServer.php',
|
||||
'PandoraFMS\\Websockets\\WebSocketUser' => $baseDir . '/include/lib/WebSocketUser.php',
|
||||
'PandoraFMS\\Websockets\\WSManager' => $baseDir . '/include/lib/Websockets/WSManager.php',
|
||||
'PandoraFMS\\Websockets\\WebSocketServer' => $baseDir . '/include/lib/Websockets/WebSocketServer.php',
|
||||
'PandoraFMS\\Websockets\\WebSocketUser' => $baseDir . '/include/lib/Websockets/WebSocketUser.php',
|
||||
'Psr\\Log\\AbstractLogger' => $vendorDir . '/psr/log/Psr/Log/AbstractLogger.php',
|
||||
'Psr\\Log\\InvalidArgumentException' => $vendorDir . '/psr/log/Psr/Log/InvalidArgumentException.php',
|
||||
'Psr\\Log\\LogLevel' => $vendorDir . '/psr/log/Psr/Log/LogLevel.php',
|
||||
@ -360,7 +333,6 @@ return array(
|
||||
'Psr\\Log\\LoggerInterface' => $vendorDir . '/psr/log/Psr/Log/LoggerInterface.php',
|
||||
'Psr\\Log\\LoggerTrait' => $vendorDir . '/psr/log/Psr/Log/LoggerTrait.php',
|
||||
'Psr\\Log\\NullLogger' => $vendorDir . '/psr/log/Psr/Log/NullLogger.php',
|
||||
'Psr\\Log\\Test\\DummyTest' => $vendorDir . '/psr/log/Psr/Log/Test/LoggerInterfaceTest.php',
|
||||
'Psr\\Log\\Test\\LoggerInterfaceTest' => $vendorDir . '/psr/log/Psr/Log/Test/LoggerInterfaceTest.php',
|
||||
'fpdi_pdf_parser' => $vendorDir . '/setasign/fpdi/fpdi_pdf_parser.php',
|
||||
'pdf_context' => $vendorDir . '/setasign/fpdi/pdf_context.php',
|
||||
|
@ -22,13 +22,15 @@ class ComposerAutoloaderInitfdecadadce22e6dde51e9535fe4ad7aa
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
require __DIR__ . '/platform_check.php';
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInitfdecadadce22e6dde51e9535fe4ad7aa', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitfdecadadce22e6dde51e9535fe4ad7aa', 'loadClassLoader'));
|
||||
|
||||
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
||||
if ($useStaticLoader) {
|
||||
require_once __DIR__ . '/autoload_static.php';
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInitfdecadadce22e6dde51e9535fe4ad7aa::getInitializer($loader));
|
||||
} else {
|
||||
|
@ -88,6 +88,7 @@ class ComposerStaticInitfdecadadce22e6dde51e9535fe4ad7aa
|
||||
);
|
||||
|
||||
public static $classMap = array (
|
||||
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
|
||||
'DeepCopy\\DeepCopy' => __DIR__ . '/..' . '/myclabs/deep-copy/src/DeepCopy/DeepCopy.php',
|
||||
'DeepCopy\\Exception\\CloneException' => __DIR__ . '/..' . '/myclabs/deep-copy/src/DeepCopy/Exception/CloneException.php',
|
||||
'DeepCopy\\Exception\\PropertyException' => __DIR__ . '/..' . '/myclabs/deep-copy/src/DeepCopy/Exception/PropertyException.php',
|
||||
@ -126,7 +127,6 @@ class ComposerStaticInitfdecadadce22e6dde51e9535fe4ad7aa
|
||||
'Egulias\\EmailValidator\\Exception\\DomainHyphened' => __DIR__ . '/..' . '/egulias/email-validator/EmailValidator/Exception/DomainHyphened.php',
|
||||
'Egulias\\EmailValidator\\Exception\\DotAtEnd' => __DIR__ . '/..' . '/egulias/email-validator/EmailValidator/Exception/DotAtEnd.php',
|
||||
'Egulias\\EmailValidator\\Exception\\DotAtStart' => __DIR__ . '/..' . '/egulias/email-validator/EmailValidator/Exception/DotAtStart.php',
|
||||
'Egulias\\EmailValidator\\Exception\\ExpectedQPair' => __DIR__ . '/..' . '/egulias/email-validator/EmailValidator/Exception/ExpectingQPair.php',
|
||||
'Egulias\\EmailValidator\\Exception\\ExpectingAT' => __DIR__ . '/..' . '/egulias/email-validator/EmailValidator/Exception/ExpectingAT.php',
|
||||
'Egulias\\EmailValidator\\Exception\\ExpectingATEXT' => __DIR__ . '/..' . '/egulias/email-validator/EmailValidator/Exception/ExpectingATEXT.php',
|
||||
'Egulias\\EmailValidator\\Exception\\ExpectingCTEXT' => __DIR__ . '/..' . '/egulias/email-validator/EmailValidator/Exception/ExpectingCTEXT.php',
|
||||
@ -391,49 +391,22 @@ class ComposerStaticInitfdecadadce22e6dde51e9535fe4ad7aa
|
||||
'Mpdf\\Utils\\PdfDate' => __DIR__ . '/..' . '/mpdf/mpdf/src/Utils/PdfDate.php',
|
||||
'Mpdf\\Utils\\UtfString' => __DIR__ . '/..' . '/mpdf/mpdf/src/Utils/UtfString.php',
|
||||
'PandoraFMS\\Agent' => __DIR__ . '/../..' . '/include/lib/Agent.php',
|
||||
'PandoraFMS\\Dashboard\\AgentModuleWidget' => __DIR__ . '/../..' . '/include/lib/Dashboard/Widgets/agent_module.php',
|
||||
'PandoraFMS\\Dashboard\\AlertsFiredWidget' => __DIR__ . '/../..' . '/include/lib/Dashboard/Widgets/alerts_fired.php',
|
||||
'PandoraFMS\\Core\\Config' => __DIR__ . '/../..' . '/include/lib/Core/Config.php',
|
||||
'PandoraFMS\\Core\\DBMaintainer' => __DIR__ . '/../..' . '/include/lib/Core/DBMaintainer.php',
|
||||
'PandoraFMS\\Dashboard\\Cell' => __DIR__ . '/../..' . '/include/lib/Dashboard/Cell.php',
|
||||
'PandoraFMS\\Dashboard\\ClockWidget' => __DIR__ . '/../..' . '/include/lib/Dashboard/Widgets/clock.php',
|
||||
'PandoraFMS\\Dashboard\\CustomGraphWidget' => __DIR__ . '/../..' . '/include/lib/Dashboard/Widgets/custom_graph.php',
|
||||
'PandoraFMS\\Dashboard\\EventsListWidget' => __DIR__ . '/../..' . '/include/lib/Dashboard/Widgets/events_list.php',
|
||||
'PandoraFMS\\Dashboard\\GraphModuleHistogramWidget' => __DIR__ . '/../..' . '/include/lib/Dashboard/Widgets/graph_module_histogram.php',
|
||||
'PandoraFMS\\Dashboard\\GroupsStatusWidget' => __DIR__ . '/../..' . '/include/lib/Dashboard/Widgets/groups_status.php',
|
||||
'PandoraFMS\\Dashboard\\Manager' => __DIR__ . '/../..' . '/include/lib/Dashboard/Manager.php',
|
||||
'PandoraFMS\\Dashboard\\MapsMadeByUser' => __DIR__ . '/../..' . '/include/lib/Dashboard/Widgets/maps_made_by_user.php',
|
||||
'PandoraFMS\\Dashboard\\MapsStatusWidget' => __DIR__ . '/../..' . '/include/lib/Dashboard/Widgets/maps_status.php',
|
||||
'PandoraFMS\\Dashboard\\ModuleIconWidget' => __DIR__ . '/../..' . '/include/lib/Dashboard/Widgets/module_icon.php',
|
||||
'PandoraFMS\\Dashboard\\ModuleStatusWidget' => __DIR__ . '/../..' . '/include/lib/Dashboard/Widgets/module_status.php',
|
||||
'PandoraFMS\\Dashboard\\ModuleTableValueWidget' => __DIR__ . '/../..' . '/include/lib/Dashboard/Widgets/module_table_value.php',
|
||||
'PandoraFMS\\Dashboard\\ModuleValueWidget' => __DIR__ . '/../..' . '/include/lib/Dashboard/Widgets/module_value.php',
|
||||
'PandoraFMS\\Dashboard\\MonitorHealthWidget' => __DIR__ . '/../..' . '/include/lib/Dashboard/Widgets/monitor_health.php',
|
||||
'PandoraFMS\\Dashboard\\NetworkMapWidget' => __DIR__ . '/../..' . '/include/lib/Dashboard/Widgets/network_map.php',
|
||||
'PandoraFMS\\Dashboard\\PostWidget' => __DIR__ . '/../..' . '/include/lib/Dashboard/Widgets/post.php',
|
||||
'PandoraFMS\\Dashboard\\ReportsWidget' => __DIR__ . '/../..' . '/include/lib/Dashboard/Widgets/reports.php',
|
||||
'PandoraFMS\\Dashboard\\SLAPercentWidget' => __DIR__ . '/../..' . '/include/lib/Dashboard/Widgets/sla_percent.php',
|
||||
'PandoraFMS\\Dashboard\\ServiceMapWidget' => __DIR__ . '/../..' . '/include/lib/Dashboard/Widgets/service_map.php',
|
||||
'PandoraFMS\\Dashboard\\SingleGraphWidget' => __DIR__ . '/../..' . '/include/lib/Dashboard/Widgets/single_graph.php',
|
||||
'PandoraFMS\\Dashboard\\SystemGroupStatusWidget' => __DIR__ . '/../..' . '/include/lib/Dashboard/Widgets/system_group_status.php',
|
||||
'PandoraFMS\\Dashboard\\TacticalWidget' => __DIR__ . '/../..' . '/include/lib/Dashboard/Widgets/tactical.php',
|
||||
'PandoraFMS\\Dashboard\\TopNEventByGroupWidget' => __DIR__ . '/../..' . '/include/lib/Dashboard/Widgets/top_n_events_by_group.php',
|
||||
'PandoraFMS\\Dashboard\\TopNEventByModuleWidget' => __DIR__ . '/../..' . '/include/lib/Dashboard/Widgets/top_n_events_by_module.php',
|
||||
'PandoraFMS\\Dashboard\\TopNWidget' => __DIR__ . '/../..' . '/include/lib/Dashboard/Widgets/top_n.php',
|
||||
'PandoraFMS\\Dashboard\\TreeViewWidget' => __DIR__ . '/../..' . '/include/lib/Dashboard/Widgets/tree_view.php',
|
||||
'PandoraFMS\\Dashboard\\UrlWidget' => __DIR__ . '/../..' . '/include/lib/Dashboard/Widgets/url.php',
|
||||
'PandoraFMS\\Dashboard\\WelcomeWidget' => __DIR__ . '/../..' . '/include/lib/Dashboard/Widgets/example.php',
|
||||
'PandoraFMS\\Dashboard\\Widget' => __DIR__ . '/../..' . '/include/lib/Dashboard/Widget.php',
|
||||
'PandoraFMS\\Dashboard\\WuxStatsWidget' => __DIR__ . '/../..' . '/include/lib/Dashboard/Widgets/wux_transaction_stats.php',
|
||||
'PandoraFMS\\Dashboard\\WuxWidget' => __DIR__ . '/../..' . '/include/lib/Dashboard/Widgets/wux_transaction.php',
|
||||
'PandoraFMS\\Entity' => __DIR__ . '/../..' . '/include/lib/Entity.php',
|
||||
'PandoraFMS\\Event' => __DIR__ . '/../..' . '/include/lib/Event.php',
|
||||
'PandoraFMS\\Group' => __DIR__ . '/../..' . '/include/lib/Group.php',
|
||||
'PandoraFMS\\Module' => __DIR__ . '/../..' . '/include/lib/Module.php',
|
||||
'PandoraFMS\\ModuleStatus' => __DIR__ . '/../..' . '/include/lib/ModuleStatus.php',
|
||||
'PandoraFMS\\ModuleType' => __DIR__ . '/../..' . '/include/lib/ModuleType.php',
|
||||
'PandoraFMS\\User' => __DIR__ . '/../..' . '/include/lib/User.php',
|
||||
'PandoraFMS\\View' => __DIR__ . '/../..' . '/include/lib/View.php',
|
||||
'PandoraFMS\\WebSockets\\WSManager' => __DIR__ . '/../..' . '/include/lib/WSManager.php',
|
||||
'PandoraFMS\\Websockets\\WebSocketServer' => __DIR__ . '/../..' . '/include/lib/WebSocketServer.php',
|
||||
'PandoraFMS\\Websockets\\WebSocketUser' => __DIR__ . '/../..' . '/include/lib/WebSocketUser.php',
|
||||
'PandoraFMS\\Websockets\\WSManager' => __DIR__ . '/../..' . '/include/lib/Websockets/WSManager.php',
|
||||
'PandoraFMS\\Websockets\\WebSocketServer' => __DIR__ . '/../..' . '/include/lib/Websockets/WebSocketServer.php',
|
||||
'PandoraFMS\\Websockets\\WebSocketUser' => __DIR__ . '/../..' . '/include/lib/Websockets/WebSocketUser.php',
|
||||
'Psr\\Log\\AbstractLogger' => __DIR__ . '/..' . '/psr/log/Psr/Log/AbstractLogger.php',
|
||||
'Psr\\Log\\InvalidArgumentException' => __DIR__ . '/..' . '/psr/log/Psr/Log/InvalidArgumentException.php',
|
||||
'Psr\\Log\\LogLevel' => __DIR__ . '/..' . '/psr/log/Psr/Log/LogLevel.php',
|
||||
@ -442,7 +415,6 @@ class ComposerStaticInitfdecadadce22e6dde51e9535fe4ad7aa
|
||||
'Psr\\Log\\LoggerInterface' => __DIR__ . '/..' . '/psr/log/Psr/Log/LoggerInterface.php',
|
||||
'Psr\\Log\\LoggerTrait' => __DIR__ . '/..' . '/psr/log/Psr/Log/LoggerTrait.php',
|
||||
'Psr\\Log\\NullLogger' => __DIR__ . '/..' . '/psr/log/Psr/Log/NullLogger.php',
|
||||
'Psr\\Log\\Test\\DummyTest' => __DIR__ . '/..' . '/psr/log/Psr/Log/Test/LoggerInterfaceTest.php',
|
||||
'Psr\\Log\\Test\\LoggerInterfaceTest' => __DIR__ . '/..' . '/psr/log/Psr/Log/Test/LoggerInterfaceTest.php',
|
||||
'fpdi_pdf_parser' => __DIR__ . '/..' . '/setasign/fpdi/fpdi_pdf_parser.php',
|
||||
'pdf_context' => __DIR__ . '/..' . '/setasign/fpdi/pdf_context.php',
|
||||
|
26
pandora_console/vendor/composer/platform_check.php
vendored
Normal file
26
pandora_console/vendor/composer/platform_check.php
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
// platform_check.php @generated by Composer
|
||||
|
||||
$issues = array();
|
||||
|
||||
if (!(PHP_VERSION_ID >= 70000)) {
|
||||
$issues[] = 'Your Composer dependencies require a PHP version ">= 7.0.0". You are running ' . PHP_VERSION . '.';
|
||||
}
|
||||
|
||||
if ($issues) {
|
||||
if (!headers_sent()) {
|
||||
header('HTTP/1.1 500 Internal Server Error');
|
||||
}
|
||||
if (!ini_get('display_errors')) {
|
||||
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
|
||||
fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL);
|
||||
} elseif (!headers_sent()) {
|
||||
echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL;
|
||||
}
|
||||
}
|
||||
trigger_error(
|
||||
'Composer detected issues in your platform: ' . implode(' ', $issues),
|
||||
E_USER_ERROR
|
||||
);
|
||||
}
|
@ -28,7 +28,7 @@
|
||||
|
||||
// Begin.
|
||||
require_once __DIR__.'/vendor/autoload.php';
|
||||
use \PandoraFMS\WebSockets\WSManager;
|
||||
use \PandoraFMS\Websockets\WSManager;
|
||||
|
||||
// Set to true to get full output.
|
||||
$debug = false;
|
||||
|
@ -1023,8 +1023,8 @@ sub pandora_delete_old_session_data {
|
||||
###############################################################################
|
||||
# Main
|
||||
###############################################################################
|
||||
sub pandoradb_main ($$$) {
|
||||
my ($conf, $dbh, $history_dbh) = @_;
|
||||
sub pandoradb_main ($$$;$) {
|
||||
my ($conf, $dbh, $history_dbh, $running_in_history) = @_;
|
||||
|
||||
log_message ('', "Starting at ". strftime ("%Y-%m-%d %H:%M:%S", localtime()) . "\n");
|
||||
|
||||
@ -1045,8 +1045,12 @@ sub pandoradb_main ($$$) {
|
||||
}
|
||||
}
|
||||
|
||||
# Only active database should be compacted. Disabled for historical database.
|
||||
# Compact on if enable and DaysCompact are below DaysPurge
|
||||
if (($conf->{'_onlypurge'} == 0) && ($conf->{'_days_compact'} < $conf->{'_days_purge'})) {
|
||||
if (!$running_in_history
|
||||
&& ($conf->{'_onlypurge'} == 0)
|
||||
&& ($conf->{'_days_compact'} < $conf->{'_days_purge'})
|
||||
) {
|
||||
pandora_compactdb ($conf, defined ($history_dbh) ? $history_dbh : $dbh, $dbh);
|
||||
}
|
||||
|
||||
@ -1166,9 +1170,13 @@ if (defined($history_dbh)) {
|
||||
pandoradb_main(
|
||||
$h_conf,
|
||||
$history_dbh,
|
||||
undef
|
||||
undef,
|
||||
1 # Disable certain funcionality while runningn in historical database.
|
||||
);
|
||||
|
||||
# Handle partitions.
|
||||
enterprise_hook('handle_partitions', [$h_conf, $history_dbh]);
|
||||
|
||||
}
|
||||
|
||||
# Keep integrity between PandoraFMS agents and IntegriaIMS inventory objects.
|
||||
|
Loading…
x
Reference in New Issue
Block a user