Hopefully fixed an issue during initial setup after entering DB credentials and writing the config.php files. This was possible due to a rac condition where intially ITflow install checks to see if it can write config.php to currect directory by actually writing a config.php file then deleting it. This could sometimes interfere with the creation of the config.php file in the next step
This commit is contained in:
@@ -785,10 +785,10 @@ if (isset($_POST['add_database'])) {
|
||||
$installation_id = randomString(32);
|
||||
|
||||
// Test database connection before writing it to config.php
|
||||
try {
|
||||
mysqli_connect($host, $username, $password, $database);
|
||||
} catch (Exception $e) {
|
||||
exit("<b>Database connection failed - please check and try again</b> <br> <br> $e");
|
||||
|
||||
$conn = mysqli_connect($host, $username, $password, $database);
|
||||
if (!$conn) {
|
||||
exit("<b>Database connection failed - please check and try again</b> <br> <br>" . mysqli_connect_error());
|
||||
}
|
||||
|
||||
$new_config = "<?php\n\n";
|
||||
@@ -1323,9 +1323,6 @@ if (isset($_POST['add_telemetry'])) {
|
||||
<h3 class="card-title"><i class="fas fa-fw fa-building mr-2"></i>Company Details</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<?php if (mysqli_num_rows(mysqli_query($mysqli,"SELECT COUNT(*) FROM users")) < 0) { ?>
|
||||
Database config invalid, or users already exist in the database.
|
||||
<?php } else { ?>
|
||||
<form method="post" enctype="multipart/form-data" autocomplete="off">
|
||||
|
||||
<div class="form-group">
|
||||
@@ -1465,7 +1462,6 @@ if (isset($_POST['add_telemetry'])) {
|
||||
</button>
|
||||
|
||||
</form>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1521,12 +1517,9 @@ if (isset($_POST['add_telemetry'])) {
|
||||
<hr>
|
||||
<p class="text-muted">ITFlow is <b>free software</b>: you can redistribute and/or modify it under the terms of the <a href="https://www.gnu.org/licenses/gpl-3.0.en.html" target="_blank">GNU General Public License</a>. <br> It is distributed in the hope that it will be useful, but <b>without any warranty</b>; without even the implied warranty of merchantability or fitness for a particular purpose.</p>
|
||||
<?php
|
||||
// Check that there is access to write config.php
|
||||
if (!file_put_contents("config.php", "Test")) {
|
||||
echo "<div class='alert alert-danger'>Warning: config.php is not writable. Ensure the webserver process has write access (chmod/chown). Check the <a href='https://docs.itflow.org/installation#ubuntu_setup_guide'>docs</a> for info.</div>";
|
||||
} else {
|
||||
// Else, able to write. Tidy up
|
||||
unlink("config.php");
|
||||
// Check that there is access to write to the current directory
|
||||
if (!is_writable('.')) {
|
||||
echo "<div class='alert alert-danger'>Warning: The current directory is not writable. Ensure the webserver process has write access (chmod/chown). Check the <a href='https://docs.itflow.org/installation#ubuntu_setup_guide'>docs</a> for info.</div>";
|
||||
}
|
||||
?>
|
||||
<hr>
|
||||
|
||||
Reference in New Issue
Block a user