diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 4eadc44d41..e2203d4d46 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,11 @@ +2014-06-09 Miguel de Dios + + * include/javascript/update_manager.js, + include/functions_update_manager.php, + include/ajax/update_manager.ajax.php, include/config_process.php: + work in the first version of new update manager. + + 2014-06-09 Miguel de Dios * include/functions_config.php, general/login_page.php: improved diff --git a/pandora_console/include/ajax/update_manager.ajax.php b/pandora_console/include/ajax/update_manager.ajax.php index dbc35ff015..2cfc76707b 100644 --- a/pandora_console/include/ajax/update_manager.ajax.php +++ b/pandora_console/include/ajax/update_manager.ajax.php @@ -21,16 +21,16 @@ enterprise_include_once("include/functions_update_manager.php"); $upload_file = (boolean) get_parameter("upload_file"); $install_package = (boolean) get_parameter("install_package"); $check_install_package = (boolean) get_parameter("check_install_package"); -$check_install_enterprise_package = (boolean) get_parameter("check_install_enterprise_package"); $check_online_packages = (boolean) get_parameter("check_online_packages"); $check_online_enterprise_packages = (boolean) get_parameter("check_online_enterprise_packages"); $update_last_package = (boolean) get_parameter("update_last_package"); $update_last_enterprise_package = (boolean) get_parameter("update_last_enterprise_package"); $install_package_online = (boolean) get_parameter("install_package_online"); -$install_enterprise_package = (boolean) get_parameter("install_enterprise_package"); $check_progress_update = (boolean) get_parameter("check_progress_update"); $check_progress_enterprise_update = (boolean) get_parameter("check_progress_enterprise_update"); $install_package_step2 = (boolean)get_parameter("install_package_step2"); +$enterprise_install_package = (boolean) get_parameter("enterprise_install_package"); +$enterprise_install_package_step2 = (boolean)get_parameter("enterprise_install_package_step2"); if ($upload_file) { ob_clean(); @@ -213,16 +213,45 @@ if ($install_package) { return; } -if ($check_install_enterprise_package) { - - check_install_enterprise_package(); - - return; - -} - if ($check_install_package) { + // 1 second + //sleep(1); + // Half second + usleep(500000); + ob_clean(); + + $package = (string) get_parameter("package"); + // All files extracted + $files_total = $package."/files.txt"; + // Number of files extracted + $files_num = $package."/files.info.txt"; + // Files copied + $files_copied = $package."/files.copied.txt"; + + $files = @file($files_copied); + if (empty($files)) + $files = array(); + $total = (int)@file_get_contents($files_num); + + $progress = 0; + if ((count($files) > 0) && ($total > 0)) { + $progress = format_numeric((count($files) / $total) * 100, 2); + if ($progress > 100) + $progress = 100; + } + + $return = array(); + $return['info'] = (string) implode("
", $files); + $return['progress'] = $progress; + + if ($progress >= 100) { + unlink($files_total); + unlink($files_num); + unlink($files_copied); + } + + echo json_encode($return); return; } @@ -252,15 +281,6 @@ if ($update_last_package) { return; } -if ($install_enterprise_package) { - $package = get_parameter('package', ''); - - update_manager_starting_enterprise_update($package, - $config['attachment_store'] . "/downloads/" . $package); - - return; -} - if ($install_package_online) { return; @@ -282,4 +302,20 @@ if ($check_progress_update) { return; } + +if ($enterprise_install_package) { + $package = get_parameter('package', ''); + + + update_manager_enterprise_starting_update($package, + $config['attachment_store'] . "/downloads/" . $package); + + return; +} + +if ($enterprise_install_package_step2) { + update_manager_install_enterprise_package_step2(); + + return; +} ?> \ No newline at end of file diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 30522bd770..bd8ee0f940 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -22,7 +22,7 @@ /** * Pandora build version and version */ -$build_version = 'PC140608'; +$build_version = 'PC140605'; $pandora_version = 'v5.1BETA1'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/include/functions_update_manager.php b/pandora_console/include/functions_update_manager.php index 436c4ac042..db951a8041 100755 --- a/pandora_console/include/functions_update_manager.php +++ b/pandora_console/include/functions_update_manager.php @@ -20,6 +20,8 @@ */ 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`', @@ -28,9 +30,14 @@ function update_manager_get_config_values() { global $build_version; global $pandora_version; + $current_update = 0; + if (isset($config['current_package'])) + $current_update = $config['current_package']; + //TO DO $license = "TESTMIGUEL00B0WAW9BU1QM0RZ2QM0MZ3QN5M41R35S5S1DP"; - $current_update = 11; + //$current_update = 11; + return array( 'license' => $license, diff --git a/pandora_console/include/javascript/update_manager.js b/pandora_console/include/javascript/update_manager.js index e1867c2cb7..f6f09614a0 100644 --- a/pandora_console/include/javascript/update_manager.js +++ b/pandora_console/include/javascript/update_manager.js @@ -249,7 +249,7 @@ function install_package (package) { function check_install_package(package) { var parameters = {}; parameters['page'] = 'include/ajax/update_manager.ajax'; - parameters['check_install_enterprise_package'] = 1; + parameters['check_install_package'] = 1; parameters['package'] = package; $.ajax({ @@ -273,7 +273,7 @@ function check_install_package(package) { var isInstalling = $('#form-offline_update ul').find('li').hasClass('loading'); if (data.progress < 100 && isInstalling) { // Recursive call to check the update status - check_install_enterprise_package(package); + check_install_package(package); } } })