mirror of
https://github.com/torrentpier/torrentpier-lts.git
synced 2025-02-28 15:10:54 +03:00
Updated
This commit is contained in:
parent
9708249b2a
commit
bc62e1e6f3
@ -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();
|
||||
}
|
||||
|
31
library/includes/cache/sqlite.php
vendored
31
library/includes/cache/sqlite.php
vendored
@ -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);
|
||||
|
@ -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]))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user