mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-21 13:54:02 -07:00
Added SQLite3 installed check [Cache/Datastore] (#652)
This commit is contained in:
parent
918e8d8485
commit
49ac3503c1
2 changed files with 18 additions and 0 deletions
|
@ -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');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue