Improve installation console, fix dynamic settings file update
This commit is contained in:
parent
90605ed8c2
commit
75168b5026
@ -119,8 +119,16 @@ function printRow($version) {
|
||||
<div class="col-sm-12">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">Console</div>
|
||||
<div class="panel-body" style="min-height: 400px;max-height: 400px; overflow: auto;">
|
||||
<p id="console-text" style="font-family: 'Courier New',monospace;"></p>
|
||||
<div style="max-height: 400px; overflow: auto;">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Severity</th>
|
||||
<th>Message</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="consoleBody"></tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -17,11 +17,12 @@ function startVersionUpgrade(version) {
|
||||
changeTextTo('span', version, 'In Progress');
|
||||
}
|
||||
|
||||
function markUpdateAsSuccess(version) {
|
||||
function markUpdateAsSuccess(version, formattedVersion) {
|
||||
removeSpinner(version);
|
||||
$('#spinner-'+version).addClass('fa-check-circle');
|
||||
changeTextTo('span', version, 'Completed Successfully');
|
||||
changeRowTo('row', version, 'success');
|
||||
appendToInstallConsole('<tr><td><span class="label label-success">SUCCESS</span></td><td>Updates for ' + formattedVersion + ' complete</td></tr>');
|
||||
}
|
||||
|
||||
function removeSpinner(version) {
|
||||
@ -61,11 +62,11 @@ function changeRowTo(prefix, version, clazz) {
|
||||
}
|
||||
|
||||
function appendToInstallConsole(text) {
|
||||
var currentText = $('#console-text').text();
|
||||
$('#console-text').append(text).append('<br>');
|
||||
$('#consoleBody').append(text);
|
||||
}
|
||||
|
||||
function installationFinished() {
|
||||
appendToInstallConsole('<tr><td><span class="label label-success">SUCCESS</span></td><td>Installation complete</td></tr>');
|
||||
var output = '<div class="panel-body">' +
|
||||
'<div class="col-md-12 text-center">' +
|
||||
'<i class="fa fa-check-circle fa-4x" style="color: #008000"></i><br><br>' +
|
||||
|
@ -1,52 +1,53 @@
|
||||
function processUpdates(startingVersion) {
|
||||
if (startingVersion < 1) {
|
||||
startVersionUpgrade('p140');
|
||||
executeUpdate(1, 'p140');
|
||||
executeUpdate(1, 'p140', 'Pre 1.4.0');
|
||||
} else if (startingVersion < 140) {
|
||||
startVersionUpgrade('140');
|
||||
executeUpdate(140, '140');
|
||||
executeUpdate(140, '140', '1.4.0');
|
||||
} else if (startingVersion < 141) {
|
||||
startVersionUpgrade('141');
|
||||
executeUpdate(141, '141');
|
||||
executeUpdate(141, '141', '1.4.1');
|
||||
} else if (startingVersion < 150) {
|
||||
startVersionUpgrade('150');
|
||||
executeUpdate(150, '150');
|
||||
executeUpdate(150, '150', '1.5.0');
|
||||
} else if (startingVersion < 160) {
|
||||
startVersionUpgrade('160');
|
||||
executeUpdate(160, '160');
|
||||
executeUpdate(160, '160', '1.6.0');
|
||||
} else if (startingVersion < 161) {
|
||||
startVersionUpgrade('161');
|
||||
executeUpdate(161, '161');
|
||||
executeUpdate(161, '161', '1.6.1');
|
||||
} else if (startingVersion < 170) {
|
||||
startVersionUpgrade('170');
|
||||
executeUpdate(170, '170');
|
||||
executeUpdate(170, '170', '1.7.0');
|
||||
} else if (startingVersion < 200) {
|
||||
startVersionUpgrade('200');
|
||||
executeUpdate(200, '200');
|
||||
executeUpdate(200, '200', '2.0.0');
|
||||
} else if (startingVersion < 201) {
|
||||
startVersionUpgrade('201');
|
||||
executeUpdate(201, '201');
|
||||
executeUpdate(201, '201', '2.0.1');
|
||||
} else {
|
||||
installationFinished();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function executeUpdate(version, cssclass) {
|
||||
function executeUpdate(version, cssclass, formattedVersion) {
|
||||
appendToInstallConsole('<tr><td><span class="label label-info">INFO</span></td><td>Starting updates for ' + formattedVersion + '</td></tr>');
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'ajax/database-ajax.php',
|
||||
data: { version: version },
|
||||
success: function(data) {
|
||||
|
||||
markUpdateAsSuccess(cssclass);
|
||||
markUpdateAsSuccess(cssclass, formattedVersion);
|
||||
if (version == 200) {
|
||||
migrateIpEmailBans('banmigrate', cssclass);
|
||||
} else {
|
||||
processUpdates(version);
|
||||
}
|
||||
processUpdates(version);
|
||||
},
|
||||
error: function(data) {
|
||||
appendToInstallConsole('ERROR: ' + data.responseText);
|
||||
appendToInstallConsole('<tr><td><span class="label label-danger">ERROR</span></td><td>'+ data.responseText + '</td></tr>');
|
||||
markUpdateAsFailure(cssclass);
|
||||
}
|
||||
});
|
||||
@ -54,6 +55,7 @@ function executeUpdate(version, cssclass) {
|
||||
|
||||
function migrateIpEmailBans(version, cssclass) {
|
||||
startVersionUpgrade(version);
|
||||
appendToInstallConsole('<tr><td><span class="label label-info">INFO</span></td><td>Checking for IP / Email address bans to migrate</td></tr>');
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'ajax/task-ajax.php',
|
||||
@ -62,6 +64,7 @@ function migrateIpEmailBans(version, cssclass) {
|
||||
var parsedData = $.parseJSON(data);
|
||||
console.info(parsedData);
|
||||
if (parsedData.status == 'ATTENTION') {
|
||||
appendToInstallConsole('<tr><td><span class="label label-warning">WARNING</span></td><td>Your response is needed. Please check above.</td></tr>');
|
||||
markUpdateAsAttention(version);
|
||||
prepareAttentionPanel(getContentForMigratePrompt(parsedData.users));
|
||||
} else {
|
||||
@ -69,7 +72,7 @@ function migrateIpEmailBans(version, cssclass) {
|
||||
}
|
||||
},
|
||||
error: function(data) {
|
||||
appendToInstallConsole('ERROR: ' + data.responseText);
|
||||
appendToInstallConsole('<tr><td><span class="label label-danger">ERROR</span></td><td>' + data.responseText + '</td></tr>');
|
||||
markUpdateAsFailure(cssclass);
|
||||
}
|
||||
});
|
||||
@ -98,7 +101,7 @@ function runMigration() {
|
||||
|
||||
function migrateComplete() {
|
||||
$('#attention-row').hide();
|
||||
markUpdateAsSuccess('banmigrate');
|
||||
markUpdateAsSuccess('banmigrate', 'IP and Email address bans');
|
||||
processUpdates(200);
|
||||
}
|
||||
|
||||
|
@ -216,7 +216,7 @@ function execute170FileUpdate() {
|
||||
$file = file_get_contents(HESK_PATH . 'modsForHesk_settings.inc.php');
|
||||
|
||||
//-- Only add the additional settings if they aren't already there.
|
||||
if (strpos($file, 'custom_field_setting') !== true)
|
||||
if (strpos($file, 'custom_field_setting') === false)
|
||||
{
|
||||
$file .= '
|
||||
|
||||
@ -255,7 +255,7 @@ function execute200FileUpdate() {
|
||||
$file = file_get_contents(HESK_PATH . 'modsForHesk_settings.inc.php');
|
||||
|
||||
//-- Only add the additional settings if they aren't already there.
|
||||
if (strpos($file, 'html_emails') !== true)
|
||||
if (strpos($file, 'html_emails') === false)
|
||||
{
|
||||
$file .= '
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user