mirror of
https://github.com/postfixadmin/postfixadmin.git
synced 2024-09-20 03:36:20 +02:00
improve setup.php to apply database updates and avoid deadlock with not being able to login - see https://github.com/postfixadmin/postfixadmin/issues/494
This commit is contained in:
parent
93f38e659b
commit
ba17fbe6d6
@ -334,23 +334,29 @@ EOF;
|
||||
<h2 class="h2">Database Update</h2>
|
||||
|
||||
<?php
|
||||
if ($authenticated) {
|
||||
$db = false;
|
||||
try {
|
||||
$db = db_connect();
|
||||
} catch (\Exception $e) {
|
||||
error_log("Couldn't perform PostfixAdmin database update - " . $e->getMessage());
|
||||
echo "<p class='h3 text-danger'>Something went wrong while trying to connect to the database. A message should be logged - check PHP's error_log (" . ini_get('error_log') . ')</p>\n';
|
||||
error_log("Couldn't perform PostfixAdmin database update - failed to connect to db? " . $e->getMessage() . " Trace: " . $e->getTraceAsString());
|
||||
}
|
||||
|
||||
if ($db) {
|
||||
print "<p>Everything seems fine... attempting to create/update database structure</p>\n";
|
||||
require_once(dirname(__FILE__) . '/upgrade.php');
|
||||
echo "<p>Everything seems fine... attempting to create/update database structure</p>\n";
|
||||
try {
|
||||
require_once(dirname(__FILE__) . '/upgrade.php');
|
||||
}
|
||||
catch(\Exception $e) {
|
||||
if($authenticated) {
|
||||
echo "<p class='h3 text-danger'>Exception message: {$e->getMessage()} - check logs!</p>";
|
||||
}
|
||||
echo "<p class='h3 text-danger'>Something went wrong while trying to apply database updates, a message should be logged - check PHP's error_log (" . ini_get('error_log') . ')</p>\n';
|
||||
error_log("Couldn't perform PostfixAdmin database update via upgrade.php - " . $e->getMessage() . " Trace: " . $e->getTraceAsString());
|
||||
}
|
||||
} else {
|
||||
echo "<h3 class='h3 text-danger'>Could not connect to database to perform updates; check PHP error log.</h3>";
|
||||
}
|
||||
} else {
|
||||
echo "<h3 class='h3 text-warning'>Please login to see perform database update.</h3>";
|
||||
}
|
||||
?>
|
||||
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user