This commit is contained in:
Roman Kelesidis 2023-10-21 11:16:17 +07:00
parent 9708249b2a
commit bc62e1e6f3
3 changed files with 2 additions and 44 deletions

View File

@ -15,7 +15,7 @@ switch ($mode)
foreach ($bb_cfg['cache']['engines'] as $cache_name => $cache_val)
{
if (!in_array('db_sqlite', $cache_val))
if (!in_array(array('sqlite', 'filecache'), $cache_val))
{
CACHE($cache_name)->rm();
}

View File

@ -4,6 +4,7 @@ if (!defined('BB_ROOT')) die(basename(__FILE__));
class cache_sqlite extends cache_common
{
var $engine = 'SQLite';
var $used = true;
var $db = null;
var $prefix = null;
@ -298,41 +299,11 @@ class sqlite_common extends cache_common
return SQLite3::escapeString($str);
}
function close ()
{
@$this->dbh->close();
}
function busy ($timeout)
{
@$this->dbh->busyTimeout($timeout);
}
function get_error_msg ()
{
return 'SQLite error #'. ($err_code = $this->dbh->lastErrorCode()) .': '. $this->dbh->lastErrorMsg();
}
function rm ($name = '')
{
if ($name)
{
$this->db->shard($this->prefix . $name);
$result = $this->db->query("DELETE FROM ". $this->cfg['table_name'] ." WHERE cache_name = '". sqlite3_escape_string($this->prefix . $name) ."'");
}
else
{
$result = $this->db->query("DELETE FROM ". $this->cfg['table_name']);
}
return (bool) $result;
}
function gc ($expire_time = TIMENOW)
{
$result = $this->db->query("DELETE FROM ". $this->cfg['table_name'] ." WHERE cache_expire_time < $expire_time");
return ($result) ? sqlite_changes($this->db->dbh) : 0;
}
function trigger_error ($msg = 'DB Error')
{
if (error_reporting()) trigger_error($msg, E_USER_ERROR);

View File

@ -48,19 +48,6 @@ class CACHES
$this->ref[$cache_name] =& $this->obj[$cache_name];
break;
case 'db_sqlite':
if (!isset($this->obj[$cache_name]))
{
$cache_cfg['pconnect'] = $this->cfg['pconnect'];
$cache_cfg['db_file_path'] = $this->get_db_path($cache_name, $cache_cfg, '.sqlite.db');
$cache_cfg['table_name'] = $cache_name;
$cache_cfg['table_schema'] = $this->get_table_schema($cache_cfg);
$this->obj[$cache_name] = new sqlite_common($cache_cfg);
}
$this->ref[$cache_name] =& $this->obj[$cache_name];
break;
case 'redis':
if (!isset($this->obj[$cache_name]))
{