diff --git a/src/Legacy/Cache/Sqlite.php b/src/Legacy/Cache/Sqlite.php index b099acc14..e88457fc1 100644 --- a/src/Legacy/Cache/Sqlite.php +++ b/src/Legacy/Cache/Sqlite.php @@ -36,6 +36,10 @@ class Sqlite extends Common public function __construct($cfg, $prefix = null) { + if (!$this->is_installed()) { + die('Error: SQLite3 extension not installed'); + } + $this->cfg = array_merge($this->cfg, $cfg); $this->db = new SqliteCommon($this->cfg); $this->prefix = $prefix; @@ -110,4 +114,9 @@ class Sqlite extends Common $result = $this->db->query("DELETE FROM " . $this->cfg['table_name'] . " WHERE cache_expire_time < $expire_time"); return $result ? $this->db->changes() : 0; } + + public function is_installed() + { + return class_exists('SQLite3'); + } } diff --git a/src/Legacy/Datastore/Sqlite.php b/src/Legacy/Datastore/Sqlite.php index 177b71cef..47a106cf7 100644 --- a/src/Legacy/Datastore/Sqlite.php +++ b/src/Legacy/Datastore/Sqlite.php @@ -35,6 +35,10 @@ class Sqlite extends Common public function __construct($cfg, $prefix = null) { + if (!$this->is_installed()) { + die('Error: SQLite3 extension not installed'); + } + $this->cfg = array_merge($this->cfg, $cfg); $this->db = new SqliteCommon($this->cfg); $this->prefix = $prefix; @@ -77,4 +81,9 @@ class Sqlite extends Common } $this->db->debug('stop'); } + + public function is_installed() + { + return class_exists('SQLite3'); + } }