aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul S. Owen <psotfx@users.sourceforge.net>2003-07-17 15:16:25 +0000
committerPaul S. Owen <psotfx@users.sourceforge.net>2003-07-17 15:16:25 +0000
commitbf70fee1520d6a5302b8533d83a09f0b5b5a4ce2 (patch)
tree6e07c3cd0402a7bedd88ad50949398f17de9fb22
parent947c81b3db857518a89b9120c6c0ec460e8eeb1b (diff)
downloadforums-bf70fee1520d6a5302b8533d83a09f0b5b5a4ce2.tar
forums-bf70fee1520d6a5302b8533d83a09f0b5b5a4ce2.tar.gz
forums-bf70fee1520d6a5302b8533d83a09f0b5b5a4ce2.tar.bz2
forums-bf70fee1520d6a5302b8533d83a09f0b5b5a4ce2.tar.xz
forums-bf70fee1520d6a5302b8533d83a09f0b5b5a4ce2.zip
Remove subfolder storage of templates ... a safe-mode thang, you can delete any existing cache/templates folder
git-svn-id: file:///svn/phpbb/trunk@4273 89ea8834-ac86-4346-8a33-228a782c2dd0
-rw-r--r--phpBB/includes/acm/acm_file.php16
-rw-r--r--phpBB/includes/template.php18
-rw-r--r--phpBB/install/install.php4
3 files changed, 17 insertions, 21 deletions
diff --git a/phpBB/includes/acm/acm_file.php b/phpBB/includes/acm/acm_file.php
index dfe31e6cc2..a79e8913d7 100644
--- a/phpBB/includes/acm/acm_file.php
+++ b/phpBB/includes/acm/acm_file.php
@@ -37,7 +37,7 @@ class acm
function load()
{
global $phpEx;
- @include($this->cache_dir . 'global.' . $phpEx);
+ @include($this->cache_dir . 'data_global.' . $phpEx);
}
function unload()
@@ -58,7 +58,7 @@ class acm
global $phpEx;
$file = '<?php $this->vars=' . $this->format_array($this->vars) . ";\n\$this->vars_ts=" . $this->format_array($this->vars_ts) . ' ?>';
- if ($fp = @fopen($this->cache_dir . 'global.' . $phpEx, 'wb'))
+ if ($fp = @fopen($this->cache_dir . 'data_global.' . $phpEx, 'wb'))
{
@flock($fp, LOCK_EX);
fwrite($fp, $file);
@@ -74,16 +74,18 @@ class acm
$dir = opendir($this->cache_dir);
while ($entry = readdir($dir))
{
- if ($entry{0} == '.' || is_dir($this->cache_dir . $entry))
+ if ($entry{0} == '.' || substr($entry, 0, 4) != 'sql_')
{
continue;
}
+
if (time() - $expire_time >= filemtime($this->cache_dir . $entry))
{
unlink($this->cache_dir . $entry);
}
}
- if (file_exists($this->cache_dir . 'global.' . $phpEx))
+
+ if (file_exists($this->cache_dir . 'data_global.' . $phpEx))
{
foreach ($this->vars_ts as $varname => $timestamp)
{
@@ -173,13 +175,13 @@ class acm
// Remove extra spaces and tabs
$query = preg_replace('/[\n\r\s\t]+/', ' ', $query);
- $filemtime = intval(@filemtime($this->cache_dir . md5($query) . '.' . $phpEx));
+ $filemtime = intval(@filemtime($this->cache_dir . 'sql_' . md5($query) . '.' . $phpEx));
if (time() - $filemtime > $expire_time)
{
return FALSE;
}
- include($this->cache_dir . md5($query) . '.' . $phpEx);
+ include($this->cache_dir . 'sql_' . md5($query) . '.' . $phpEx);
$query_id = 'Cache id #' . count($this->sql_rowset);
$this->sql_rowset[$query_id] = $rowset;
@@ -194,7 +196,7 @@ class acm
// Remove extra spaces and tabs
$query = preg_replace('/[\n\r\s\t]+/', ' ', $query);
- if ($fp = @fopen($this->cache_dir . md5($query) . '.' . $phpEx, 'wb'))
+ if ($fp = @fopen($this->cache_dir . 'sql_' . md5($query) . '.' . $phpEx, 'wb'))
{
@flock($fp, LOCK_EX);
diff --git a/phpBB/includes/template.php b/phpBB/includes/template.php
index 20a806d603..3c765a03a2 100644
--- a/phpBB/includes/template.php
+++ b/phpBB/includes/template.php
@@ -50,7 +50,7 @@ class template
// Root dir and hash of filenames for each template handle.
var $tpl = '';
var $root = '';
- var $cache_root = 'cache/templates/';
+ var $cachepath = '';
var $files = array();
// this will hash handle names to the compiled/uncompiled code for that handle.
@@ -72,24 +72,18 @@ class template
{
// $this->tpl = 'primary';
$this->root = $phpbb_root_path . 'styles/templates/' . $user->theme['primary']['template_path'];
- $this->cachedir = $phpbb_root_path . $this->cache_root . $user->theme['primary']['template_path'] . '/';
+ $this->cachepath = $phpbb_root_path . 'cache/tpl_' . $user->theme['primary']['template_path'] . '_';
}
else
{
// $this->tpl = 'secondary';
$this->root = $phpbb_root_path . 'styles/templates/' . $user->theme['secondary']['template_path'];
- $this->cachedir = $phpbb_root_path . $this->cache_root . $user->theme['secondary']['template_path'] . '/';
+ $this->cachepath = $phpbb_root_path . 'cache/tpl_' . $user->theme['secondary']['template_path'] . '_';
}
$this->static_lang = $static_lang;
$this->force_recompile = $force_recompile;
- if (!file_exists($this->cachedir))
- {
- @umask(0);
- mkdir($this->cachedir, 0777);
- }
-
return true;
}
@@ -148,7 +142,7 @@ class template
{
global $phpEx, $user;
- $filename = $this->cachedir . $this->filename[$handle] . '.' . (($this->static_lang) ? $user->data['user_lang'] . '.' : '') . $phpEx;
+ $filename = $this->cachepath . $this->filename[$handle] . '.' . (($this->static_lang) ? $user->data['user_lang'] . '.' : '') . $phpEx;
// Recompile page if the original template is newer, otherwise load the compiled version
if (file_exists($filename) && !$this->force_recompile)
@@ -182,7 +176,7 @@ class template
trigger_error("template->_tpl_load(): File $filename does not exist or is empty", E_USER_ERROR);
}
- $str = fread($fp, filesize($this->files[$handle]));
+ $str = @fread($fp, filesize($this->files[$handle]));
@fclose($fp);
// Actually compile the code now.
@@ -718,7 +712,7 @@ class template
{
global $phpEx, $user;
- $filename = $this->cachedir . $this->filename[$handle] . '.' . (($this->static_lang) ? $user->data['user_lang'] . '.' : '') . $phpEx;
+ $filename = $this->cachepath . $this->filename[$handle] . '.' . (($this->static_lang) ? $user->data['user_lang'] . '.' : '') . $phpEx;
if ($fp = @fopen($filename, 'w+'))
{
diff --git a/phpBB/install/install.php b/phpBB/install/install.php
index 97a94f942b..b4502fcbc0 100644
--- a/phpBB/install/install.php
+++ b/phpBB/install/install.php
@@ -413,7 +413,7 @@ if ($stage == 0)
foreach ($locations as $location)
{
- if (file_exists($location . 'convert' . $exe) && is_readable($location . 'convert' . $exe))
+ if (@file_exists($location . 'convert' . $exe) && @is_readable($location . 'convert' . $exe))
{
$img_imagick = str_replace('\\', '/', $location);
continue;
@@ -445,7 +445,7 @@ if ($stage == 0)
<table cellspacing="1" cellpadding="4" border="0">
<?php
- $directories = array('cache/', 'cache/templates/', 'cache/themes/', 'cache/tmp/', 'files/');
+ $directories = array('cache/', 'files/');
umask(0);