Merge remote-tracking branch 'origin/develop' into ent-3595-discovery-fase-2

Former-commit-id: 9df9a4c3a4a50e191af5167129df1352e712171e
This commit is contained in:
fbsanchez 2019-03-20 17:40:08 +01:00
commit 6fb6963501
34 changed files with 484 additions and 85 deletions

View File

@ -172,8 +172,8 @@ echo "Updating Pandora Console version..."
sed -i -e "s/\s*\$pandora_version\s*=.*/\$pandora_version = 'v$VERSION';/" "$CONSOLE_FILE" sed -i -e "s/\s*\$pandora_version\s*=.*/\$pandora_version = 'v$VERSION';/" "$CONSOLE_FILE"
sed -i -e "s/\s*\$build_version\s*=.*/\$build_version = 'PC$BUILD';/" "$CONSOLE_FILE" sed -i -e "s/\s*\$build_version\s*=.*/\$build_version = 'PC$BUILD';/" "$CONSOLE_FILE"
echo "Updating Pandora Console installer version..." echo "Updating Pandora Console installer version..."
sed -i -e "s/\s*\$version\s*=.*/\$version = '$VERSION';/" "$CONSOLE_INSTALL_FILE" sed -i -e "s/\(\s*\$version\s*=\s\).*/\1'$VERSION';/" "$CONSOLE_INSTALL_FILE"
sed -i -e "s/\s*\$build\s*=.*/\$build = '$BUILD';/" "$CONSOLE_INSTALL_FILE" sed -i -e "s/\(\s*\$build\s*=\s\).*/\1'$BUILD';/" "$CONSOLE_INSTALL_FILE"
echo "Setting develop_bypass to 0..." echo "Setting develop_bypass to 0..."
sed -i -e "s/\s*if\s*(\s*[!]\s*isset\s*(\s*$develop_bypass\s*)\s*)\s*$develop_bypass\s*=.*/if ([!]isset($develop_bypass)) $develop_bypass = 0;/" "$CONSOLE_FILE" sed -i -e "s/\s*if\s*(\s*[!]\s*isset\s*(\s*$develop_bypass\s*)\s*)\s*$develop_bypass\s*=.*/if ([!]isset($develop_bypass)) $develop_bypass = 0;/" "$CONSOLE_FILE"

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.732-190313 Version: 7.0NG.732-190320
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.732-190313" pandora_version="7.0NG.732-190320"
echo "Test if you has the tools for to make the packages." echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null

View File

@ -42,7 +42,7 @@ my $Sem = undef;
my $ThreadSem = undef; my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.732'; use constant AGENT_VERSION => '7.0NG.732';
use constant AGENT_BUILD => '190313'; use constant AGENT_BUILD => '190320';
# Agent log default file size maximum and instances # Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000; use constant DEFAULT_MAX_LOG_SIZE => 600000;

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.732 %define version 7.0NG.732
%define release 190313 %define release 190320
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.732 %define version 7.0NG.732
%define release 190313 %define release 190320
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -10,7 +10,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.732" PI_VERSION="7.0NG.732"
PI_BUILD="190313" PI_BUILD="190320"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{190313} {190320}
ViewReadme ViewReadme
{Yes} {Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils; using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1 #define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.732(Build 190313)") #define PANDORA_VERSION ("7.0NG.732(Build 190320)")
string pandora_path; string pandora_path;
string pandora_dir; string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST" VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent" VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.732(Build 190313))" VALUE "ProductVersion", "(7.0NG.732(Build 190320))"
VALUE "FileVersion", "1.0.0.0" VALUE "FileVersion", "1.0.0.0"
END END
END END

View File

@ -1,5 +1,5 @@
package: pandorafms-console package: pandorafms-console
Version: 7.0NG.732-190313 Version: 7.0NG.732-190320
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.732-190313" pandora_version="7.0NG.732-190320"
package_pear=0 package_pear=0
package_pandora=1 package_pandora=1

View File

View File

@ -0,0 +1,3 @@
/godmode/servers/recorn_script.php
/godmode/servers/manage_recontask_form.php
/godmode/servers/manage_recontask.php

View File

@ -321,6 +321,8 @@ if ($create_modules) {
$module_type = 2; $module_type = 2;
} else if (preg_match('/ifAdminStatus/', $name_array[1])) { } else if (preg_match('/ifAdminStatus/', $name_array[1])) {
$module_type = 2; $module_type = 2;
} else if (preg_match('/ifOperStatus/', $name_array[1])) {
$module_type = 18;
} else { } else {
$module_type = 4; $module_type = 4;
} }
@ -367,7 +369,24 @@ if ($create_modules) {
if ($row['server_type'] == 13) { if ($row['server_type'] == 13) {
$module_type_name = db_get_value_filter('nombre', 'ttipo_modulo', ['id_tipo' => $values['id_tipo_modulo']]); $module_type_name = db_get_value_filter('nombre', 'ttipo_modulo', ['id_tipo' => $values['id_tipo_modulo']]);
$new_module_configuration_data = "module_begin\nmodule_name ".io_safe_input($name)."\nmodule_description ".io_safe_output($values['descripcion'])."\nmodule_type ".$module_type_name."\nmodule_snmp\nmodule_oid ".$conf_oid."\nmodule_community ".$values['snmp_community']."\nmodule_end"; $new_module_configuration_data = "module_begin\nmodule_name ".io_safe_input($name)."\nmodule_description ".io_safe_output($values['descripcion'])."\nmodule_type ".$module_type_name."\nmodule_snmp\nmodule_version ".$snmp_version."\nmodule_oid ".$conf_oid."\nmodule_community ".$values['snmp_community'];
if ($snmp_version == '3') {
$new_module_configuration_data .= "\nmodule_secname ".$snmp3_auth_user;
$new_module_configuration_data .= "\nmodule_seclevel ".$snmp3_security_level;
if ($snmp3_security_level == 'authNoPriv' || $snmp3_security_level == 'authPriv') {
$new_module_configuration_data .= "\nmodule_authpass ".$snmp3_auth_pass;
$new_module_configuration_data .= "\nmodule_authproto ".$snmp3_auth_method;
}
if ($snmp3_security_level == 'authPriv') {
$new_module_configuration_data .= "\nmodule_privproto ".$snmp3_privacy_method;
$new_module_configuration_data .= "\nmodule_privpass ".$snmp3_privacy_pass;
}
}
$new_module_configuration_data .= "\nmodule_end";
config_agents_add_module_in_conf($id_agent, $new_module_configuration_data); config_agents_add_module_in_conf($id_agent, $new_module_configuration_data);
} }

View File

@ -1,23 +1,39 @@
<?php <?php
/**
* Extension to manage a list of gateways and the node address where they should
* point to.
*
* @category Update Manager Offline
* @package Pandora FMS
* @subpackage Community
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2019 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.
* ============================================================================
*/
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2011 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; 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.
global $config; global $config;
// ui_require_css_file('update_manager', 'godmode/update_manager/');
check_login(); check_login();
// ui_require_css_file('update_manager', 'godmode/update_manager/'); if (! check_acl($config['id_user'], 0, 'PM')
if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) { && ! is_user_admin($config['id_user'])
) {
db_pandora_audit('ACL Violation', 'Trying to access Setup Management'); db_pandora_audit('ACL Violation', 'Trying to access Setup Management');
include 'general/noaccess.php'; include 'general/noaccess.php';
return; return;
@ -27,7 +43,8 @@ $baseurl = ui_get_full_url(false, false, false, false);
?> ?>
<!-- Add the stylesheet here cause somehow the 'ui_require_css_file' is not working on the metaconsole and there is no time to fix it --> <!-- Add the stylesheet here cause somehow the 'ui_require_css_file'
is not working on the metaconsole and there is no time to fix it -->
<link rel="stylesheet" type="text/css" href="<?php echo $baseurl; ?>/godmode/update_manager/update_manager.css"> <link rel="stylesheet" type="text/css" href="<?php echo $baseurl; ?>/godmode/update_manager/update_manager.css">
<script type="text/javascript"> <script type="text/javascript">

View File

@ -1,16 +1,32 @@
<?php <?php
/**
* Extension to manage a list of gateways and the node address where they should
* point to.
*
* @category Update Manager Ajax
* @package Pandora FMS
* @subpackage Community
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2019 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.
* ============================================================================
*/
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2010 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.
global $config; global $config;
check_login(); check_login();
@ -44,6 +60,7 @@ $check_update_free_package = (bool) get_parameter('check_update_free_package');
$install_free_package = (bool) get_parameter('install_free_package'); $install_free_package = (bool) get_parameter('install_free_package');
$search_minor = (bool) get_parameter('search_minor'); $search_minor = (bool) get_parameter('search_minor');
$unzip_free_package = (bool) get_parameter('unzip_free_package'); $unzip_free_package = (bool) get_parameter('unzip_free_package');
$delete_desired_files = (bool) get_parameter('delete_desired_files');
if ($upload_file) { if ($upload_file) {
ob_clean(); ob_clean();
@ -243,8 +260,15 @@ if ($install_package) {
return; return;
} }
update_manager_enterprise_set_version($version); enterprise_hook(
db_pandora_audit('Update '.get_product_name(), "Update version: $version of ".get_product_name().' by '.$config['id_user']); 'update_manager_enterprise_set_version',
[$version]
);
db_pandora_audit(
'Update '.get_product_name(),
"Update version: $version of ".get_product_name().' by '.$config['id_user']
);
$return['status'] = 'success'; $return['status'] = 'success';
echo json_encode($return); echo json_encode($return);
@ -591,3 +615,143 @@ if ($install_free_package) {
return; return;
} }
/*
* Result info:
* Types of status:
* -1 -> Not exits file.
* 0 -> File or directory deleted successfully.
* 1 -> Problem delete file or directory.
* 2 -> Not found file or directory.
* 3 -> Don`t read file deleet_files.txt.
* 4 -> "deleted" folder could not be created.
* 5 -> "deleted" folder was created.
* 6 -> The "delete files" could not be the "delete" folder.
* 7 -> The "delete files" is moved to the "delete" folder.
* Type:
* f -> File
* d -> Dir.
* route: Path.
*/
if ($delete_desired_files === true) {
global $config;
// Initialize result.
$result = [];
$result['status_list'] = [];
// Flag exist folder "deleted".
$exist_deleted = true;
// Route delete_files.txt.
$route_delete_files = $config['homedir'];
$route_delete_files .= '/extras/delete_files/delete_files.txt';
// Route directory deleted.
$route_dir_deleted = $config['homedir'];
$route_dir_deleted .= '/extras/delete_files/deleted/';
// Check isset directory deleted
// if it does not exist, try to create it.
if (is_dir($route_dir_deleted) === false) {
$res_mkdir = mkdir($route_dir_deleted, 0777, true);
$res = [];
if ($res_mkdir !== true) {
$exist_deleted = false;
$res['status'] = 4;
} else {
$res['status'] = 5;
}
$res['type'] = 'd';
$res['path'] = $url_to_delete;
array_push($result['status_list'], $res);
}
// Check isset delete_files.txt.
if (file_exists($route_delete_files) === true && $exist_deleted === true) {
// Open file.
$file_read = fopen($route_delete_files, 'r');
// Check if read delete_files.txt.
if ($file_read !== false) {
while ($file_to_delete = stream_get_line($file_read, 65535, "\n")) {
$file_to_delete = trim($file_to_delete);
$url_to_delete = $config['homedir'].'/'.$file_to_delete;
// Check is dir or file or not exists.
if (is_dir($url_to_delete) === true) {
$rmdir_recursive = rmdir_recursive(
$url_to_delete,
$result['status_list']
);
array_push(
$result['status_list'],
$rmdir_recursive
);
} else if (file_exists($url_to_delete) === true) {
$unlink = unlink($url_to_delete);
$res = [];
$res['status'] = ($unlink === true) ? 0 : 1;
$res['type'] = 'f';
$res['path'] = $url_to_delete;
array_push($result['status_list'], $res);
} else {
$res = [];
$res['status'] = 2;
$res['path'] = $url_to_delete;
array_push($result['status_list'], $res);
}
}
} else {
$res = [];
$res['status'] = 3;
$res['path'] = $url_to_delete;
array_push($result['status_list'], $res);
}
// Close file.
fclose($route_delete_files);
// Move delete_files.txt to dir extras/deleted/.
$count_scandir = count(scandir($route_dir_deleted));
$route_move = $route_dir_deleted.'/delete_files_'.$count_scandir.'.txt';
$res_rename = rename(
$route_delete_files,
$route_move
);
$res = [];
$res['status'] = ($res_rename === true) ? 7 : 6;
$res['type'] = 'f';
$res['path'] = $route_move;
array_push($result['status_list'], $res);
} else {
if ($exist_deleted === true) {
$res = [];
$res['status'] = -1;
array_push($result['status_list'], $res);
}
}
// Translation diccionary neccesary.
$result['translation'] = [
'title' => __('Delete files'),
'not_file' => __('The oum has no files to remove'),
'not_found' => __('Not found'),
'not_deleted' => __('Not deleted'),
'not_read' => __('The file delete_file.txt can not be read'),
'folder_deleted_f' => __('\'deleted\' folder could not be created'),
'folder_deleted_t' => __('\'deleted\' folder was created'),
'move_file_f' => __(
'The "delete files" could not be the "delete" folder'
),
'move_file_d' => __(
'The "delete files" is moved to the "delete" folder'
),
];
echo json_encode($result);
return;
}

View File

@ -20,7 +20,7 @@
/** /**
* Pandora build version and version * Pandora build version and version
*/ */
$build_version = 'PC190313'; $build_version = 'PC190320';
$pandora_version = 'v7.0NG.732'; $pandora_version = 'v7.0NG.732';
// Do not overwrite default timezone set if defined. // Do not overwrite default timezone set if defined.

View File

@ -701,19 +701,20 @@ function events_comment(
$first_event = reset($id_event); $first_event = reset($id_event);
} }
$event_comments = db_get_value( $event_comments = mysql_db_process_sql(
'user_comment', 'SELECT user_comment FROM '.$event_table.' WHERE id_evento = '.$first_event,
$event_table, 'affected_rows',
'id_evento', '',
$first_event false
); );
$event_comments_array = []; $event_comments_array = [];
if ($event_comments == '') { if ($event_comments[0]['user_comment'] == '') {
$comments_format = 'new'; $comments_format = 'new';
} else { } else {
// If comments are not stored in json, the format is old. // If comments are not stored in json, the format is old.
$event_comments_array = json_decode($event_comments); $event_comments_array = json_decode($event_comments[0]['user_comment']);
if (empty($event_comments_array)) { if (empty($event_comments_array)) {
$comments_format = 'old'; $comments_format = 'old';

View File

@ -1,20 +1,30 @@
<?php <?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2009 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 Lesser General Public License
// as published by the Free Software Foundation; 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.
/** /**
* @package Include * Extension to manage a list of gateways and the node address where they should
* @subpackage UI * point to.
*
* @category Functions Update Manager
* @package Pandora FMS
* @subpackage Community
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2019 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.
* ============================================================================
*/ */
@ -988,13 +998,61 @@ function update_manger_set_deleted_message($message_id)
{ {
global $config; global $config;
$rollback = db_get_value('description', 'tupdate', 'svn_version', $message_id); $rollback = db_get_value(
'description',
'tupdate',
'svn_version',
$message_id
);
$users_read = json_decode($rollback, true); $users_read = json_decode($rollback, true);
$users_read[$config['id_user']] = 1; $users_read[$config['id_user']] = 1;
$rollback = json_encode($users_read); $rollback = json_encode($users_read);
db_process_sql_update('tupdate', ['description' => $rollback ], ['svn_version' => $message_id]); db_process_sql_update(
'tupdate',
['description' => $rollback ],
['svn_version' => $message_id]
);
// Mark as read too // Mark as read too.
update_manger_set_read_message($message_id, 1); update_manger_set_read_message($message_id, 1);
} }
/**
* Function recursive delete directory.
*
* @param string $dir Directory to delete.
* @param array $result Array result state and message.
*
* @return array Return result array with status 0 valid or 1 false and
* type 'f' file and 'd' dir and route path file or directory.
*/
function rmdir_recursive(string $dir, array &$result)
{
foreach (scandir($dir) as $file) {
if ('.' === $file || '..' === $file) {
continue;
}
if (is_dir($dir.'/'.$file) === true) {
rmdir_recursive($dir.'/'.$file, $result);
} else {
$unlink = unlink($dir.'/'.$file);
$res = [];
$res['status'] = ($unlink === true) ? 0 : 1;
$res['type'] = 'f';
$res['path'] = $dir.'/'.$file;
array_push($result, $res);
}
}
$rmdir = rmdir($dir);
$res = [];
$res['status'] = ($rmdir === true) ? 0 : 1;
$res['type'] = 'd';
$res['path'] = $dir;
array_push($result, $res);
return $result;
}

View File

@ -1,3 +1,7 @@
/*
globals $, jQuery
*/
var correct_install_progress = true; var correct_install_progress = true;
function form_upload(homeurl) { function form_upload(homeurl) {
@ -1246,11 +1250,11 @@ function check_install_package(package, homeurl) {
data: parameters, data: parameters,
dataType: "json", dataType: "json",
success: function(data) { success: function(data) {
// Print the updated files and take the scroll to the bottom // Print the updated files and take the scroll to the bottom.
$("#log_zone").html(data.info); $("#log_zone").append(data.info);
$("#log_zone").scrollTop($("#log_zone").prop("scrollHeight")); $("#log_zone").scrollTop($("#log_zone").prop("scrollHeight"));
// Change the progress bar // Change the progress bar.
if ( if (
$("#form-offline_update ul") $("#form-offline_update ul")
.find("li") .find("li")
@ -1271,14 +1275,19 @@ function check_install_package(package, homeurl) {
.trigger("change"); .trigger("change");
} }
// The class loading is present until the update ends // The class loading is present until the update ends.
var isInstalling = $("#form-offline_update ul") var isInstalling = $("#form-offline_update ul")
.find("li") .find("li")
.hasClass("loading"); .hasClass("loading");
if (data.progress < 100 && isInstalling) { if (data.progress < 100 && isInstalling) {
// Recursive call to check the update status // Recursive call to check the update status.
check_install_package(package, homeurl); check_install_package(package, homeurl);
} }
if (!isInstalling) {
//Check if exist remove files.
delete_desired_files(homeurl);
}
} }
}); });
} }
@ -2290,3 +2299,107 @@ function remove_rr_file_to_extras(homeurl) {
success: function(data) {} success: function(data) {}
}); });
} }
/**
* Function delete files desired and add extras/delete_files.txt.
*
* @param string homeurl Url.
*/
function delete_desired_files(homeurl) {
var home_url = typeof homeurl !== "undefined" ? homeurl + "/" : "";
var parameters = {
page: "include/ajax/update_manager.ajax",
delete_desired_files: 1
};
jQuery.ajax({
data: parameters,
type: "POST",
url: home_url + "ajax.php",
dataType: "json",
success: function(data) {
var translation = data.translation;
// Print the deleted files.
// Print title.
$("#log_zone").append(
"</br></br><span class='log_zone_line bolder';>" +
translation.title +
": </span></br></br>"
);
$.each(data.status_list, function(key, value) {
var log_zone_line_class = "log_zone_line ";
var msg = "";
switch (value.status) {
case -1:
//Not exits file.
msg = translation.not_file;
break;
case 0:
//File or directory deleted successfully.
if (value.type === "f") {
log_zone_line_class += "";
} else {
log_zone_line_class += "bolder";
}
msg = value.path;
break;
case 1:
//Problem delete file or directory.
if (value.type === "f") {
log_zone_line_class += "log_zone_line_error";
} else {
log_zone_line_class += "log_zone_line_error bolder";
}
msg = value.path + " ( " + translation.not_deleted + " ) ";
break;
case 2:
//Not found file or directory.
if (value.type === "f") {
log_zone_line_class += "log_zone_line_error";
} else {
log_zone_line_class += "log_zone_line_error bolder";
}
msg = value.path + " ( " + translation.not_found + " ) ";
break;
case 3:
//Don`t read file deleet_files.txt.
log_zone_line_class += "log_zone_line_error bolder";
msg = translation.not_read;
break;
case 4:
//"deleted" folder could not be created.
log_zone_line_class += "log_zone_line_error bolder";
msg = value.path + " ( " + translation.folder_deleted_f + " ) ";
break;
case 5:
//"deleted" folder was created.
log_zone_line_class += "bolder";
msg = translation.folder_deleted_t;
break;
case 6:
//The "delete files" could not be the "delete" folder.
log_zone_line_class += "log_zone_line_error bolder";
msg = value.path + " ( " + translation.move_file_f + " ) ";
break;
case 7:
//The "delete files" is moved to the "delete" folder.
log_zone_line_class += "bolder";
msg = translation.move_file_d;
break;
default:
// It can not come without state.
break;
}
//Print line.
$("#log_zone").append(
"<span class='" + log_zone_line_class + "' >" + msg + "</span><br>"
);
});
}
});
}

