2014-06-26 Miguel de Dios <miguel.dedios@artica.es>

* godmode/update_manager/update_manager.offline.php,
	godmode/update_manager/update_manager.online.php,
	include/functions_update_manager.php,
	include/ajax/update_manager.ajax.php,
	include/javascript/update_manager.js: a lot of fixes into the update
	manager.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10293 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2014-06-26 15:00:43 +00:00
parent b1cce886b8
commit 64438e287f
6 changed files with 102 additions and 31 deletions

View File

@ -1,3 +1,12 @@
2014-06-26 Miguel de Dios <miguel.dedios@artica.es>
* godmode/update_manager/update_manager.offline.php,
godmode/update_manager/update_manager.online.php,
include/functions_update_manager.php,
include/ajax/update_manager.ajax.php,
include/javascript/update_manager.js: a lot of fixes into the update
manager.
2014-06-26 Vanessa Gil <vanessa.gil@artica.es>
* include/languages/ar.mo

View File

@ -24,7 +24,7 @@ ui_require_css_file('update_manager', 'godmode/update_manager/');
echo "var drop_the_package_here_or ='" . __('Drop the package here or') . "';\n";
echo "var browse_it ='" . __('browse it') . "';\n";
echo "var the_package_has_been_uploaded_successfully ='" . __('The package has been uploaded successfully.') . "';\n";
echo "var remember_that_this_package_will ='" . __('Remember that this package will override the actual Pandora FMS files and it is recommended to do a backup before continue with the update.') . "';\n";
echo "var remember_that_this_package_will =\"" . __('Remember that this package will override the actual Pandora FMS files and it is recommended to do a backup before continue with the update.') . "\";\n";
echo "var click_on_the_file_below_to_begin ='" . __('Click on the file below to begin.') . "';\n";
echo "var updating ='" . __('Updating') . "';\n";
echo "var package_updated_successfully ='" . __('Package updated successfully.') . "';\n";

View File

