mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-22 06:13:58 -07:00
r127
Исправление недочетов в кеше git-svn-id: https://torrentpier2.googlecode.com/svn/trunk@127 a8ac35ab-4ca4-ca47-4c2d-a49a94f06293
This commit is contained in:
parent
a4746871db
commit
5a7e715752
3 changed files with 45 additions and 51 deletions
|
@ -144,13 +144,7 @@ class CACHES
|
|||
case 'memcache':
|
||||
if (!isset($this->obj[$cache_name]))
|
||||
{
|
||||
$cache_cfg = array(
|
||||
'host' => '127.0.0.1',
|
||||
'port' => 11211,
|
||||
'pconnect' => true, // use persistent connection
|
||||
'con_required' => true, // exit script if can't connect
|
||||
);
|
||||
$this->obj[$cache_name] = new cache_memcache($cache_cfg);
|
||||
$this->obj[$cache_name] = new cache_memcache($this->cfg['memcache']);
|
||||
}
|
||||
$this->ref[$cache_name] =& $this->obj[$cache_name];
|
||||
break;
|
||||
|
@ -182,12 +176,7 @@ class CACHES
|
|||
case 'redis':
|
||||
if (!isset($this->obj[$cache_name]))
|
||||
{
|
||||
$cache_cfg = array(
|
||||
'host' => '127.0.0.1',
|
||||
'port' => 6379,
|
||||
'con_required' => true,
|
||||
);
|
||||
$this->obj[$cache_name] = new cache_redis($cache_cfg);
|
||||
$this->obj[$cache_name] = new cache_redis($this->cfg['redis']);
|
||||
}
|
||||
$this->ref[$cache_name] =& $this->obj[$cache_name];
|
||||
break;
|
||||
|
@ -1104,18 +1093,29 @@ class datastore_sqlite extends datastore_common
|
|||
{
|
||||
var $engine = 'SQLite';
|
||||
var $db = null;
|
||||
var $cfg = array();
|
||||
var $cfg = array(
|
||||
'db_file_path' => '/path/to/datastore.db.sqlite',
|
||||
'table_name' => 'datastore',
|
||||
'table_schema' => 'CREATE TABLE datastore (
|
||||
cache_name VARCHAR(255),
|
||||
cache_expire_time INT,
|
||||
cache_value TEXT,
|
||||
PRIMARY KEY (cache_name)
|
||||
)',
|
||||
'pconnect' => true,
|
||||
'con_required' => true,
|
||||
'log_name' => 'DATASTORE',
|
||||
);
|
||||
|
||||
function datastore_sqlite ($cfg)
|
||||
{
|
||||
$this->cfg = $cfg;
|
||||
$this->cfg = array_merge($this->cfg, $cfg);
|
||||
$this->db = new sqlite_common($cfg);
|
||||
}
|
||||
|
||||
function store ($item_name, $item_data)
|
||||
{
|
||||
$this->data[$item_name] = $item_data;
|
||||
# bb_log(join("\t", array(date('H:i:s'), $item_name, @basename($_SERVER['REQUEST_URI'])))."\n", 'ds_store');
|
||||
|
||||
$ds_title = sqlite_escape_string($item_name);
|
||||
$ds_data = sqlite_escape_string(serialize($item_data));
|
||||
|
@ -1125,6 +1125,11 @@ class datastore_sqlite extends datastore_common
|
|||
return (bool) $result;
|
||||
}
|
||||
|
||||
function clean ()
|
||||
{
|
||||
$this->db->query("DELETE FROM ". $this->cfg['table_name']);
|
||||
}
|
||||
|
||||
function _fetch_from_store ()
|
||||
{
|
||||
if (!$items = $this->queued_items) return;
|
||||
|
@ -1407,42 +1412,20 @@ class datastore_mysql extends datastore_common
|
|||
switch ($bb_cfg['datastore_type'])
|
||||
{
|
||||
case 'memcache':
|
||||
$cache_cfg = array(
|
||||
'host' => '127.0.0.1',
|
||||
'port' => 11211,
|
||||
'pconnect' => true, // use persistent connection
|
||||
'con_required' => true, // exit script if can't connect
|
||||
);
|
||||
$datastore = new datastore_memcache($cache_cfg);
|
||||
$datastore = new datastore_memcache($cfg['cache']['memcache']);
|
||||
break;
|
||||
|
||||
case 'sqlite':
|
||||
$default_cfg = array(
|
||||
'db_file_path' => '/dev/shm/bb.datastore.sqlite',
|
||||
'table_name' => 'datastore',
|
||||
'table_schema' => 'CREATE TABLE datastore (
|
||||
ds_title VARCHAR(255),
|
||||
ds_data TEXT,
|
||||
PRIMARY KEY (ds_title)
|
||||
)',
|
||||
'db_file_path' => $bb_cfg['cache']['db_dir'] . '/bb_datastore.sqlite.db',
|
||||
'pconnect' => true,
|
||||
'con_required' => true,
|
||||
'log_name' => 'DATASTORE',
|
||||
);
|
||||
$cache_cfg = array(
|
||||
'db_file_path' => $bb_cfg['cache']['db_dir'] . '/bb_datastore.sqlite.db',
|
||||
'pconnect' => false,
|
||||
);
|
||||
$datastore = new datastore_sqlite(array_merge($default_cfg, $cache_cfg));
|
||||
$datastore = new datastore_sqlite($default_cfg);
|
||||
break;
|
||||
|
||||
case 'redis':
|
||||
$cache_cfg = array(
|
||||
'host' => '127.0.0.1',
|
||||
'port' => 6379,
|
||||
'con_required' => true,
|
||||
);
|
||||
$datastore = new datastore_redis($cache_cfg);
|
||||
$datastore = new datastore_redis($cfg['cache']['redis']);
|
||||
break;
|
||||
|
||||
case 'eaccelerator':
|
||||
|
|
|
@ -57,27 +57,38 @@ $bb_cfg['css_ver'] = 1;
|
|||
|
||||
// Increase number of revision after update
|
||||
$bb_cfg['tp_version'] = '2.0.2';
|
||||
$bb_cfg['tp_release_state'] = 'TP II r126';
|
||||
$bb_cfg['tp_release_state'] = 'TP II r127';
|
||||
$bb_cfg['tp_release_date'] = '23-07-2011';
|
||||
|
||||
$bb_cfg['board_disabled_msg'] = 'форум временно отключен'; // 'forums temporarily disabled'; // show this msg if board has been disabled via ON/OFF trigger
|
||||
$bb_cfg['srv_overloaded_msg'] = "Извините, в данный момент сервер перегружен\nПопробуйте повторить запрос через несколько минут";
|
||||
|
||||
// Database
|
||||
$dbhost = 'localhost';
|
||||
$dbname = 'dbname';
|
||||
$dbuser = 'dbuser';
|
||||
$dbpasswd = 'dbpasswd';
|
||||
$dbcharset = 'utf8';
|
||||
$pconnect = false;
|
||||
|
||||
$bb_cfg['db']['db1'] = array($dbhost, $dbname, $dbuser, $dbpasswd, $dbcharset, $pconnect);
|
||||
// ['db']['srv_name'] => (array) srv_cfg; порядок параметров srv_cfg (хост, название базы, пользователь, пароль, charset, pconnect);
|
||||
$bb_cfg['db']['db1'] = array('localhost', 'dbase', 'user', 'pass', $dbcharset, $pconnect);
|
||||
//$bb_cfg['db']['db2'] = array('localhost2', 'dbase2', 'user2', 'pass2', $dbcharset, $pconnect);
|
||||
//$bb_cfg['db']['db3'] = array('localhost3', 'dbase3', 'user2', 'pass3', $dbcharset, $pconnect);
|
||||
|
||||
$bb_cfg['db_alias'] = array(
|
||||
// 'alias' => 'srv_name'
|
||||
);
|
||||
|
||||
// Cache
|
||||
$bb_cfg['cache']['db_dir'] = realpath(BB_ROOT) .'/cache/filecache/';
|
||||
$cfg['cache']['memcache'] = array(
|
||||
'host' => '127.0.0.1',
|
||||
'port' => 11211,
|
||||
'pconnect' => true,
|
||||
'con_required' => true,
|
||||
);
|
||||
$cfg['cache']['redis'] = array(
|
||||
'host' => '127.0.0.1',
|
||||
'port' => 6379,
|
||||
'con_required' => true,
|
||||
);
|
||||
|
||||
// Available cache types: memcache, sqlite, db_sqlite, redis, eaccelerator, apc, xcache (default of filecache)
|
||||
# name => array( (string) type, (array) cfg )
|
||||
|
@ -390,8 +401,8 @@ $bb_cfg['ext_link_new_win'] = true; // open external links in new
|
|||
$bb_cfg['topic_moved_days_keep'] = 7; // remove topic moved links after xx days (or FALSE to disable)
|
||||
|
||||
$bb_cfg['allowed_posts_per_page'] = array(15, 30, 50, 100);
|
||||
$bb_cfg['user_signature_start'] = "<br />__________<br /><span class='signature'>";
|
||||
$bb_cfg['user_signature_end'] = "</span>"; //Это позволит использовать html теги, которые требуют закрытия. Например <table> или <font color>
|
||||
$bb_cfg['user_signature_start'] = "<br />_________________<br />";
|
||||
$bb_cfg['user_signature_end'] = ""; //Это позволит использовать html теги, которые требуют закрытия. Например <table> или <font color>
|
||||
|
||||
// Posts
|
||||
$bb_cfg['use_posts_cache'] = true; // if you switch from ON to OFF, you need to TRUNCATE `bb_posts_html` table
|
||||
|
|
|
@ -116,7 +116,7 @@
|
|||
</p>
|
||||
<!-- END last -->
|
||||
|
||||
<p class="f_stat_inline">
|
||||
<p class="f_stat_inline hidden">
|
||||
<span class="f_stat_topics"><em>{L_TOPICS_SHORT}:</em> {c.f.TOPICS}</span>
|
||||
<span class="f_stat_posts"><em>{L_POSTS_SHORT}:</em> {c.f.POSTS}</span>
|
||||
</p>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue