* install: better error message on database failed connect

* changed <p> tag to <div> in notification messages
This commit is contained in:
slawkens1
2018-01-13 21:18:21 +01:00
parent 9738c1896d
commit fc243466da
11 changed files with 98 additions and 53 deletions

View File

@@ -14,29 +14,35 @@ ob_end_flush();
if(!$error) {
require(BASE . 'install/includes/database.php');
if(isset($database_error)) { // we failed connect to the database
error($database_error);
return;
}
}
if(!$db->hasTable('accounts')) {
$locale['step_database_error_table'] = str_replace('$TABLE$', 'accounts', $locale['step_database_error_table']);
error($locale['step_database_error_table']);
$error = true;
return;
}
else if(!$db->hasTable('players')) {
if(!$db->hasTable('players')) {
$locale['step_database_error_table'] = str_replace('$TABLE$', 'players', $locale['step_database_error_table']);
error($locale['step_database_error_table']);
$error = true;
return;
}
else if(!$db->hasTable('guilds')) {
if(!$db->hasTable('guilds')) {
$locale['step_database_error_table'] = str_replace('$TABLE$', 'guilds', $locale['step_database_error_table']);
error($locale['step_database_error_table']);
$error = true;
return;
}
if($db->hasTable(TABLE_PREFIX . 'account_actions')) {
$locale['step_database_error_table_exist'] = str_replace('$TABLE$', TABLE_PREFIX . 'account_actions', $locale['step_database_error_table_exist']);
warning($locale['step_database_error_table_exist']);
}
else if(!$error) {
else {
// import schema
try {
$db->query(file_get_contents(BASE . 'install/includes/schema.sql'));
@@ -47,14 +53,10 @@ else if(!$error) {
}
catch(PDOException $error_) {
error($locale['step_database_error_schema'] . ' ' . $error_);
$error = true;
return;
}
}
if($error) {
return;
}
if($db->hasColumn('accounts', 'key')) {
if(query("ALTER TABLE `accounts` MODIFY `key` VARCHAR(64) NOT NULL DEFAULT '';"))
success($locale['step_database_modifying_field'] . ' accounts.key...');