Added mr to um menu (online open and enterprise). Ticket #510
This commit is contained in:
parent
b5168928e8
commit
44ac96ae5e
|
@ -36,6 +36,7 @@ $check_online_free_packages = (bool)get_parameter('check_online_free_packages');
|
|||
$update_last_free_package = (bool)get_parameter('update_last_free_package');
|
||||
$check_update_free_package = (bool)get_parameter('check_update_free_package');
|
||||
$install_free_package = (bool)get_parameter('install_free_package');
|
||||
$search_minor = (bool)get_parameter('search_minor');
|
||||
|
||||
if ($upload_file) {
|
||||
ob_clean();
|
||||
|
@ -345,6 +346,21 @@ if ($check_online_free_packages) {
|
|||
return;
|
||||
}
|
||||
|
||||
if ($search_minor) {
|
||||
$have_minor_releases = db_check_minor_relase_available();
|
||||
|
||||
$return['have_minor'] = false;
|
||||
if ($have_minor_releases) {
|
||||
$return['have_minor'] = true;
|
||||
$size_mr = get_number_of_mr();
|
||||
$return['mr'] = $size_mr;
|
||||
}
|
||||
|
||||
echo json_encode($return);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ($update_last_free_package) {
|
||||
$package = get_parameter('package', '');
|
||||
$version = get_parameter('version', '');
|
||||
|
@ -352,101 +368,92 @@ if ($update_last_free_package) {
|
|||
$package_url = base64_decode($package);
|
||||
|
||||
if ($accept) {
|
||||
$have_minor_releases = db_check_minor_relase_available();
|
||||
$params = array('action' => 'get_package',
|
||||
'license' => $license,
|
||||
'limit_count' => $users,
|
||||
'current_package' => $current_package,
|
||||
'package' => $package,
|
||||
'version' => $config['version'],
|
||||
'build' => $config['build']);
|
||||
|
||||
$curlObj = curl_init();
|
||||
curl_setopt($curlObj, CURLOPT_URL, $package_url);
|
||||
curl_setopt($curlObj, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($curlObj, CURLOPT_FOLLOWLOCATION, true);
|
||||
curl_setopt($curlObj, CURLOPT_SSL_VERIFYPEER, false);
|
||||
if (isset($config['update_manager_proxy_server'])) {
|
||||
curl_setopt($curlObj, CURLOPT_PROXY, $config['update_manager_proxy_server']);
|
||||
}
|
||||
if (isset($config['update_manager_proxy_port'])) {
|
||||
curl_setopt($curlObj, CURLOPT_PROXYPORT, $config['update_manager_proxy_port']);
|
||||
}
|
||||
if (isset($config['update_manager_proxy_user'])) {
|
||||
curl_setopt($curlObj, CURLOPT_PROXYUSERPWD, $config['update_manager_proxy_user'] . ':' . $config['update_manager_proxy_password']);
|
||||
}
|
||||
|
||||
$result = curl_exec($curlObj);
|
||||
$http_status = curl_getinfo($curlObj, CURLINFO_HTTP_CODE);
|
||||
|
||||
curl_close($curlObj);
|
||||
|
||||
if ($have_minor_releases) {
|
||||
|
||||
if (empty($result)) {
|
||||
echo json_encode(array(
|
||||
'in_progress' => false,
|
||||
'message' => __('Fail to update to the last package.')));
|
||||
}
|
||||
else {
|
||||
$params = array('action' => 'get_package',
|
||||
'license' => $license,
|
||||
'limit_count' => $users,
|
||||
'current_package' => $current_package,
|
||||
'package' => $package,
|
||||
'version' => $config['version'],
|
||||
'build' => $config['build']);
|
||||
file_put_contents(
|
||||
$config['attachment_store'] . "/downloads/last_package.tgz" , $result);
|
||||
|
||||
$curlObj = curl_init();
|
||||
//curl_setopt($curlObj, CURLOPT_URL, $config['url_updatemanager']);
|
||||
curl_setopt($curlObj, CURLOPT_URL, $package_url);
|
||||
curl_setopt($curlObj, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($curlObj, CURLOPT_FOLLOWLOCATION, true);
|
||||
//curl_setopt($curlObj, CURLOPT_POST, true);
|
||||
//curl_setopt($curlObj, CURLOPT_POSTFIELDS, $params);
|
||||
curl_setopt($curlObj, CURLOPT_SSL_VERIFYPEER, false);
|
||||
if (isset($config['update_manager_proxy_server'])) {
|
||||
curl_setopt($curlObj, CURLOPT_PROXY, $config['update_manager_proxy_server']);
|
||||
}
|
||||
if (isset($config['update_manager_proxy_port'])) {
|
||||
curl_setopt($curlObj, CURLOPT_PROXYPORT, $config['update_manager_proxy_port']);
|
||||
}
|
||||
if (isset($config['update_manager_proxy_user'])) {
|
||||
curl_setopt($curlObj, CURLOPT_PROXYUSERPWD, $config['update_manager_proxy_user'] . ':' . $config['update_manager_proxy_password']);
|
||||
}
|
||||
echo json_encode(array(
|
||||
'in_progress' => true,
|
||||
'message' => __('Starting to update to the last package.')));
|
||||
|
||||
$result = curl_exec($curlObj);
|
||||
$http_status = curl_getinfo($curlObj, CURLINFO_HTTP_CODE);
|
||||
|
||||
curl_close($curlObj);
|
||||
|
||||
if (empty($result)) {
|
||||
echo json_encode(array(
|
||||
'in_progress' => false,
|
||||
'message' => __('Fail to update to the last package.')));
|
||||
$progress_update_status = db_get_value(
|
||||
'value', 'tconfig', 'token', 'progress_update_status');
|
||||
|
||||
|
||||
|
||||
if (empty($progress_update_status)) {
|
||||
db_process_sql_insert('tconfig',
|
||||
array(
|
||||
'value' => 0,
|
||||
'token' => 'progress_update')
|
||||
);
|
||||
|
||||
db_process_sql_insert('tconfig',
|
||||
array(
|
||||
'value' => json_encode(
|
||||
array(
|
||||
'status' => 'in_progress',
|
||||
'message' => ''
|
||||
)),
|
||||
'token' => 'progress_update_status')
|
||||
);
|
||||
}
|
||||
else {
|
||||
file_put_contents(
|
||||
$config['attachment_store'] . "/downloads/last_package.tgz" , $result);
|
||||
db_process_sql_update('tconfig',
|
||||
array('value' => 0),
|
||||
array('token' => 'progress_update'));
|
||||
|
||||
echo json_encode(array(
|
||||
'in_progress' => true,
|
||||
'message' => __('Starting to update to the last package.')));
|
||||
|
||||
|
||||
$progress_update_status = db_get_value(
|
||||
'value', 'tconfig', 'token', 'progress_update_status');
|
||||
|
||||
|
||||
|
||||
if (empty($progress_update_status)) {
|
||||
db_process_sql_insert('tconfig',
|
||||
array(
|
||||
'value' => 0,
|
||||
'token' => 'progress_update')
|
||||
);
|
||||
|
||||
db_process_sql_insert('tconfig',
|
||||
array(
|
||||
'value' => json_encode(
|
||||
array(
|
||||
'status' => 'in_progress',
|
||||
'message' => ''
|
||||
)),
|
||||
'token' => 'progress_update_status')
|
||||
);
|
||||
}
|
||||
else {
|
||||
db_process_sql_update('tconfig',
|
||||
array('value' => 0),
|
||||
array('token' => 'progress_update'));
|
||||
|
||||
db_process_sql_update('tconfig',
|
||||
array('value' => json_encode(
|
||||
array(
|
||||
'status' => 'in_progress',
|
||||
'message' => ''
|
||||
)
|
||||
db_process_sql_update('tconfig',
|
||||
array('value' => json_encode(
|
||||
array(
|
||||
'status' => 'in_progress',
|
||||
'message' => ''
|
||||
)
|
||||
),
|
||||
array('token' => 'progress_update_status'));
|
||||
}
|
||||
)
|
||||
),
|
||||
array('token' => 'progress_update_status'));
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
echo json_encode(array(
|
||||
'in_progress' => false,
|
||||
'message' => __('Package not accepted.')));
|
||||
$return["in_progress"] = false;
|
||||
$return["message"] = __("Package not accepted.");
|
||||
|
||||
echo json_encode($return);
|
||||
}
|
||||
|
||||
return;
|
||||
|
|
|
@ -311,31 +311,114 @@ function update_last_package(package, version, homeurl) {
|
|||
|
||||
var parameters = {};
|
||||
parameters['page'] = 'include/ajax/update_manager.ajax';
|
||||
parameters['update_last_free_package'] = 1;
|
||||
parameters['package'] = package;
|
||||
parameters['version'] = version;
|
||||
parameters['accept'] = 1;
|
||||
parameters['search_minor'] = 1;
|
||||
|
||||
jQuery.post(
|
||||
home_url + "ajax.php",
|
||||
parameters,
|
||||
function (data) {
|
||||
if (data['in_progress']) {
|
||||
$("#box_online .loading").hide();
|
||||
$("#box_online .download_package").hide();
|
||||
$("#box_online .loading").hide();
|
||||
$("#box_online .downloading_package").hide();
|
||||
|
||||
if (data['have_minor']) {
|
||||
$("<div id='mr_dialog2' class='dialog ui-dialog-content' title='Menor release available'></div>").dialog ({
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
background: 'black'
|
||||
},
|
||||
width: 600,
|
||||
height: 350,
|
||||
buttons: {
|
||||
"Apply minor releases": function () {
|
||||
var no_error = apply_minor_release(data['mr']);
|
||||
|
||||
if (no_error) {
|
||||
var parameters2 = {};
|
||||
parameters2['page'] = 'include/ajax/update_manager.ajax';
|
||||
parameters2['update_last_free_package'] = 1;
|
||||
parameters2['package'] = package;
|
||||
parameters2['version'] = version;
|
||||
parameters2['accept'] = 1;
|
||||
|
||||
jQuery.post(
|
||||
home_url + "ajax.php",
|
||||
parameters2,
|
||||
function (data) {
|
||||
if (data['in_progress']) {
|
||||
$("#box_online .loading").hide();
|
||||
$("#box_online .download_package").hide();
|
||||
|
||||
$("#box_online .content").html(data['message']);
|
||||
|
||||
install_free_package(package, version, homeurl);
|
||||
setTimeout(function () {
|
||||
check_progress_update(homeurl);
|
||||
}, 1000);
|
||||
}
|
||||
else {
|
||||
$("#box_online .content").html(data['message']);
|
||||
}
|
||||
},
|
||||
"json"
|
||||
);
|
||||
}
|
||||
else {
|
||||
$("#box_online .content").html("Error in MR file");
|
||||
}
|
||||
},
|
||||
"Cancel": function () {
|
||||
$(this).dialog("close");
|
||||
$("#box_online .loading").hide();
|
||||
$("#box_online .downloading_package").hide();
|
||||
$("#box_online .content").html("MR not accepted");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$('button:contains(Apply minor releases)').attr("id","apply_rr_button");
|
||||
$('button:contains(Cancel)').attr("id","cancel_rr_button");
|
||||
|
||||
$("#box_online .content").html(data['message']);
|
||||
var dialog_text = "<div><h3>Do you want to apply minor releases?</h3></br>";
|
||||
dialog_text = dialog_text + "<h2>We recommend launch a planned downtime to this process</h2></br>";
|
||||
dialog_text = dialog_text + "<a href=\"<?php echo $config['homeurl']; ?>index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list\">Planned downtimes</a></div>"
|
||||
|
||||
install_free_package(package, version, homeurl);
|
||||
setTimeout(function () {
|
||||
check_progress_update(homeurl);
|
||||
}, 1000);
|
||||
$('#mr_dialog2').html(dialog_text);
|
||||
$('#mr_dialog2').dialog('open');
|
||||
}
|
||||
else {
|
||||
$("#box_online .content").html(data['message']);
|
||||
var parameters2 = {};
|
||||
parameters2['page'] = 'include/ajax/update_manager.ajax';
|
||||
parameters2['update_last_free_package'] = 1;
|
||||
parameters2['package'] = package;
|
||||
parameters2['version'] = version;
|
||||
parameters2['accept'] = 1;
|
||||
|
||||
jQuery.post(
|
||||
home_url + "ajax.php",
|
||||
parameters2,
|
||||
function (data) {
|
||||
if (data['in_progress']) {
|
||||
$("#box_online .loading").hide();
|
||||
$("#box_online .download_package").hide();
|
||||
|
||||
$("#box_online .content").html(data['message']);
|
||||
|
||||
install_free_package(package, version, homeurl);
|
||||
setTimeout(function () {
|
||||
check_progress_update(homeurl);
|
||||
}, 1000);
|
||||
}
|
||||
else {
|
||||
$("#box_online .content").html(data['message']);
|
||||
}
|
||||
},
|
||||
"json"
|
||||
);
|
||||
}
|
||||
},
|
||||
"json"
|
||||
}
|
||||
);
|
||||
},
|
||||
"Cancel": function () {
|
||||
|
@ -465,4 +548,47 @@ function install_free_package(package, version, homeurl) {
|
|||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function apply_minor_release (n_mr) {
|
||||
var error = false;
|
||||
$("#apply_rr_button").remove();
|
||||
$("#cancel_rr_button").remove();
|
||||
$('#mr_dialog2').empty();
|
||||
$.each(n_mr, function(i, mr) {
|
||||
var params = {};
|
||||
params["updare_rr"] = 1;
|
||||
params["number"] = mr;
|
||||
params["page"] = "include/ajax/rolling_release.ajax";
|
||||
|
||||
jQuery.ajax ({
|
||||
data: params,
|
||||
async: false,
|
||||
dataType: "html",
|
||||
type: "POST",
|
||||
url: "ajax.php",
|
||||
success: function (data) {
|
||||
if (data != "") {
|
||||
$('#mr_dialog2').empty();
|
||||
$('#mr_dialog2').html("<h2>" + data + "</h2>");
|
||||
error = true;
|
||||
}
|
||||
else {
|
||||
$('#mr_dialog2').append("<p>- Applying DB MR #" + mr + "</p>");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (error) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
if (error) {
|
||||
return false;
|
||||
}
|
||||
else{
|
||||
$('#mr_dialog2').append("<h2>Updated finished successfully</h2>");
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -465,50 +465,6 @@ if (! isset ($config['id_user'])) {
|
|||
if ($PHPmemory_limit < $PHPmemory_limit_min && $PHPmemory_limit !== '-1') {
|
||||
ini_set('memory_limit', config_return_in_bytes('500M'));
|
||||
}
|
||||
/* MINOR RELEASE -- Arturo --
|
||||
$have_minor_releases = db_check_minor_relase_available();
|
||||
|
||||
if ($have_minor_releases) {
|
||||
$size_mr = get_number_of_mr();
|
||||
echo "<div class= 'dialog ui-dialog-content' title='".__("Minor release available")."' id='mr_dialog2'>" . __('') . "</div>";
|
||||
?>
|
||||
<script type="text/javascript" language="javascript">
|
||||
$(document).ready (function () {;
|
||||
$('#mr_dialog2').dialog ({
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
background: 'black'
|
||||
},
|
||||
width: 600,
|
||||
height: 350,
|
||||
buttons: {
|
||||
"Apply minor releases": function () {
|
||||
var n_mr = '<?php echo implode(",", $size_mr);?>';
|
||||
apply_minor_release(n_mr.split(","));
|
||||
},
|
||||
"Cancel": function () {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$('button:contains(Apply minor releases)').attr("id","apply_rr_button");
|
||||
$('button:contains(Cancel)').attr("id","cancel_rr_button");
|
||||
|
||||
var dialog_text = "<div><h3>Do you want to apply minor releases?</h3></br>";
|
||||
dialog_text = dialog_text + "<h2>We recommend launch a planned downtime to this process</h2></br>";
|
||||
dialog_text = dialog_text + "<a href=\"<?php echo $config['homeurl']; ?>index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list\">Planned downtimes</a></div>"
|
||||
|
||||
$('#mr_dialog2').html(dialog_text);
|
||||
$('#mr_dialog2').dialog('open');
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
*/
|
||||
|
||||
set_time_limit((int)$PHPmax_execution_time);
|
||||
ini_set('upload_max_filesize', $PHPupload_max_filesize);
|
||||
|
@ -976,50 +932,6 @@ require('include/php_to_js_values.php');
|
|||
return rv;
|
||||
};
|
||||
})();
|
||||
|
||||
/* MINOR RELEASE -- Arturo --
|
||||
function apply_minor_release (n_mr) {
|
||||
var error = false;
|
||||
$("#apply_rr_button").remove();
|
||||
$("#cancel_rr_button").text("Close");
|
||||
$('#mr_dialog2').empty();
|
||||
$('#mr_dialog2').append("<img id=\"rr_image\" src=\"<?php echo $config['homeurl'] . 'images/spinner.gif'; ?>\">");
|
||||
$.each(n_mr, function(i, mr) {
|
||||
var params = {};
|
||||
params["updare_rr"] = 1;
|
||||
params["number"] = mr;
|
||||
params["page"] = "include/ajax/rolling_release.ajax";
|
||||
|
||||
jQuery.ajax ({
|
||||
data: params,
|
||||
async: false,
|
||||
dataType: "html",
|
||||
type: "POST",
|
||||
url: "ajax.php",
|
||||
success: function (data) {
|
||||
if (data != "") {
|
||||
$('#mr_dialog2').empty();
|
||||
$('#mr_dialog2').html("<h2>" + data + "</h2>");
|
||||
error = true;
|
||||
}
|
||||
else {
|
||||
$('#mr_dialog2').append("<p>- Applying DB MR #" + mr + "</p>");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (error) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$('#rr_image').remove();
|
||||
|
||||
if (!error) {
|
||||
$('#mr_dialog2').append("<h2>Updated finished successfully</h2>");
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
function force_run_register () {
|
||||
run_identification_wizard (1, 0, 0);
|
||||
|
|
Loading…
Reference in New Issue