diff --git a/base.php b/base.php index dbf8d55..9e2fb8e 100644 --- a/base.php +++ b/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; diff --git a/checkconfig.php b/checkconfig.php new file mode 100644 index 0000000..032cb14 --- /dev/null +++ b/checkconfig.php @@ -0,0 +1,89 @@ + + * + */ + + require_once ("config.php"); + require_once ("base.php"); + + header ("Content-Type:application/xhtml+xml"); + +?> + + + + + + + COPS Configuration Check + " media="screen" /> + + +
+
+
+

COPS Configuration Check

+
+
+
+ +
+
+
Check if GD is properly installed and loaded
+
+ +
+
+
+
Check if Sqlite is properly installed and loaded
+
+ +
+
+ +
+
Check if Calibre database file exists and is readable
+
+ +
+
+
+
Check if Calibre database file can be opened with PHP
+
+ +
+
+
+
+ + +