diff options
author | Nathan Guse <nathaniel.guse@gmail.com> | 2013-11-11 09:40:50 -0800 |
---|---|---|
committer | Nathan Guse <nathaniel.guse@gmail.com> | 2013-11-11 09:40:50 -0800 |
commit | d69f35d4507be98c384a0bb6232ebe08c36864c0 (patch) | |
tree | 37819371cfbcac3b4c836a7b035a947d0b4c9b07 /phpBB/includes | |
parent | cfb0a4103083c4787beca30671d16eede92bd571 (diff) | |
parent | 95348c8f6d64302d2d525f2ba1a9408f1510144b (diff) | |
download | forums-d69f35d4507be98c384a0bb6232ebe08c36864c0.tar forums-d69f35d4507be98c384a0bb6232ebe08c36864c0.tar.gz forums-d69f35d4507be98c384a0bb6232ebe08c36864c0.tar.bz2 forums-d69f35d4507be98c384a0bb6232ebe08c36864c0.tar.xz forums-d69f35d4507be98c384a0bb6232ebe08c36864c0.zip |
Merge pull request #1853 from nickvergessen/ticket/11927
[ticket/11927] Correctly add new files on update
Diffstat (limited to 'phpBB/includes')
-rw-r--r-- | phpBB/includes/functions_install.php | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/phpBB/includes/functions_install.php b/phpBB/includes/functions_install.php index 1be6e49471..10e9878cc8 100644 --- a/phpBB/includes/functions_install.php +++ b/phpBB/includes/functions_install.php @@ -533,3 +533,51 @@ function phpbb_create_config_file_data($data, $dbms, $debug = false, $debug_test return $config_data; } + +/** +* 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 phpbb_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; +} |