Fix the redirect in case the database is not found. I also handle better the case were no file are actually found. Thanks to At Libitum. fix #116
这个提交存在于:
父节点
26f5b36563
当前提交
4d9b3a4925
共有 3 个文件被更改,包括 17 次插入 和 3 次删除
14
base.php
14
base.php
|
@ -889,15 +889,23 @@ abstract class Base
|
|||
public static function getDbFileName ($database = NULL) {
|
||||
return self::getDbDirectory ($database) .'metadata.db';
|
||||
}
|
||||
|
||||
private static function error () {
|
||||
header("location: checkconfig.php?err=1");
|
||||
exit();
|
||||
}
|
||||
|
||||
public static function getDb ($database = NULL) {
|
||||
global $config;
|
||||
if (is_null (self::$db)) {
|
||||
try {
|
||||
self::$db = new PDO('sqlite:'. self::getDbFileName ($database));
|
||||
if (file_exists (self::getDbFileName ($database))) {
|
||||
self::$db = new PDO('sqlite:'. self::getDbFileName ($database));
|
||||
} else {
|
||||
self::error ();
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
header("location: checkconfig.php?err=1");
|
||||
exit();
|
||||
self::error ();
|
||||
}
|
||||
}
|
||||
return self::$db;
|
||||
|
|
正在加载…
添加表格
添加链接
在新工单中引用