From 7a04c9048c110f0bd21ea3e9e869e17b408d640e Mon Sep 17 00:00:00 2001 From: Unknown Date: Sat, 31 Dec 2011 13:32:52 +0000 Subject: [ticket/9916] Updating header license and removing Version $Id$ PHPBB3-9916 --- phpBB/includes/cache/service.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/cache/service.php') diff --git a/phpBB/includes/cache/service.php b/phpBB/includes/cache/service.php index 0c01953d55..aa225ade69 100644 --- a/phpBB/includes/cache/service.php +++ b/phpBB/includes/cache/service.php @@ -3,7 +3,7 @@ * * @package acm * @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ -- cgit v1.2.1 From 33b72ec62bd8b6e6c890e4c474d28389f048632a Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Mon, 2 Apr 2012 11:45:26 +0300 Subject: [ticket/10743] Changing obtain_cfg_items Changing obtain_cfg_items to work only with style because other components no longer exist PHPBB3-10743 --- phpBB/includes/cache/service.php | 55 ++++++++++++++++------------------------ 1 file changed, 22 insertions(+), 33 deletions(-) (limited to 'phpBB/includes/cache/service.php') diff --git a/phpBB/includes/cache/service.php b/phpBB/includes/cache/service.php index aa225ade69..37f32aa753 100644 --- a/phpBB/includes/cache/service.php +++ b/phpBB/includes/cache/service.php @@ -321,50 +321,39 @@ class phpbb_cache_service /** * Obtain cfg file data */ - function obtain_cfg_items($theme) + function obtain_cfg_items($style) { global $config, $phpbb_root_path; - $parsed_items = array( - 'theme' => array(), - 'template' => array(), - 'imageset' => array() - ); + $parsed_array = $this->driver->get('_cfg_' . $style['style_path']); - foreach ($parsed_items as $key => $parsed_array) + if ($parsed_array === false) { - $parsed_array = $this->driver->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/' . $style['style_path'] . '/style.cfg'; - if (!file_exists($filename)) - { - continue; - } + if (!file_exists($filename)) + { + continue; + } - 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); - $this->driver->put('_cfg_' . $key . '_' . $theme[$key . '_path'], $parsed_array); - } - $parsed_items[$key] = $parsed_array; + $this->driver->put('_cfg_' . $style['style_path'], $parsed_array); } - - return $parsed_items; + return $parsed_array; } /** -- cgit v1.2.1 From 2c1da15ae83e292d3aa9c94f740d6bff6bfd238e Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Mon, 30 Jul 2012 16:23:18 -0500 Subject: [ticket/11029] Cache obtain_cfg_items should return empty array on failure continue was used where it should not have been, causing a fatal error This file is loaded on every page to check if style.cfg has changed. If it has not, the user is not affected, so if it does not exist, the user should not be affected either. PHPBB3-11029 --- phpBB/includes/cache/service.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/cache/service.php') diff --git a/phpBB/includes/cache/service.php b/phpBB/includes/cache/service.php index 37f32aa753..5946241825 100644 --- a/phpBB/includes/cache/service.php +++ b/phpBB/includes/cache/service.php @@ -337,7 +337,7 @@ class phpbb_cache_service if (!file_exists($filename)) { - continue; + return array(); } if (!isset($parsed_array['filetime']) || (($config['load_tplcompile'] && @filemtime($filename) > $parsed_array['filetime']))) -- cgit v1.2.1 From 907f1771f9594ee1906c5b0ad7fac765f2a1995d Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Mon, 6 Aug 2012 15:05:06 -0500 Subject: [ticket/11029] Return $parsed_array (may have loaded from the cache) Even if the file does not exist, it may be in the cache, so return $parsed_array just in case PHPBB3-11029 --- phpBB/includes/cache/service.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/cache/service.php') diff --git a/phpBB/includes/cache/service.php b/phpBB/includes/cache/service.php index 5946241825..b29af3c531 100644 --- a/phpBB/includes/cache/service.php +++ b/phpBB/includes/cache/service.php @@ -337,7 +337,7 @@ class phpbb_cache_service if (!file_exists($filename)) { - return array(); + return $parsed_array; } if (!isset($parsed_array['filetime']) || (($config['load_tplcompile'] && @filemtime($filename) > $parsed_array['filetime']))) -- cgit v1.2.1 From 1b126908c633fa793cf7f3fba1e88139bb599938 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Mon, 6 Aug 2012 15:10:20 -0500 Subject: [ticket/11029] Remove $reparse variable Its only set to false, then true in one case, and only checked once. So remove it because it is unnecessary. PHPBB3-11029 --- phpBB/includes/cache/service.php | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'phpBB/includes/cache/service.php') diff --git a/phpBB/includes/cache/service.php b/phpBB/includes/cache/service.php index b29af3c531..e63ec6e33a 100644 --- a/phpBB/includes/cache/service.php +++ b/phpBB/includes/cache/service.php @@ -332,7 +332,6 @@ class phpbb_cache_service $parsed_array = array(); } - $reparse = false; $filename = $phpbb_root_path . 'styles/' . $style['style_path'] . '/style.cfg'; if (!file_exists($filename)) @@ -342,17 +341,13 @@ class phpbb_cache_service if (!isset($parsed_array['filetime']) || (($config['load_tplcompile'] && @filemtime($filename) > $parsed_array['filetime']))) { - $reparse = true; - } - - // Re-parse cfg file - if ($reparse) - { + // Re-parse cfg file $parsed_array = parse_cfg_file($filename); $parsed_array['filetime'] = @filemtime($filename); $this->driver->put('_cfg_' . $style['style_path'], $parsed_array); } + return $parsed_array; } -- cgit v1.2.1