aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/acm
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes/acm')
-rw-r--r--phpBB/includes/acm/acm_apc.php15
-rw-r--r--phpBB/includes/acm/acm_eaccelerator.php15
-rw-r--r--phpBB/includes/acm/acm_file.php50
-rw-r--r--phpBB/includes/acm/acm_memcache.php13
-rw-r--r--phpBB/includes/acm/acm_xcache.php15
5 files changed, 24 insertions, 84 deletions
diff --git a/phpBB/includes/acm/acm_apc.php b/phpBB/includes/acm/acm_apc.php
index 15f3705d9e..e4c4b79de3 100644
--- a/phpBB/includes/acm/acm_apc.php
+++ b/phpBB/includes/acm/acm_apc.php
@@ -33,8 +33,7 @@ class acm
*/
function __construct()
{
- global $phpbb_root_path;
- $this->cache_dir = $phpbb_root_path . 'cache/';
+ $this->cache_dir = PHPBB_ROOT_PATH . 'cache/';
}
/**
@@ -42,8 +41,6 @@ class acm
*/
private function load()
{
- global $phpEx;
-
// grab the global cache
if ($this->vars = apc_fetch('global'))
{
@@ -86,8 +83,6 @@ class acm
*/
public function tidy()
{
- global $phpEx;
-
// cache has auto GC, no need to have any code here :)
set_config('cache_last_gc', time(), true);
@@ -100,8 +95,6 @@ class acm
{
if ($var_name[0] === '_')
{
- global $phpEx;
-
return apc_fetch($var_name);
}
else
@@ -171,8 +164,6 @@ class acm
*/
public function destroy($var_name, $table = '')
{
- global $phpEx;
-
if ($var_name === 'sql' && !empty($table))
{
if (!is_array($table))
@@ -221,8 +212,6 @@ class acm
*/
public function sql_load($query)
{
- global $phpEx;
-
// Remove extra spaces and tabs
$query = preg_replace('/[\n\r\s\t]+/', ' ', $query);
$query_id = sizeof($this->sql_rowset);
@@ -244,7 +233,7 @@ class acm
*/
public function sql_save($query, &$query_result, $ttl)
{
- global $db, $phpEx;
+ global $db;
// Remove extra spaces and tabs
$query = preg_replace('/[\n\r\s\t]+/', ' ', $query);
diff --git a/phpBB/includes/acm/acm_eaccelerator.php b/phpBB/includes/acm/acm_eaccelerator.php
index 8592658e51..00d08f70d3 100644
--- a/phpBB/includes/acm/acm_eaccelerator.php
+++ b/phpBB/includes/acm/acm_eaccelerator.php
@@ -33,8 +33,7 @@ class acm
*/
function __construct()
{
- global $phpbb_root_path;
- $this->cache_dir = $phpbb_root_path . 'cache/';
+ $this->cache_dir = PHPBB_ROOT_PATH . 'cache/';
}
/**
@@ -42,8 +41,6 @@ class acm
*/
private function load()
{
- global $phpEx;
-
// grab the global cache
if ($this->vars = eaccelerator_get('global'))
{
@@ -86,8 +83,6 @@ class acm
*/
public function tidy()
{
- global $phpEx;
-
eaccelerator_gc();
set_config('cache_last_gc', time(), true);
@@ -100,8 +95,6 @@ class acm
{
if ($var_name[0] === '_')
{
- global $phpEx;
-
$temp = eaccelerator_get($var_name);
if ($temp !== null)
@@ -183,8 +176,6 @@ class acm
*/
public function destroy($var_name, $table = '')
{
- global $phpEx;
-
if ($var_name === 'sql' && !empty($table))
{
if (!is_array($table))
@@ -237,8 +228,6 @@ class acm
*/
public function sql_load($query)
{
- global $phpEx;
-
// Remove extra spaces and tabs
$query = preg_replace('/[\n\r\s\t]+/', ' ', $query);
$query_id = sizeof($this->sql_rowset);
@@ -260,7 +249,7 @@ class acm
*/
public function sql_save($query, &$query_result, $ttl)
{
- global $db, $phpEx;
+ global $db;
// Remove extra spaces and tabs
$query = preg_replace('/[\n\r\s\t]+/', ' ', $query);
diff --git a/phpBB/includes/acm/acm_file.php b/phpBB/includes/acm/acm_file.php
index f952b372c6..9376549cba 100644
--- a/phpBB/includes/acm/acm_file.php
+++ b/phpBB/includes/acm/acm_file.php
@@ -34,8 +34,7 @@ class acm
*/
function __construct()
{
- global $phpbb_root_path;
- $this->cache_dir = $phpbb_root_path . 'cache/';
+ $this->cache_dir = PHPBB_ROOT_PATH . 'cache/';
}
/**
@@ -43,12 +42,10 @@ class acm
*/
private function load()
{
- global $phpEx;
-
// grab the global cache
- if (file_exists($this->cache_dir . 'data_global.' . $phpEx))
+ if (file_exists($this->cache_dir . 'data_global.' . PHP_EXT))
{
- @include($this->cache_dir . 'data_global.' . $phpEx);
+ @include($this->cache_dir . 'data_global.' . PHP_EXT);
return true;
}
@@ -80,16 +77,14 @@ class acm
return;
}
- global $phpEx;
-
- if ($fp = @fopen($this->cache_dir . 'data_global.' . $phpEx, 'wb'))
+ if ($fp = @fopen($this->cache_dir . 'data_global.' . PHP_EXT, 'wb'))
{
@flock($fp, LOCK_EX);
fwrite($fp, "<?php\n\$this->vars = unserialize('" . serialize($this->vars) . "');\n\$this->var_expires = unserialize('" . serialize($this->var_expires) . "');");
@flock($fp, LOCK_UN);
fclose($fp);
- @chmod($this->cache_dir . 'data_global.' . $phpEx, 0666);
+ @chmod($this->cache_dir . 'data_global.' . PHP_EXT, 0666);
}
else
{
@@ -99,7 +94,7 @@ class acm
trigger_error($this->cache_dir . ' is NOT writable.', E_USER_ERROR);
}
- trigger_error('Not able to open ' . $this->cache_dir . 'data_global.' . $phpEx, E_USER_ERROR);
+ trigger_error('Not able to open ' . $this->cache_dir . 'data_global.' . PHP_EXT, E_USER_ERROR);
}
$this->is_modified = false;
@@ -110,8 +105,6 @@ class acm
*/
public function tidy()
{
- global $phpEx;
-
$dir = @opendir($this->cache_dir);
if (!$dir)
@@ -135,7 +128,7 @@ class acm
}
closedir($dir);
- if (file_exists($this->cache_dir . 'data_global.' . $phpEx))
+ if (file_exists($this->cache_dir . 'data_global.' . PHP_EXT))
{
if (!sizeof($this->vars))
{
@@ -161,14 +154,12 @@ class acm
{
if ($var_name[0] === '_')
{
- global $phpEx;
-
if (!$this->_exists($var_name))
{
return false;
}
- @include($this->cache_dir . "data{$var_name}.$phpEx");
+ @include($this->cache_dir . "data{$var_name}." . PHP_EXT);
return (isset($data)) ? $data : false;
}
else
@@ -184,16 +175,14 @@ class acm
{
if ($var_name[0] === '_')
{
- global $phpEx;
-
- if ($fp = @fopen($this->cache_dir . "data{$var_name}.$phpEx", 'wb'))
+ if ($fp = @fopen($this->cache_dir . "data{$var_name}." . PHP_EXT, 'wb'))
{
@flock($fp, LOCK_EX);
fwrite($fp, "<?php\n\$expired = (time() > " . (time() + $ttl) . ") ? true : false;\nif (\$expired) { return; }\n\$data = " . (sizeof($var) ? "unserialize('" . serialize($var) . "');" : 'array();'));
@flock($fp, LOCK_UN);
fclose($fp);
- @chmod($this->cache_dir . "data{$var_name}.$phpEx", 0666);
+ @chmod($this->cache_dir . "data{$var_name}." . PHP_EXT, 0666);
}
}
else
@@ -244,8 +233,6 @@ class acm
*/
public function destroy($var_name, $table = '')
{
- global $phpEx;
-
if ($var_name === 'sql' && !empty($table))
{
if (!is_array($table))
@@ -306,7 +293,7 @@ class acm
if ($var_name[0] === '_')
{
- $this->remove_file($this->cache_dir . 'data' . $var_name . ".$phpEx", true);
+ $this->remove_file($this->cache_dir . 'data' . $var_name . '.' . PHP_EXT, true);
}
else if (isset($this->vars[$var_name]))
{
@@ -326,8 +313,7 @@ class acm
{
if ($var_name[0] === '_')
{
- global $phpEx;
- return file_exists($this->cache_dir . 'data' . $var_name . ".$phpEx");
+ return file_exists($this->cache_dir . 'data' . $var_name . '.' . PHP_EXT);
}
else
{
@@ -350,18 +336,16 @@ class acm
*/
public function sql_load($query)
{
- global $phpEx;
-
// Remove extra spaces and tabs
$query = preg_replace('/[\n\r\s\t]+/', ' ', $query);
$query_id = sizeof($this->sql_rowset);
- if (!file_exists($this->cache_dir . 'sql_' . md5($query) . ".$phpEx"))
+ if (!file_exists($this->cache_dir . 'sql_' . md5($query) . '.' . PHP_EXT))
{
return false;
}
- @include($this->cache_dir . 'sql_' . md5($query) . ".$phpEx");
+ @include($this->cache_dir . 'sql_' . md5($query) . '.' . PHP_EXT);
if (!isset($expired))
{
@@ -369,7 +353,7 @@ class acm
}
else if ($expired)
{
- $this->remove_file($this->cache_dir . 'sql_' . md5($query) . ".$phpEx", true);
+ $this->remove_file($this->cache_dir . 'sql_' . md5($query) . '.' . PHP_EXT, true);
return false;
}
@@ -382,11 +366,11 @@ class acm
*/
public function sql_save($query, &$query_result, $ttl)
{
- global $db, $phpEx;
+ global $db;
// Remove extra spaces and tabs
$query = preg_replace('/[\n\r\s\t]+/', ' ', $query);
- $filename = $this->cache_dir . 'sql_' . md5($query) . '.' . $phpEx;
+ $filename = $this->cache_dir . 'sql_' . md5($query) . '.' . PHP_EXT;
if ($fp = @fopen($filename, 'wb'))
{
diff --git a/phpBB/includes/acm/acm_memcache.php b/phpBB/includes/acm/acm_memcache.php
index fc17b04942..bbb556f173 100644
--- a/phpBB/includes/acm/acm_memcache.php
+++ b/phpBB/includes/acm/acm_memcache.php
@@ -34,7 +34,6 @@ class acm
*/
function __construct()
{
- global $phpbb_root_path;
$this->memcache = memcache_connect('localhost', 11211);
}
@@ -43,8 +42,6 @@ class acm
*/
private function load()
{
- global $phpEx;
-
// grab the global cache
if ($this->vars = memcache_get($this->memcache, 'global'))
{
@@ -87,8 +84,6 @@ class acm
*/
public function tidy()
{
- global $phpEx;
-
// cache has auto GC, no need to have any code here :)
set_config('cache_last_gc', time(), true);
@@ -101,8 +96,6 @@ class acm
{
if ($var_name[0] === '_')
{
- global $phpEx;
-
return memcache_get($this->memcache, $var_name);
}
else
@@ -172,8 +165,6 @@ class acm
*/
public function destroy($var_name, $table = '')
{
- global $phpEx;
-
if ($var_name === 'sql' && !empty($table))
{
if (!is_array($table))
@@ -222,8 +213,6 @@ class acm
*/
public function sql_load($query)
{
- global $phpEx;
-
// Remove extra spaces and tabs
$query = preg_replace('/[\n\r\s\t]+/', ' ', $query);
$query_id = sizeof($this->sql_rowset);
@@ -246,7 +235,7 @@ class acm
*/
public function sql_save($query, &$query_result, $ttl)
{
- global $db, $phpEx;
+ global $db;
// Remove extra spaces and tabs
$query = preg_replace('/[\n\r\s\t]+/', ' ', $query);
diff --git a/phpBB/includes/acm/acm_xcache.php b/phpBB/includes/acm/acm_xcache.php
index 542dc60abb..38db4d27d8 100644
--- a/phpBB/includes/acm/acm_xcache.php
+++ b/phpBB/includes/acm/acm_xcache.php
@@ -33,8 +33,7 @@ class acm
*/
function __construct()
{
- global $phpbb_root_path;
- $this->cache_dir = $phpbb_root_path . 'cache/';
+ $this->cache_dir = PHPBB_ROOT_PATH . 'cache/';
}
/**
@@ -42,8 +41,6 @@ class acm
*/
private function load()
{
- global $phpEx;
-
// grab the global cache
if (xcache_isset('global'))
{
@@ -87,8 +84,6 @@ class acm
*/
public function tidy()
{
- global $phpEx;
-
// cache has auto GC, no need to have any code here :)
set_config('cache_last_gc', time(), true);
@@ -101,8 +96,6 @@ class acm
{
if ($var_name[0] === '_')
{
- global $phpEx;
-
return (xcache_isset($var_name)) ? xcache_get($var_name) : false;
}
else
@@ -176,8 +169,6 @@ class acm
*/
public function destroy($var_name, $table = '')
{
- global $phpEx;
-
if ($var_name === 'sql' && !empty($table))
{
if (!is_array($table))
@@ -226,8 +217,6 @@ class acm
*/
public function sql_load($query)
{
- global $phpEx;
-
// Remove extra spaces and tabs
$query = preg_replace('/[\n\r\s\t]+/', ' ', $query);
$query_id = sizeof($this->sql_rowset);
@@ -250,7 +239,7 @@ class acm
*/
public function sql_save($query, &$query_result, $ttl)
{
- global $db, $phpEx;
+ global $db;
// Remove extra spaces and tabs
$query = preg_replace('/[\n\r\s\t]+/', ' ', $query);