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