diff --git a/.gitignore b/.gitignore
index 00df49dfe..51979c1a6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,6 @@
/application/config/database.php
/application/config/config.php
-/application/logs/*.php
+/application/logs/*
/application/cache/*
/uploads
/uploads/*.adi
@@ -8,7 +8,6 @@
/uploads/*.tq8
/uploads/*.TQ8
/install/.lock
-/install/log/debug.log
/updates/*.xml
/updates/*.html
/images/eqsl_card_images/*.jpg
diff --git a/install/ajax.php b/install/ajax.php
new file mode 100644
index 000000000..8c5cce181
--- /dev/null
+++ b/install/ajax.php
@@ -0,0 +1,17 @@
+
@@ -67,7 +69,7 @@ T_setlocale(LC_MESSAGES, $language);
function log_message(level, message) {
$.ajax({
type: 'POST',
- url: 'index.php',
+ url: 'ajax.php',
data: {
write_to_logfile: 1,
log_level: level,
diff --git a/install/includes/interface_assets/triggers.php b/install/includes/interface_assets/triggers.php
index 4832228dd..9d059868a 100644
--- a/install/includes/interface_assets/triggers.php
+++ b/install/includes/interface_assets/triggers.php
@@ -42,8 +42,20 @@ if ($_POST['write_to_logfile'] ?? false == true) {
*
*/
-// config_file()
+if ($_POST['check_lockfile'] ?? false == true) {
+ $lockfile = '../install/.lock';
+
+ if (file_exists($lockfile)) {
+ $result = 'installer_locked';
+ } else {
+ $result = 'no_lockfile';
+ }
+ echo $result;
+ exit;
+}
+
+// config_file()
if ($_POST['run_config_file'] ?? false == true) {
sleep(1);
$data = $_POST['data'];
diff --git a/install/index.php b/install/index.php
index 9c227356b..2e24f7c5d 100644
--- a/install/index.php
+++ b/install/index.php
@@ -323,7 +323,7 @@ if (!file_exists('.lock')) {
">
-
" class="form-control" name="websiteurl" />
+
= __("This field can't be empty and have to end with a slash 'example/'!"); ?>
@@ -1605,7 +1605,8 @@ if (!file_exists('.lock')) {
\ No newline at end of file
diff --git a/install/log/.keep b/install/log/.keep
deleted file mode 100644
index e69de29bb..000000000
diff --git a/install/run.php b/install/run.php
index 9ce9f164b..4617aa80e 100644
--- a/install/run.php
+++ b/install/run.php
@@ -38,6 +38,9 @@
= sprintf(__("All install steps went through. Redirect to user login in %s seconds..."), "4"); ?>
+
@@ -61,6 +64,8 @@
$(document).ready(async function() {
init_read_log();
try {
+ await check_lockfile();
+
await config_file();
await database_file();
await database_tables();
@@ -68,19 +73,24 @@
await update_dxcc();
await installer_lock();
- // after all install steps went through we can show a success message and redirect to the user/login
- $("#success_message").show();
+ if($('#logContainer').css('display') == 'none') {
+ // after all install steps went through we can show a success message and redirect to the user/login
+ $("#success_message").show();
- // Initialize the countdown
- var countdown = 4;
- var countdownInterval = setInterval(function() {
- countdown--;
- $("#countdown").text(countdown);
- if (countdown <= 0) {
- clearInterval(countdownInterval);
- window.location.href = _POST.websiteurl + "index.php/user/login/1";
- }
- }, 1000);
+ // Initialize the countdown
+ var countdown = 4;
+ var countdownInterval = setInterval(function() {
+ countdown--;
+ $("#countdown").text(countdown);
+ if (countdown <= 0) {
+ clearInterval(countdownInterval);
+ window.location.href = _POST.websiteurl + "index.php/user/login/1";
+ }
+ }, 1000);
+ } else {
+ // after all install steps went through we can show the redirect button
+ $("#success_button").show();
+ }
} catch (error) {
$("#error_message").text("Installation failed: " + error).show();
}
@@ -90,7 +100,7 @@
setInterval(function() {
$.ajax({
type: 'POST',
- url: 'index.php',
+ url: 'ajax.php',
data: {
read_logfile: 1
},
@@ -112,16 +122,48 @@
}
});
+ // if a user goes back to the installer we need to redirect him
+ async function check_lockfile() {
+
+ log_message('error', "Attention! Installer was called again. Let's check for a lockfile.");
+
+ return new Promise((resolve, reject) => {
+ $.ajax({
+ type: 'POST',
+ url: 'ajax.php',
+ data: {
+ check_lockfile: 1
+ },
+ success: function(response) {
+ if (response != 'installer_locked') {
+ log_message('debug', "Seems like there is no .lock file. Let's try to run the installer again.");
+ resolve();
+ } else {
+ log_message('error', 'Installer is locked. Redirect to user/login.');
+ reject(response);
+ window.location.href = "" + "index.php/user/login";
+ }
+ },
+ error: function(error) {
+ log_message('error', "Install Lock Check wen't wrong...");
+ reject(error);
+ window.location.href = "" + "index.php/user/login";
+ }
+ });
+ });
+ }
+
async function config_file() {
var field = '#config_file';
running(field, true);
+ log_message('debug', 'Start writing config.php');
return new Promise((resolve, reject) => {
$.ajax({
type: 'POST',
- url: 'index.php',
+ url: 'ajax.php',
data: {
data: _POST,
run_config_file: 1
@@ -129,13 +171,16 @@
success: function(response) {
if (response == 'success') {
running(field, false);
+ log_message('debug', 'File: config.php successfully written');
resolve();
} else {
running(field, false, true);
+ log_message('error', 'File: Could not write file. Check Permissions.');
reject("= __("Could not create application/config/config.php"); ?>");
}
},
error: function(error) {
+ log_message('error', 'File: Could not write file. Ajax failed.');
running(field, false, true);
reject(error);
}
@@ -148,11 +193,12 @@
var field = '#database_file';
running(field, true);
+ log_message('debug', 'Start writing database.php');
return new Promise((resolve, reject) => {
$.ajax({
type: 'POST',
- url: 'index.php',
+ url: 'ajax.php',
data: {
data: _POST,
run_database_file: 1
@@ -160,13 +206,16 @@
success: function(response) {
if (response == 'success') {
running(field, false);
+ log_message('debug', 'File: database.php successfully written');
resolve();
} else {
running(field, false, true);
+ log_message('error', 'File: Could not write file. Check Permissions.');
reject("= __("Could not create application/config/database.php"); ?>");
}
},
error: function(error) {
+ log_message('error', 'File: Could not write file. Ajax failed.');
running(field, false, true);
reject(error);
}
@@ -178,26 +227,30 @@
var field = '#database_tables';
running(field, true);
+ log_message('debug', 'Start creating database structure with assets/install.sql');
return new Promise((resolve, reject) => {
$.ajax({
type: 'POST',
- url: 'index.php',
+ url: 'ajax.php',
data: {
data: _POST,
run_database_tables: 1
},
success: function(response) {
if (response == 'success') {
+ log_message('debug', 'Tables successfully created');
running(field, false);
resolve();
} else {
running(field, false, true);
+ log_message('error', 'Creating database tables from assets/install.sql failed.');
reject("= __("Could not create database tables"); ?>");
}
},
error: function(error) {
running(field, false, true);
+ log_message('error', 'Creating database tables failed. Ajax crashed.');
reject(error);
}
});
@@ -208,21 +261,25 @@
var field = '#database_migrations';
running(field, true);
+ log_message('debug', 'Start migrating database to the newest version.');
return new Promise((resolve, reject) => {
$.ajax({
- url: "" + "index.php/migrate",
+ url: "" + "index.php/migrate",
success: function(response) {
if (response == 'success') {
running(field, false);
+ log_message('debug', 'Database successfully created.');
resolve();
} else {
running(field, false, true);
+ log_message('error', 'Could not migrate database.');
reject("= __("Could not run database migrations"); ?>");
}
},
error: function(error) {
running(field, false, true);
+ log_message('error', 'Could not migrate database. Ajax crashed.');
reject(error);
}
});
@@ -236,20 +293,24 @@
if(_POST.skip_dxcc_update == 0) {
running(field, true);
+ log_message('debug', 'Start updating DXCC database. This can take a moment or two... Please wait');
$.ajax({
- url: "" + "index.php/update/dxcc",
+ url: "" + "index.php/update/dxcc",
success: function(response) {
if (response == 'success') {
running(field, false);
+ log_message('debug', 'Successfully update DXCC database');
resolve();
} else {
running(field, false, true);
+ log_message('error', 'Could not update DXCC data.');
reject("= __("Could not update DXCC data"); ?>");
}
},
error: function(error) {
running(field, false, true);
+ log_message('error', 'Could not update DXCC data. Ajax crashed.');
reject(error);
}
});
@@ -262,26 +323,30 @@
async function installer_lock() {
var field = '#installer_lock';
+ log_message('debug', 'Try to create .lock file for the installer');
running(field, true);
return new Promise((resolve, reject) => {
$.ajax({
type: 'POST',
- url: 'index.php',
+ url: 'ajax.php',
data: {
run_installer_lock: 1
},
success: function(response) {
if (response == 'success') {
running(field, false);
+ log_message('debug', 'Successfully created .lock file in folder /install');
resolve();
} else {
running(field, false, true);
+ log_message('error', 'Could not create .lock file.');
reject("= __("Could not create install/.lock file"); ?>");
}
},
error: function(error) {
running(field, false, true);
+ log_message('error', 'Could not create .lock file. Ajax crashed');
reject(error);
}
});