Update tables-not-found.php

This commit is contained in:
ruan 2016-11-05 12:20:06 +02:00
parent 87713b5a9e
commit 6dbbbd6b5e
No known key found for this signature in database
GPG Key ID: 062534EE618F498C
2 changed files with 22 additions and 8 deletions

View File

@ -14,17 +14,28 @@
<div class="text-warning">
The web interface has connected to the database, but could not find any tables generated by LiteBans.
<br>
This means that the plugin has not successfully connected to this database before with the same configuration.
This means that the plugin has not successfully connected to this database before with the same
configuration.
<br>
LiteBans needs to be connected to this database before the web interface can display anything!
<br><br>
Solutions:
<br>
- Check the startup logs to see if there are any errors.
- Check that LiteBans has successfully connected to a MySQL database using <a class="text-info">/litebans
info</a>
<br>
- Ensure that the plugin is using the MySQL driver (not SQLite) to connect to the database.
<br>
- Ensure that the table prefix is the same in config.yml and settings.php.
- Ensure that the plugin is using the MySQL driver (<a class="text-info">driver: MySQL</a> in config.yml) to
connect to the database.
<?php
require_once '../inc/settings.php';
$settings = new Settings(false);
$host = $settings->host;
if ($host === "localhost" || $host === "127.0.0.1") {
echo("<br>- The web interface is connected to <a class=\"text-info\">$host</a>. If LiteBans and the web interface are both connected to <a class=\"text-info\">$host</a>, they should not be hosted on two separate servers.");
}
$table_prefix = $settings->table_prefix;
echo("<br>- Ensure that the table prefix is the same in config.yml and settings.php. The table prefix in settings.php is currently set to <a class=\"text-info\">\"$table_prefix\"</a>.")
?>
<br>
- Ensure that you are using the latest version of LiteBans.
<br>

View File

@ -8,8 +8,8 @@ final class Settings {
$this->lang = 'en_US.utf8';
// Database information
$host = 'localhost';
$port = 3306;
$this->host = 'localhost';
$this->port = 3306;
$database = 'litebans';
@ -17,7 +17,7 @@ final class Settings {
$password = '';
// If you set a table prefix in config.yml, set it here as well
$table_prefix = "litebans_";
$this->table_prefix = "litebans_";
// Supported drivers: mysql, pgsql
$driver = 'mysql';
@ -110,6 +110,7 @@ final class Settings {
if (!$this->show_inactive_bans) {
$this->active_query = "WHERE active=" . Settings::$TRUE;
}
$table_prefix = $this->table_prefix;
// Internal table names, do not translate.
$this->table = array(
@ -126,6 +127,8 @@ final class Settings {
if ($username === "" && $password === "") {
$this->redirect("error/unconfigured.php");
}
$host = $this->host;
$port = $this->port;
$dsn = "$driver:dbname=$database;host=$host;port=$port";
if ($driver === 'mysql') {