View File

@ -3920,7 +3920,19 @@ div.simple_value > a > span.text p {
font-size: 18pt; font-size: 18pt;
} }
span.log_zone_line {
font-size: 12px;
}
span.log_zone_line_error {
color: #fc4444;
}
/* global */ /* global */
.bolder {
font-weight: bolder;
}
.readonly { .readonly {
background-color: #dedede !important; background-color: #dedede !important;
} }

View File

@ -129,7 +129,7 @@
<div style='height: 10px'> <div style='height: 10px'>
<?php <?php
$version = '7.0NG.732'; $version = '7.0NG.732';
$build = '190313'; $build = '190320';
$banner = "v$version Build $build"; $banner = "v$version Build $build";
error_reporting(0); error_reporting(0);

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.732 %define version 7.0NG.732
%define release 190313 %define release 190320
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name httpd %define httpd_name httpd

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.732 %define version 7.0NG.732
%define release 190313 %define release 190320
%define httpd_name httpd %define httpd_name httpd
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name apache2 %define httpd_name apache2

View File

@ -1,5 +1,5 @@
package: pandorafms-server package: pandorafms-server
Version: 7.0NG.732-190313 Version: 7.0NG.732-190320
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.732-190313" pandora_version="7.0NG.732-190320"
package_cpan=0 package_cpan=0
package_pandora=1 package_pandora=1

