From 7aa4d8fce2e61776d5f2dbf67386a589bcd7d634 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 7 Nov 2013 12:56:10 +0100 Subject: [ticket/11927] Correctly add new files on update Currently we ignore language and style files when the directory where they go to do not exist. However in 3.1 we introduce some new sub directories: * language/en/email/short/ * styles/prosilver/theme/en/ So we need to change our check to look whether the language or style exist, rather then the parent directory. PHPBB3-11927 --- phpBB/includes/functions_install.php | 39 ++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'phpBB/includes/functions_install.php') diff --git a/phpBB/includes/functions_install.php b/phpBB/includes/functions_install.php index 1be6e49471..be0ecd4306 100644 --- a/phpBB/includes/functions_install.php +++ b/phpBB/includes/functions_install.php @@ -533,3 +533,42 @@ function phpbb_create_config_file_data($data, $dbms, $debug = false, $debug_test return $config_data; } + +/** +* +*/ +function ignore_new_file_on_update($phpbb_root_path, $file) +{ + $ignore_new_file = false; + + // We ignore new files in some circumstances: + // 1. The file is a language file, but the language is not installed + if (!$ignore_new_file && strpos($file, 'language/') === 0) + { + list($language_dir, $language_iso) = explode('/', $file); + $ignore_new_file = !file_exists($phpbb_root_path . $language_dir . '/' . $language_iso); + } + + // 2. The file is a style file, but the style is not installed + if (!$ignore_new_file && strpos($file, 'styles/') === 0) + { + list($styles_dir, $style_name) = explode('/', $file); + $ignore_new_file = !file_exists($phpbb_root_path . $styles_dir . '/' . $style_name); + } + + // 3. The file is a style language file, but the language is not installed + if (!$ignore_new_file && strpos($file, 'styles/') === 0) + { + $dirs = explode('/', $file); + if ($dirs >= 5) + { + list($styles_dir, $style_name, $template_component, $language_iso) = explode('/', $file); + if ($template_component == 'theme' && $language_iso !== 'images') + { + $ignore_new_file = !file_exists($phpbb_root_path . 'language/' . $language_iso); + } + } + } + + return $ignore_new_file; +} -- cgit v1.2.1 From 0e33c8d3d2fe830490771f7d1a357612b297ef96 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 7 Nov 2013 13:26:43 +0100 Subject: [ticket/11927] Add doc block to new function PHPBB3-11927 --- phpBB/includes/functions_install.php | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'phpBB/includes/functions_install.php') diff --git a/phpBB/includes/functions_install.php b/phpBB/includes/functions_install.php index be0ecd4306..25b594cac3 100644 --- a/phpBB/includes/functions_install.php +++ b/phpBB/includes/functions_install.php @@ -535,7 +535,16 @@ function phpbb_create_config_file_data($data, $dbms, $debug = false, $debug_test } /** +* Check whether a file should be ignored on update * +* We ignore new files in some circumstances: +* 1. The file is a language file, but the language is not installed +* 2. The file is a style file, but the style is not installed +* 3. The file is a style language file, but the language is not installed +* +* @param string $phpbb_root_path phpBB root path +* @param string $file File including path from phpbb root +* @return bool Should we ignore the new file or add it to the board? */ function ignore_new_file_on_update($phpbb_root_path, $file) { -- cgit v1.2.1 From 95348c8f6d64302d2d525f2ba1a9408f1510144b Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 7 Nov 2013 13:49:55 +0100 Subject: [ticket/11927] Prefix function with phpbb_ PHPBB3-11927 --- phpBB/includes/functions_install.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/functions_install.php') diff --git a/phpBB/includes/functions_install.php b/phpBB/includes/functions_install.php index 25b594cac3..10e9878cc8 100644 --- a/phpBB/includes/functions_install.php +++ b/phpBB/includes/functions_install.php @@ -546,7 +546,7 @@ function phpbb_create_config_file_data($data, $dbms, $debug = false, $debug_test * @param string $file File including path from phpbb root * @return bool Should we ignore the new file or add it to the board? */ -function ignore_new_file_on_update($phpbb_root_path, $file) +function phpbb_ignore_new_file_on_update($phpbb_root_path, $file) { $ignore_new_file = false; -- cgit v1.2.1 From 5fe822021bc284f756ca9361f15220dbbefb31d4 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 19 Nov 2013 00:23:49 +0100 Subject: [ticket/12023] Correctly compare the size of the array in ignore_new_files PHPBB3-12023 --- phpBB/includes/functions_install.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/functions_install.php') diff --git a/phpBB/includes/functions_install.php b/phpBB/includes/functions_install.php index 10e9878cc8..deb304b838 100644 --- a/phpBB/includes/functions_install.php +++ b/phpBB/includes/functions_install.php @@ -569,7 +569,7 @@ function phpbb_ignore_new_file_on_update($phpbb_root_path, $file) if (!$ignore_new_file && strpos($file, 'styles/') === 0) { $dirs = explode('/', $file); - if ($dirs >= 5) + if (sizeof($dirs) >= 5) { list($styles_dir, $style_name, $template_component, $language_iso) = explode('/', $file); if ($template_component == 'theme' && $language_iso !== 'images') -- cgit v1.2.1