mirror of
https://github.com/torrentpier/torrentpier-lts.git
synced 2025-02-28 15:10:54 +03:00
Added SQLite3 installed check (#92)
This commit is contained in:
parent
5af4f7f113
commit
ebe3e62570
10
library/includes/cache/sqlite.php
vendored
10
library/includes/cache/sqlite.php
vendored
@ -23,6 +23,11 @@ class cache_sqlite extends cache_common
|
|||||||
|
|
||||||
function cache_sqlite ($cfg, $prefix = null)
|
function cache_sqlite ($cfg, $prefix = null)
|
||||||
{
|
{
|
||||||
|
if (!$this->is_installed())
|
||||||
|
{
|
||||||
|
die('Error: SQLite3 extension not installed');
|
||||||
|
}
|
||||||
|
|
||||||
$this->cfg = array_merge($this->cfg, $cfg);
|
$this->cfg = array_merge($this->cfg, $cfg);
|
||||||
$this->db = new sqlite_common($this->cfg);
|
$this->db = new sqlite_common($this->cfg);
|
||||||
$this->prefix = $prefix;
|
$this->prefix = $prefix;
|
||||||
@ -107,6 +112,11 @@ class cache_sqlite extends cache_common
|
|||||||
$result = $this->db->query("DELETE FROM ". $this->cfg['table_name'] ." WHERE cache_expire_time < $expire_time");
|
$result = $this->db->query("DELETE FROM ". $this->cfg['table_name'] ." WHERE cache_expire_time < $expire_time");
|
||||||
return ($result) ? $this->db->changes() : 0;
|
return ($result) ? $this->db->changes() : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function is_installed ()
|
||||||
|
{
|
||||||
|
return class_exists('SQLite3');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class sqlite_common extends cache_common
|
class sqlite_common extends cache_common
|
||||||
|
@ -22,6 +22,11 @@ class datastore_sqlite extends datastore_common
|
|||||||
|
|
||||||
function datastore_sqlite ($cfg, $prefix = null)
|
function datastore_sqlite ($cfg, $prefix = null)
|
||||||
{
|
{
|
||||||
|
if (!$this->is_installed())
|
||||||
|
{
|
||||||
|
die('Error: SQLite3 extension not installed');
|
||||||
|
}
|
||||||
|
|
||||||
$this->cfg = array_merge($this->cfg, $cfg);
|
$this->cfg = array_merge($this->cfg, $cfg);
|
||||||
$this->db = new sqlite_common($this->cfg);
|
$this->db = new sqlite_common($this->cfg);
|
||||||
$this->prefix = $prefix;
|
$this->prefix = $prefix;
|
||||||
@ -63,4 +68,9 @@ class datastore_sqlite extends datastore_common
|
|||||||
}
|
}
|
||||||
$this->db->debug('stop');
|
$this->db->debug('stop');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function is_installed ()
|
||||||
|
{
|
||||||
|
return class_exists('SQLite3');
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user