diff options
author | David M <davidmj@users.sourceforge.net> | 2008-01-06 02:21:44 +0000 |
---|---|---|
committer | David M <davidmj@users.sourceforge.net> | 2008-01-06 02:21:44 +0000 |
commit | 57645ad5bc2469e166cb3e5d54628d87ffa74c42 (patch) | |
tree | 2b7e47b0a2d4d07b8b1c3acbab5115d7b60ce606 /phpBB/includes/cache.php | |
parent | f0dea060972a48460ce64d3cdf885d82383763c6 (diff) | |
download | forums-57645ad5bc2469e166cb3e5d54628d87ffa74c42.tar forums-57645ad5bc2469e166cb3e5d54628d87ffa74c42.tar.gz forums-57645ad5bc2469e166cb3e5d54628d87ffa74c42.tar.bz2 forums-57645ad5bc2469e166cb3e5d54628d87ffa74c42.tar.xz forums-57645ad5bc2469e166cb3e5d54628d87ffa74c42.zip |
the end of an era...
- MySQL < 4.1.3 support is removed
- renamed mysql4 to mysql, no need to cause confusion
- changed the cfg cacher, reduces file system lookups and include count by two on every page load
git-svn-id: file:///svn/phpbb/trunk@8307 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/cache.php')
-rw-r--r-- | phpBB/includes/cache.php | 59 |
1 files changed, 27 insertions, 32 deletions
diff --git a/phpBB/includes/cache.php b/phpBB/includes/cache.php index c5445e7a56..af2c0ab9fa 100644 --- a/phpBB/includes/cache.php +++ b/phpBB/includes/cache.php @@ -316,51 +316,46 @@ class cache /** * Obtain cfg file data + * + * @param array $theme An array containing the path to the item + * + * @param string $item The specific item to get: 'theme', 'template', or 'imageset' + * */ - public static function obtain_cfg_items($theme) + public static function obtain_cfg_item($theme, $item = 'theme') { global $config, $phpbb_root_path, $cache; - $parsed_items = array( - 'theme' => array(), - 'template' => array(), - 'imageset' => array() - ); + $parsed_array = $cache->get('_cfg_' . $item . '_' . $theme[$item . '_path']); - foreach ($parsed_items as $key => $parsed_array) + if ($parsed_array === false) { - $parsed_array = $cache->get('_cfg_' . $key . '_' . $theme[$key . '_path']); - - if ($parsed_array === false) - { - $parsed_array = array(); - } + $parsed_array = array(); + } - $reparse = false; - $filename = $phpbb_root_path . 'styles/' . $theme[$key . '_path'] . '/' . $key . '/' . $key . '.cfg'; + $reparse = false; + $filename = $phpbb_root_path . 'styles/' . $theme[$item . '_path'] . '/' . $item . '/' . $item . '.cfg'; - if (!file_exists($filename)) - { - continue; - } + if (!file_exists($filename)) + { + return $parsed_array; + } - if (!isset($parsed_array['filetime']) || (($config['load_tplcompile'] && @filemtime($filename) > $parsed_array['filetime']))) - { - $reparse = true; - } + if (!isset($parsed_array['filetime']) || (($config['load_tplcompile'] && @filemtime($filename) > $parsed_array['filetime']))) + { + $reparse = true; + } - // Re-parse cfg file - if ($reparse) - { - $parsed_array = parse_cfg_file($filename); - $parsed_array['filetime'] = @filemtime($filename); + // Re-parse cfg file + if ($reparse) + { + $parsed_array = parse_cfg_file($filename); + $parsed_array['filetime'] = @filemtime($filename); - $cache->put('_cfg_' . $key . '_' . $theme[$key . '_path'], $parsed_array); - } - $parsed_items[$key] = $parsed_array; + $cache->put('_cfg_' . $item . '_' . $theme[$item . '_path'], $parsed_array); } - return $parsed_items; + return $parsed_array; } /** |