View File

@ -45,7 +45,7 @@ our @EXPORT = qw(
# version: Defines actual version of Pandora Server for this module only # version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.732"; my $pandora_version = "7.0NG.732";
my $pandora_build = "190313"; my $pandora_build = "190320";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash # Setup hash

View File

@ -32,7 +32,7 @@ our @ISA = qw(Exporter);
# version: Defines actual version of Pandora Server for this module only # version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.732"; my $pandora_version = "7.0NG.732";
my $pandora_build = "190313"; my $pandora_build = "190320";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
our %EXPORT_TAGS = ( 'all' => [ qw() ] ); our %EXPORT_TAGS = ( 'all' => [ qw() ] );
@ -2018,6 +2018,12 @@ sub snmp_walk {
$timeout = $snmp->{timeout}; $timeout = $snmp->{timeout};
} }
if ($^O =~ /lin/i && "`which snmpwalk`" eq "") {
return {
'error' => 'snmpwalk not found'
};
}
$snmp->{extra} = '' unless defined $snmp->{extra}; $snmp->{extra} = '' unless defined $snmp->{extra};
if ( defined ($snmp->{version} ) if ( defined ($snmp->{version} )
@ -2131,6 +2137,12 @@ sub snmp_get {
$timeout = $snmp->{timeout}; $timeout = $snmp->{timeout};
} }
if ($^O =~ /lin/i && "`which snmpwalk`" eq "") {
return {
'error' => 'snmpwalk not found'
};
}
$snmp->{extra} = '' unless defined $snmp->{extra}; $snmp->{extra} = '' unless defined $snmp->{extra};
if ( defined ($snmp->{version} ) if ( defined ($snmp->{version} )

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_server %define name pandorafms_server
%define version 7.0NG.732 %define version 7.0NG.732
%define release 190313 %define release 190320
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_server %define name pandorafms_server
%define version 7.0NG.732 %define version 7.0NG.732
%define release 190313 %define release 190320
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

@ -9,7 +9,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.732" PI_VERSION="7.0NG.732"
PI_BUILD="190313" PI_BUILD="190320"
MODE=$1 MODE=$1
if [ $# -gt 1 ]; then if [ $# -gt 1 ]; then

View File

@ -34,7 +34,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB; use PandoraFMS::DB;
# version: define current version # version: define current version
my $version = "7.0NG.732 PS190313"; my $version = "7.0NG.732 PS190320";
# Pandora server configuration # Pandora server configuration
my %conf; my %conf;

View File

@ -36,7 +36,7 @@ use Encode::Locale;
Encode::Locale::decode_argv; Encode::Locale::decode_argv;
# version: define current version # version: define current version
my $version = "7.0NG.732 PS190313"; my $version = "7.0NG.732 PS190320";
# save program name for logging # save program name for logging
my $progname = basename($0); my $progname = basename($0);