mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-29 06:38:52 +00:00
Implementation of an experimental cache manager.
git-svn-id: file:///svn/phpbb/trunk@3312 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
d7e485e5f6
commit
85b196b5fe
10 changed files with 399 additions and 104 deletions
|
@ -132,6 +132,7 @@ if ($mode != '')
|
||||||
|
|
||||||
$sql = ($word_id) ? "UPDATE " . WORDS_TABLE . " SET word = '" . sql_quote($word) . "', replacement = '" . sql_quote($replacement) . "' WHERE word_id = $word_id" : "INSERT INTO " . WORDS_TABLE . " (word, replacement) VALUES ('" . sql_quote($word) . "', '" . sql_quote($replacement) . "')";
|
$sql = ($word_id) ? "UPDATE " . WORDS_TABLE . " SET word = '" . sql_quote($word) . "', replacement = '" . sql_quote($replacement) . "' WHERE word_id = $word_id" : "INSERT INTO " . WORDS_TABLE . " (word, replacement) VALUES ('" . sql_quote($word) . "', '" . sql_quote($replacement) . "')";
|
||||||
$db->sql_query($sql);
|
$db->sql_query($sql);
|
||||||
|
$cache->destroy('word_censors');
|
||||||
|
|
||||||
$log_action = ($word_id) ? 'log_edit_word' : 'log_add_word';
|
$log_action = ($word_id) ? 'log_edit_word' : 'log_add_word';
|
||||||
add_admin_log($log_action, stripslashes($word));
|
add_admin_log($log_action, stripslashes($word));
|
||||||
|
@ -153,6 +154,7 @@ if ($mode != '')
|
||||||
$sql = "DELETE FROM " . WORDS_TABLE . "
|
$sql = "DELETE FROM " . WORDS_TABLE . "
|
||||||
WHERE word_id = $word_id";
|
WHERE word_id = $word_id";
|
||||||
$db->sql_query($sql);
|
$db->sql_query($sql);
|
||||||
|
$cache->destroy('word_censors');
|
||||||
|
|
||||||
add_admin_log('log_delete_word');
|
add_admin_log('log_delete_word');
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ if ( !get_magic_quotes_gpc() )
|
||||||
}
|
}
|
||||||
|
|
||||||
require($phpbb_root_path . 'config.'.$phpEx);
|
require($phpbb_root_path . 'config.'.$phpEx);
|
||||||
require($phpbb_root_path . 'config_cache.'.$phpEx);
|
//require($phpbb_root_path . 'config_cache.'.$phpEx);
|
||||||
|
|
||||||
if ( !defined('PHPBB_INSTALLED') )
|
if ( !defined('PHPBB_INSTALLED') )
|
||||||
{
|
{
|
||||||
|
@ -46,6 +46,7 @@ if ( !defined('PHPBB_INSTALLED') )
|
||||||
}
|
}
|
||||||
|
|
||||||
// Include files
|
// Include files
|
||||||
|
require($phpbb_root_path . 'includes/acm/cache_' . $acm_type . '.'.$phpEx);
|
||||||
require($phpbb_root_path . 'includes/template.'.$phpEx);
|
require($phpbb_root_path . 'includes/template.'.$phpEx);
|
||||||
require($phpbb_root_path . 'includes/session.'.$phpEx);
|
require($phpbb_root_path . 'includes/session.'.$phpEx);
|
||||||
require($phpbb_root_path . 'includes/functions.'.$phpEx);
|
require($phpbb_root_path . 'includes/functions.'.$phpEx);
|
||||||
|
@ -148,10 +149,14 @@ define('VOTE_USERS_TABLE', $table_prefix.'vote_voters');
|
||||||
// Set PHP error handler to ours
|
// Set PHP error handler to ours
|
||||||
set_error_handler('msg_handler');
|
set_error_handler('msg_handler');
|
||||||
|
|
||||||
|
// Experimental cache manager
|
||||||
|
$cache = new acm();
|
||||||
|
|
||||||
// Need these here so instantiate them now
|
// Need these here so instantiate them now
|
||||||
$template = new Template();
|
$template = new Template();
|
||||||
$db = new sql_db($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false);
|
$db = new sql_db($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false);
|
||||||
|
|
||||||
|
/*
|
||||||
// Obtain boardwide default config (rebuilding cache if reqd)
|
// Obtain boardwide default config (rebuilding cache if reqd)
|
||||||
if ( empty($config) )
|
if ( empty($config) )
|
||||||
{
|
{
|
||||||
|
@ -176,6 +181,29 @@ if ( empty($acl_options) )
|
||||||
$auth_admin = new auth_admin();
|
$auth_admin = new auth_admin();
|
||||||
$acl_options = $auth_admin->acl_cache_options();
|
$acl_options = $auth_admin->acl_cache_options();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (!$config = $cache->load('config'))
|
||||||
|
{
|
||||||
|
$config = array();
|
||||||
|
|
||||||
|
$sql = 'SELECT * FROM ' . CONFIG_TABLE;
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
|
while ($row = $db->sql_fetchrow($result))
|
||||||
|
{
|
||||||
|
$config[$row['config_name']] = $row['config_value'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$cache->save('config', $config);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
if (time() - $config['cache_interval'] >= $config['cache_last_gc'])
|
||||||
|
{
|
||||||
|
$cache->tidy($config['cache_gc']);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
// Instantiate some basic classes
|
// Instantiate some basic classes
|
||||||
$user = new user();
|
$user = new user();
|
||||||
|
|
|
@ -36,7 +36,7 @@ class sql_db
|
||||||
//
|
//
|
||||||
// Constructor
|
// Constructor
|
||||||
//
|
//
|
||||||
function sql_db($sqlserver, $sqluser, $sqlpassword, $database, $port, $persistency = false)
|
function sql_db($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false)
|
||||||
{
|
{
|
||||||
$this->open_queries = array();
|
$this->open_queries = array();
|
||||||
$this->num_queries = 0;
|
$this->num_queries = 0;
|
||||||
|
@ -117,9 +117,12 @@ class sql_db
|
||||||
//
|
//
|
||||||
// Base query method
|
// Base query method
|
||||||
//
|
//
|
||||||
function sql_query($query = '')
|
function sql_query($query = '', $expire_time = 0)
|
||||||
{
|
{
|
||||||
if ($query != '')
|
if ($query != '')
|
||||||
|
{
|
||||||
|
global $cache;
|
||||||
|
if (!$expire_time || !$cache->sql_load($query))
|
||||||
{
|
{
|
||||||
$this->query_result = false;
|
$this->query_result = false;
|
||||||
$this->num_queries++;
|
$this->num_queries++;
|
||||||
|
@ -176,15 +179,22 @@ class sql_db
|
||||||
|
|
||||||
$this->open_queries[] = $this->query_result;
|
$this->open_queries[] = $this->query_result;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($expire_time && $this->query_result)
|
||||||
|
{
|
||||||
|
$cache->sql_save($query, $this->query_result);
|
||||||
|
@mysql_free_result(array_pop($this->open_queries));
|
||||||
|
}
|
||||||
|
|
||||||
return ( $this->query_result) ? $this->query_result : false;
|
return ( $this->query_result) ? $this->query_result : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function sql_query_limit($query = '', $total, $offset = 0)
|
function sql_query_limit($query = '', $total, $offset = 0, $expire_time = 0)
|
||||||
{
|
{
|
||||||
if ( $query != '' )
|
if ( $query != '' )
|
||||||
{
|
{
|
||||||
|
@ -196,7 +206,7 @@ class sql_db
|
||||||
$query .= ' LIMIT ' . ( ( !empty($offset) ) ? $offset . ', ' . $total : $total );
|
$query .= ' LIMIT ' . ( ( !empty($offset) ) ? $offset . ', ' . $total : $total );
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->sql_query($query);
|
return $this->sql_query($query, $expire_time);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -288,6 +298,12 @@ class sql_db
|
||||||
$query_id = $this->query_result;
|
$query_id = $this->query_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
global $cache;
|
||||||
|
if ($cache->sql_exists($query_id))
|
||||||
|
{
|
||||||
|
return $cache->sql_fetchrow($query_id);
|
||||||
|
}
|
||||||
|
|
||||||
return ( $query_id ) ? @mysql_fetch_assoc($query_id) : false;
|
return ( $query_id ) ? @mysql_fetch_assoc($query_id) : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -301,17 +317,14 @@ class sql_db
|
||||||
{
|
{
|
||||||
unset($this->rowset[$query_id]);
|
unset($this->rowset[$query_id]);
|
||||||
unset($this->row[$query_id]);
|
unset($this->row[$query_id]);
|
||||||
while($this->rowset[$query_id] = @mysql_fetch_assoc($query_id))
|
while ($this->rowset[$query_id] = $this->sql_fetchrow($query_id))
|
||||||
{
|
{
|
||||||
$result[] = $this->rowset[$query_id];
|
$result[] = $this->rowset[$query_id];
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function sql_fetchfield($field, $rownum = -1, $query_id = 0)
|
function sql_fetchfield($field, $rownum = -1, $query_id = 0)
|
||||||
{
|
{
|
||||||
|
@ -348,11 +361,8 @@ class sql_db
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function sql_rowseek($rownum, $query_id = 0)
|
function sql_rowseek($rownum, $query_id = 0)
|
||||||
{
|
{
|
||||||
|
|
244
phpBB/includes/acm/cache_file.php
Normal file
244
phpBB/includes/acm/cache_file.php
Normal file
|
@ -0,0 +1,244 @@
|
||||||
|
<?php
|
||||||
|
/***************************************************************************
|
||||||
|
* cache_file.php
|
||||||
|
* -------------------
|
||||||
|
* begin : Saturday, Feb 13, 2001
|
||||||
|
* copyright : (C) 2001 The phpBB Group
|
||||||
|
* email : support@phpbb.com
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
//
|
||||||
|
// This class is part of the Advanced Cache Manager
|
||||||
|
//
|
||||||
|
|
||||||
|
class acm
|
||||||
|
{
|
||||||
|
var $vars = '';
|
||||||
|
var $vars_ts = array();
|
||||||
|
var $modified = FALSE;
|
||||||
|
|
||||||
|
var $sql_rowset = array();
|
||||||
|
var $sql_rowset_index = array();
|
||||||
|
|
||||||
|
function acm()
|
||||||
|
{
|
||||||
|
//$this->load_cache();
|
||||||
|
$this->cache_dir = $phpbb_root_path . 'cache/';
|
||||||
|
}
|
||||||
|
|
||||||
|
function tidy($expire_time = 0)
|
||||||
|
{
|
||||||
|
global $phpEx;
|
||||||
|
|
||||||
|
$dir = opendir($this->cache_dir);
|
||||||
|
while ($entry = readdir($dir))
|
||||||
|
{
|
||||||
|
if ($entry{0} == '.')
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!$expire_time || time() - $expire_time >= filemtime($this->cache_dir . $entry))
|
||||||
|
{
|
||||||
|
unlink($this->cache_dir . $entry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (file_exists($this->cache_dir . 'global.' . $phpEx))
|
||||||
|
{
|
||||||
|
foreach ($this->vars_ts as $varname => $timestamp)
|
||||||
|
{
|
||||||
|
if (time() - $expire_time >= $timestamp)
|
||||||
|
{
|
||||||
|
$this->destroy($varname);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->vars = $this->vars_ts = array();
|
||||||
|
$this->modified = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function save($varname, $var)
|
||||||
|
{
|
||||||
|
$this->vars[$varname] = $var;
|
||||||
|
$this->vars_ts[$varname] = time();
|
||||||
|
$this->modified = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
function destroy($varname)
|
||||||
|
{
|
||||||
|
if (isset($this->vars[$varname]))
|
||||||
|
{
|
||||||
|
$this->modified = TRUE;
|
||||||
|
unset($this->vars[$varname]);
|
||||||
|
unset($this->vars_ts[$varname]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function load($varname, $expire_time = 0)
|
||||||
|
{
|
||||||
|
if (!is_array($this->vars))
|
||||||
|
{
|
||||||
|
$this->load_cache();
|
||||||
|
}
|
||||||
|
if (isset($this->vars[$varname]))
|
||||||
|
{
|
||||||
|
if ($expire_time && time() - $this->vars_ts[$varname] > $expire_time)
|
||||||
|
{
|
||||||
|
$this->destroy($varname);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return $this->vars[$varname];
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function exists($varname, $expire_time = 0)
|
||||||
|
{
|
||||||
|
if (!is_array($this->vars))
|
||||||
|
{
|
||||||
|
$this->load_cache();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($expire_time > 0)
|
||||||
|
{
|
||||||
|
if (!isset($this->vars[$varname]))
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
if ($this->vars_ts[$varname] <= time() - $expire_time)
|
||||||
|
{
|
||||||
|
$this->destroy($varname);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return isset($this->vars[$varname]);
|
||||||
|
}
|
||||||
|
|
||||||
|
function load_cache()
|
||||||
|
{
|
||||||
|
global $phpEx;
|
||||||
|
|
||||||
|
$this->vars = array();
|
||||||
|
@include($this->cache_dir . 'global.' . $phpEx);
|
||||||
|
}
|
||||||
|
|
||||||
|
function save_cache()
|
||||||
|
{
|
||||||
|
if (!$this->modified)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
global $phpEx;
|
||||||
|
$file = '<?php $this->vars=' . $this->format_array($this->vars) . ";\n\$this->vars_ts=" . $this->format_array($this->vars_ts) . ' ?>';
|
||||||
|
|
||||||
|
$fp = fopen($this->cache_dir . 'global.' . $phpEx, 'wb');
|
||||||
|
fwrite($fp, $file);
|
||||||
|
fclose($fp);
|
||||||
|
}
|
||||||
|
|
||||||
|
function format_array($array)
|
||||||
|
{
|
||||||
|
$lines = array();
|
||||||
|
foreach ($array as $k => $v)
|
||||||
|
{
|
||||||
|
if (is_array($v))
|
||||||
|
{
|
||||||
|
$lines[] = "'$k'=>" . $this->format_array($v);
|
||||||
|
}
|
||||||
|
elseif (is_int($v))
|
||||||
|
{
|
||||||
|
$lines[] = "'$k'=>$v";
|
||||||
|
}
|
||||||
|
elseif (is_bool($v))
|
||||||
|
{
|
||||||
|
$lines[] = "'$k'=>" . (($v) ? 'TRUE' : 'FALSE');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$lines[] = "'$k'=>'" . str_replace('\\\\', '\\\\\\\\', str_replace("'", "\'", $v)) . "'";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 'array(' . implode(',', $lines) . ')';
|
||||||
|
}
|
||||||
|
|
||||||
|
function sql_load($query)
|
||||||
|
{
|
||||||
|
global $db, $phpEx;
|
||||||
|
if (!file_exists($this->cache_dir . md5($query) . '.' . $phpEx))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
include($this->cache_dir . md5($query) . '.' . $phpEx);
|
||||||
|
|
||||||
|
$query_id = 'Cache id #' . count($this->sql_rowset);
|
||||||
|
$this->sql_rowset[$query_id] = $rowset;
|
||||||
|
$this->sql_rowset_index[$query_id] = 0;
|
||||||
|
$db->query_result = $query_id;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function sql_save($query, $result)
|
||||||
|
{
|
||||||
|
global $db, $phpEx;
|
||||||
|
$fp = fopen($this->cache_dir . md5($query) . '.' . $phpEx, 'wb');
|
||||||
|
|
||||||
|
$lines = array();
|
||||||
|
$query_id = 'Cache id #' . count($this->sql_rowset);
|
||||||
|
$this->sql_rowset[$query_id] = array();
|
||||||
|
$this->sql_rowset_index[$query_id] = 0;
|
||||||
|
$db->query_result = $query_id;
|
||||||
|
|
||||||
|
while ($row = $db->sql_fetchrow($result))
|
||||||
|
{
|
||||||
|
$this->sql_rowset[$query_id][] = $row;
|
||||||
|
|
||||||
|
$line = 'array(';
|
||||||
|
foreach ($row as $key => $val)
|
||||||
|
{
|
||||||
|
$line .= "'$key'=>'" . str_replace('\\\\', '\\\\\\\\', str_replace("'", "\'", $val)) . "',";
|
||||||
|
}
|
||||||
|
$lines[] = substr($line, 0, -1) . ')';
|
||||||
|
}
|
||||||
|
|
||||||
|
fwrite($fp, "<?php\n\n/*\n$query\n*/\n\n\$rowset = array(" . implode(',', $lines) . ') ?>');
|
||||||
|
fclose($fp);
|
||||||
|
}
|
||||||
|
|
||||||
|
function sql_exists($query_id)
|
||||||
|
{
|
||||||
|
return isset($this->sql_rowset[$query_id]);
|
||||||
|
}
|
||||||
|
|
||||||
|
function sql_fetchrow($query_id)
|
||||||
|
{
|
||||||
|
if (!isset($this->sql_rowset[$query_id][$this->sql_rowset_index[$query_id]]))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$row = $this->sql_rowset[$query_id][$this->sql_rowset_index[$query_id]];
|
||||||
|
++$this->sql_rowset_index[$query_id];
|
||||||
|
|
||||||
|
return $row;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
|
@ -29,6 +29,18 @@ function sql_quote($msg)
|
||||||
return str_replace("\'", "''", $msg);
|
return str_replace("\'", "''", $msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function set_config($config_name, $config_value)
|
||||||
|
{
|
||||||
|
global $db, $cache, $config;
|
||||||
|
$config[$config_name] = $config_value;
|
||||||
|
$cache->save('config', $config);
|
||||||
|
|
||||||
|
$sql = 'UPDATE ' . CONFIG_TABLE . "
|
||||||
|
SET config_value = '" . sql_escape($config_value) . "'
|
||||||
|
WHERE config_name = '$config_name'";
|
||||||
|
$db->sql_query($sql);
|
||||||
|
}
|
||||||
|
|
||||||
function get_userdata($user)
|
function get_userdata($user)
|
||||||
{
|
{
|
||||||
global $db;
|
global $db;
|
||||||
|
@ -140,7 +152,7 @@ function generate_forum_nav(&$forum_data)
|
||||||
// Obtain list of moderators of each forum
|
// Obtain list of moderators of each forum
|
||||||
function get_moderators(&$forum_moderators, $forum_id = false)
|
function get_moderators(&$forum_moderators, $forum_id = false)
|
||||||
{
|
{
|
||||||
global $SID, $db, $acl_options, $phpEx;
|
global $cache, $SID, $db, $acl_options, $phpEx;
|
||||||
|
|
||||||
if (!empty($forum_id) && is_array($forum_id))
|
if (!empty($forum_id) && is_array($forum_id))
|
||||||
{
|
{
|
||||||
|
@ -189,7 +201,9 @@ function make_jumpbox($action, $forum_id = false)
|
||||||
$sql = 'SELECT forum_id, forum_name, forum_postable, left_id, right_id
|
$sql = 'SELECT forum_id, forum_name, forum_postable, left_id, right_id
|
||||||
FROM ' . FORUMS_TABLE . '
|
FROM ' . FORUMS_TABLE . '
|
||||||
ORDER BY left_id ASC';
|
ORDER BY left_id ASC';
|
||||||
$result = $db->sql_query($sql);
|
|
||||||
|
// Cache the forums list for 60 seconds
|
||||||
|
$result = $db->sql_query($sql, 60);
|
||||||
|
|
||||||
$right = $cat_right = 0;
|
$right = $cat_right = 0;
|
||||||
$padding = $forum_list = $holding = '';
|
$padding = $forum_list = $holding = '';
|
||||||
|
@ -646,8 +660,15 @@ function on_page($num_items, $per_page, $start)
|
||||||
// to return both sets of arrays
|
// to return both sets of arrays
|
||||||
function obtain_word_list(&$orig_word, &$replacement_word)
|
function obtain_word_list(&$orig_word, &$replacement_word)
|
||||||
{
|
{
|
||||||
global $db;
|
global $db, $cache;
|
||||||
|
if ($cache->exists('word_censors'))
|
||||||
|
{
|
||||||
|
$words = $cache->load('word_censors');
|
||||||
|
$orig_word = $words['orig'];
|
||||||
|
$replacement_word = $words['replacement'];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$sql = "SELECT word, replacement
|
$sql = "SELECT word, replacement
|
||||||
FROM " . WORDS_TABLE;
|
FROM " . WORDS_TABLE;
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
@ -658,6 +679,10 @@ function obtain_word_list(&$orig_word, &$replacement_word)
|
||||||
$replacement_word[] = $row['replacement'];
|
$replacement_word[] = $row['replacement'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$words = array('orig' => $orig_word, 'replacement' => $replacement_word);
|
||||||
|
$cache->save('word_censors', $words);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -833,7 +858,7 @@ function validate_optional_fields(&$icq, &$aim, &$msnm, &$yim, &$website, &$loca
|
||||||
// Error and message handler, call with trigger_error if reqd
|
// Error and message handler, call with trigger_error if reqd
|
||||||
function msg_handler($errno, $msg_text, $errfile, $errline)
|
function msg_handler($errno, $msg_text, $errfile, $errline)
|
||||||
{
|
{
|
||||||
global $db, $auth, $template, $config, $user, $nav_links;
|
global $cache, $db, $auth, $template, $config, $user, $nav_links;
|
||||||
global $phpEx, $phpbb_root_path, $starttime;
|
global $phpEx, $phpbb_root_path, $starttime;
|
||||||
|
|
||||||
switch ($errno)
|
switch ($errno)
|
||||||
|
|
|
@ -139,18 +139,8 @@ $total_online_users = $logged_visible_online + $logged_hidden_online + $guests_o
|
||||||
|
|
||||||
if ($total_online_users > $config['record_online_users'])
|
if ($total_online_users > $config['record_online_users'])
|
||||||
{
|
{
|
||||||
$config['record_online_users'] = $total_online_users;
|
set_config('record_online_users', $total_online_users);
|
||||||
$config['record_online_date'] = time();
|
set_config('record_online_date', time());
|
||||||
|
|
||||||
$sql = "UPDATE " . CONFIG_TABLE . "
|
|
||||||
SET config_value = '$total_online_users'
|
|
||||||
WHERE config_name = 'record_online_users'";
|
|
||||||
$db->sql_query($sql);
|
|
||||||
|
|
||||||
$sql = "UPDATE " . CONFIG_TABLE . "
|
|
||||||
SET config_value = '" . $config['record_online_date'] . "'
|
|
||||||
WHERE config_name = 'record_online_date'";
|
|
||||||
$db->sql_query($sql);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($total_online_users == 0)
|
if ($total_online_users == 0)
|
||||||
|
|
|
@ -51,6 +51,8 @@ $template->assign_vars(array(
|
||||||
'DEBUG_OUTPUT' => (defined('DEBUG')) ? $debug_output : ''
|
'DEBUG_OUTPUT' => (defined('DEBUG')) ? $debug_output : ''
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|
||||||
|
$cache->save_cache();
|
||||||
$template->display('body');
|
$template->display('body');
|
||||||
|
|
||||||
exit;
|
exit;
|
||||||
|
|
|
@ -326,10 +326,7 @@ class session
|
||||||
{
|
{
|
||||||
// Less than 5 sessions, update gc timer ... else we want gc
|
// Less than 5 sessions, update gc timer ... else we want gc
|
||||||
// called again to delete other sessions
|
// called again to delete other sessions
|
||||||
$sql = "UPDATE " . CONFIG_TABLE . "
|
set_config('session_last_gc', $current_time);
|
||||||
SET config_value = '$current_time'
|
|
||||||
WHERE config_name = 'session_last_gc'";
|
|
||||||
$db->sql_query($sql);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -442,7 +439,9 @@ class user extends session
|
||||||
AND t.template_id = s.template_id
|
AND t.template_id = s.template_id
|
||||||
AND c.theme_id = s.style_id
|
AND c.theme_id = s.style_id
|
||||||
AND i.imageset_id = s.imageset_id";
|
AND i.imageset_id = s.imageset_id";
|
||||||
$result = $db->sql_query($sql);
|
|
||||||
|
// Cache this query for 60 seconds
|
||||||
|
$result = $db->sql_query($sql, 60);
|
||||||
|
|
||||||
if (!($this->theme = $db->sql_fetchrow($result)))
|
if (!($this->theme = $db->sql_fetchrow($result)))
|
||||||
{
|
{
|
||||||
|
|
|
@ -690,6 +690,7 @@ else
|
||||||
$config_data .= '$dbname = "' . $dbname . '";' . "\n";
|
$config_data .= '$dbname = "' . $dbname . '";' . "\n";
|
||||||
$config_data .= '$dbuser = "' . $dbuser . '";' . "\n";
|
$config_data .= '$dbuser = "' . $dbuser . '";' . "\n";
|
||||||
$config_data .= '$dbpasswd = "' . $dbpasswd . '";' . "\n\n";
|
$config_data .= '$dbpasswd = "' . $dbpasswd . '";' . "\n\n";
|
||||||
|
$config_data .= "\$acm_type = 'file';\n";
|
||||||
$config_data .= '$table_prefix = "' . $table_prefix . '";' . "\n\n";
|
$config_data .= '$table_prefix = "' . $table_prefix . '";' . "\n\n";
|
||||||
$config_data .= 'define(\'PHPBB_INSTALLED\', true);'."\n\n";
|
$config_data .= 'define(\'PHPBB_INSTALLED\', true);'."\n\n";
|
||||||
$config_data .= '?' . '>'; // Done this to prevent highlighting editors getting confused!
|
$config_data .= '?' . '>'; // Done this to prevent highlighting editors getting confused!
|
||||||
|
|
|
@ -467,16 +467,10 @@ if (isset($post))
|
||||||
// post counts for index, etc.
|
// post counts for index, etc.
|
||||||
if ($mode == 'post')
|
if ($mode == 'post')
|
||||||
{
|
{
|
||||||
$sql = 'UPDATE ' . CONFIG_TABLE . "
|
set_config('num_topics', $config['num_topics'] + 1);
|
||||||
SET config_value = '" . ($config['num_topics'] + 1) . "'
|
|
||||||
WHERE config_name = 'num_topics'";
|
|
||||||
$db->sql_query($sql);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = 'UPDATE ' . CONFIG_TABLE . "
|
set_config('num_posts', $config['num_posts'] + 1);
|
||||||
SET config_value = '" . ($config['num_posts'] + 1) . "'
|
|
||||||
WHERE config_name = 'num_posts'";
|
|
||||||
$db->sql_query($sql);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Topic notification
|
// Topic notification
|
||||||
|
|
Loading…
Add table
Reference in a new issue