Skip to content

Commit cfefffa

Browse files
committed
do not say sqlite is missing if it fails to init
1 parent 2d502a6 commit cfefffa

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

helper/db.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,23 @@ protected function init()
3333
}
3434

3535
/**
36-
* @param bool $throw throw an Exception when sqlite not available
36+
* @param bool $throw throw an Exception when sqlite not available or fails to load
3737
* @return SQLiteDB|null
38+
* @throws Exception
3839
*/
3940
public function getDB($throw = true)
4041
{
4142
if ($this->sqlite === null) {
43+
if (!class_exists(SQLiteDB::class)) {
44+
if ($throw || defined('DOKU_UNITTEST')) throw new StructException('no sqlite');
45+
return null;
46+
}
47+
4248
try {
4349
$this->init();
4450
} catch (\Exception $exception) {
45-
if (defined('DOKU_UNITTEST')) throw new \RuntimeException('Could not load SQLite', 0, $exception);
4651
ErrorHandler::logException($exception);
47-
if ($throw) throw new StructException('no sqlite');
52+
if ($throw) throw $exception;
4853
return null;
4954
}
5055
}

0 commit comments

Comments
 (0)