@ -20,13 +20,30 @@ ui_require_css_file('update_manager', 'godmode/update_manager/');
require_once("include/functions_update_manager.php");
enterprise_include_once("include/functions_update_manager.php");
$current_package = 0;
if (isset($config['current_package']))
$current_package = $config['current_package'];
if (enterprise_installed()) {
$current_package = 0;
if (isset($config['current_package_enterprise']))
$current_package = $config['current_package_enterprise'];
}
else {
$current_package = 0;
if (isset($config['current_package']))
$current_package = $config['current_package'];
}
echo "<p><b>" . sprintf(__("The last version of package installed is: %d"),
$current_package) . "</b></p>";
$memory_limit = ini_get("memory_limit");
$memory_limit = str_replace("M", "", $memory_limit);
$memory_limit = (int)$memory_limit;
if ($memory_limit < 512) {
ui_print_error_message(
sprintf(__('Your PHP has set memory limit in %s. For avoid problems with big updates please set to 512M'), ini_get("memory_limit"))
);
}
/* Translators: Do not translade Update Manager, it's the name of the program */
ui_print_info_message(
'<p>' .

View File

@ -16,6 +16,7 @@
global $config;
require_once("include/functions_update_manager.php");
require_once("include/functions_graph.php");
enterprise_include_once("include/functions_update_manager.php");
$upload_file = (boolean) get_parameter("upload_file");

View File

@ -21,18 +21,33 @@
function update_manager_get_config_values() {
global $config;
$license = db_get_value('`value`', 'tupdate_settings', '`key`',
'customer_key');
$current_update = db_get_value('`value`', 'tupdate_settings', '`key`',
'current_update');
$limit_count = db_get_value_sql("SELECT count(*) FROM tagente");
global $build_version;
global $pandora_version;
$current_update = 0;
if (isset($config['current_package']))
$current_update = $config['current_package'];
$license = db_get_value('`value`', 'tupdate_settings', '`key`',
'customer_key');
if (enterprise_installed()) {
$current_update = db_get_value('`value`', 'tupdate_settings', '`key`',
'current_package_enterprise');
$current_update = 0;
if (isset($config['current_package_enterprise']))
$current_update = $config['current_package_enterprise'];
}
else {
$current_update = db_get_value('`value`', 'tupdate_settings', '`key`',
'current_package');
$current_update = 0;
if (isset($config['current_package']))
$current_update = $config['current_package'];
}
$limit_count = db_get_value_sql("SELECT count(*) FROM tagente");
@ -194,6 +209,12 @@ function update_manager_main() {
global $config;
?>
<script type="text/javascript">
<?php
echo "var unknown_error_update_manager = \"" .
__('There is a unknown error.') . "\";";
?>
</script>
<script src="include/javascript/update_manager.js"></script>
<script type="text/javascript">
var version_update = "";
@ -267,6 +288,11 @@ function update_manager_check_online_free_packages ($is_ajax=true) {
'build' => $um_config_values['build']);
//For to test in the shell
/*
wget https://artica.es/pandoraupdate51/server.php -O- --no-check-certificate --post-data "action=newest_package&license=PANDORA_FREE&limit_count=1&current_package=1&version=v5.1RC1&build=PC140625"
*/
$curlObj = curl_init();
curl_setopt($curlObj, CURLOPT_URL, $config['url_update_manager']);
curl_setopt($curlObj, CURLOPT_RETURNTRANSFER, 1);
@ -337,7 +363,7 @@ function update_manager_starting_update() {
try {
$phar = new PharData($path_package);
rrmdir($config['attachment_store'] . "/downloads/temp_update/trunk");
rrmdir($config['attachment_store'] . "/downloads/temp_update/pandora_console");
$phar->extractTo($config['attachment_store'] . "/downloads/temp_update");
}
catch (Exception $e) {
@ -358,7 +384,7 @@ function update_manager_starting_update() {
array('value' => 50),
array('token' => 'progress_update'));
$full_path = $config['attachment_store'] . "/downloads/temp_update/trunk";
$full_path = $config['attachment_store'] . "/downloads/temp_update/pandora_console";
$homedir = $config['homedir'];

View File

@ -1,3 +1,5 @@
var correct_install_progress = true;
function form_upload () {
//Thanks to: http://tutorialzine.com/2013/05/mini-ajax-file-upload-form/
var ul = $('#form-offline_update ul');
@ -365,7 +367,8 @@ function check_progress_update() {
}
}
else {
//$("#box_online .content").html(data['message']);
correct_install_progress = false;
$("#box_online .content").html(data['message']);
}
},
"json"
@ -379,23 +382,38 @@ function install_free_package(package,version) {
parameters['package'] = package;
parameters['version'] = version;
jQuery.post(
"ajax.php",
parameters,
function (data) {
if (data["status"] == "success") {
$("#box_online .loading").hide();
$("#box_online .progressbar").hide();
$("#box_online .content").html(data['message']);
stop_check_progress = 1;
jQuery.ajax ({
data: parameters,
type: 'POST',
url: "ajax.php",
timeout: 600000,
dataType: "json",
error: function(data) {
correct_install_progress = false;
stop_check_progress = 1;
$("#box_online .loading").hide();
$("#box_online .progressbar").hide();
$("#box_online .content").html(unknown_error_update_manager);
},
success: function (data) {
if (correct_install_progress) {
if (data["status"] == "success") {
$("#box_online .loading").hide();
$("#box_online .progressbar").hide();
$("#box_online .content").html(data['message']);
stop_check_progress = 1;
}
else {
$("#box_online .loading").hide();
$("#box_online .progressbar").hide();
$("#box_online .content").html(data['message']);
stop_check_progress = 1;
}
}
else {
$("#box_online .loading").hide();
$("#box_online .progressbar").hide();
$("#box_online .content").html(data['message']);
stop_check_progress = 1;
}
},
"json"
);
}
});
}