mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-30 21:40:43 +02:00
Taken out the $db var from acm classes for consistency with other classes
git-svn-id: file:///svn/phpbb/trunk@4379 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
@@ -21,18 +21,12 @@
|
||||
|
||||
class acm
|
||||
{
|
||||
var $db;
|
||||
var $is_modified = FALSE;
|
||||
var $vars = '';
|
||||
var $sql_enabled = FALSE;
|
||||
|
||||
function acm(&$db)
|
||||
{
|
||||
$this->db =& $db;
|
||||
}
|
||||
|
||||
function load($var_names = '')
|
||||
{
|
||||
global $db;
|
||||
$this->vars = array();
|
||||
|
||||
$sql = 'SELECT var_name, var_ts, var_data
|
||||
@@ -43,9 +37,9 @@ class acm
|
||||
$sql .= " WHERE var_name IN ('" . implode("', '", $var_names) . "')";
|
||||
}
|
||||
|
||||
$result = $this->db->sql_query($sql);
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($row = $this->db->sql_fetchrow($result))
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$this->vars[$row['var_name']] = array(
|
||||
'data' => unserialize($row['var_data']),
|
||||
@@ -67,6 +61,8 @@ class acm
|
||||
return;
|
||||
}
|
||||
|
||||
global $db;
|
||||
|
||||
$delete = $insert = array();
|
||||
foreach ($this->vars as $var_name => $var_ary)
|
||||
{
|
||||
@@ -79,10 +75,10 @@ class acm
|
||||
else
|
||||
{
|
||||
$delete[] = $var_name;
|
||||
$insert[] = "'$var_name', " . time() . ", '" . $this->db->sql_escape(serialize($var_ary['data'])) . "'";
|
||||
$insert[] = "'$var_name', " . time() . ", '" . $db->sql_escape(serialize($var_ary['data'])) . "'";
|
||||
}
|
||||
|
||||
$this->db->sql_query($sql);
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,7 +86,7 @@ class acm
|
||||
{
|
||||
$sql = 'DELETE FROM ' . CACHE_TABLE . "
|
||||
WHERE var_name IN ('" . implode("', '", $delete) . "')";
|
||||
$this->db->sql_query($sql);
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
if (count($insert))
|
||||
{
|
||||
@@ -99,7 +95,7 @@ class acm
|
||||
case 'mysql':
|
||||
$sql = 'INSERT INTO ' . CACHE_TABLE . ' (var_name, var_ts, var_data)
|
||||
VALUES (' . implode('), (', $insert) . ')';
|
||||
$this->db->sql_query($sql);
|
||||
$db->sql_query($sql);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -107,7 +103,7 @@ class acm
|
||||
{
|
||||
$sql = 'INSERT INTO ' . CACHE_TABLE . " (var_name, var_ts, var_data)
|
||||
VALUES ($values)";
|
||||
$this->db->sql_query($sql);
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -117,9 +113,11 @@ class acm
|
||||
|
||||
function tidy($max_age = 0)
|
||||
{
|
||||
global $db;
|
||||
|
||||
$sql = 'DELETE FROM ' . CACHE_TABLE . '
|
||||
WHERE var_ts < ' . (time() - $max_age);
|
||||
$this->db->sql_query($sql);
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
|
||||
function get($var_name, $max_age = 0)
|
||||
|
@@ -27,7 +27,7 @@ class acm
|
||||
|
||||
var $sql_rowset = array();
|
||||
|
||||
function acm(&$db)
|
||||
function acm()
|
||||
{
|
||||
global $phpbb_root_path;
|
||||
$this->cache_dir = $phpbb_root_path . 'cache/';
|
||||
|
Reference in New Issue
Block a user