Add a configuration check page (checkconfig.php)
If opening the database is impossible redirect to the configuration check. fix #7
This commit is contained in:
parent
0ba361e434
commit
5105fa0a69
2 changed files with 97 additions and 3 deletions
11
base.php
11
base.php
|
@ -439,14 +439,19 @@ abstract class Base
|
|||
|
||||
private static $db = NULL;
|
||||
|
||||
public static function getDbFileName () {
|
||||
global $config;
|
||||
return $config['calibre_directory'] .'metadata.db';
|
||||
}
|
||||
|
||||
public static function getDb () {
|
||||
global $config;
|
||||
if (is_null (self::$db)) {
|
||||
try {
|
||||
self::$db = new PDO('sqlite:'. $config['calibre_directory'] .'metadata.db');
|
||||
self::$db = new PDO('sqlite:'. self::getDbFileName ());
|
||||
} catch (Exception $e) {
|
||||
echo $e;
|
||||
die($e);
|
||||
header("location: checkconfig.php");
|
||||
exit();
|
||||
}
|
||||
}
|
||||
return self::$db;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue