diff options
author | Andreas Fischer <bantu@phpbb.com> | 2013-06-27 02:08:48 +0200 |
---|---|---|
committer | Andreas Fischer <bantu@phpbb.com> | 2013-06-27 02:08:48 +0200 |
commit | 960b20e45bda11a072102294d66837a2691893b9 (patch) | |
tree | 98bb51b1a27db7ff2ad10bfdf69d506119010329 /tests | |
parent | e0c572d1d843f4aefe3e8bb90f8ad1857a905a85 (diff) | |
parent | 8e575487ff73f3b9c05aceba7b71f06c6e0b032a (diff) | |
download | forums-960b20e45bda11a072102294d66837a2691893b9.tar forums-960b20e45bda11a072102294d66837a2691893b9.tar.gz forums-960b20e45bda11a072102294d66837a2691893b9.tar.bz2 forums-960b20e45bda11a072102294d66837a2691893b9.tar.xz forums-960b20e45bda11a072102294d66837a2691893b9.zip |
Merge remote-tracking branch 'Hardolaf/ticket/11618' into develop-olympus
* Hardolaf/ticket/11618:
[ticket/11618] Replace glob() with scandir() and string matching
Diffstat (limited to 'tests')
-rw-r--r-- | tests/template/template_test.php | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/tests/template/template_test.php b/tests/template/template_test.php index e532de294c..fd68124c89 100644 --- a/tests/template/template_test.php +++ b/tests/template/template_test.php @@ -69,9 +69,14 @@ class phpbb_template_template_test extends phpbb_test_case $this->markTestSkipped("Template cache directory ({$template_cache_dir}) is not writable."); } - foreach (glob($this->template->cachepath . '*') as $file) + $file_array = scandir($template_cache_dir); + $file_prefix = basename($this->template->cachepath); + foreach ($file_array as $file) { - unlink($file); + if (strpos($file, $file_prefix) === 0) + { + unlink($template_cache_dir . '/' . $file); + } } $GLOBALS['config'] = array( @@ -84,9 +89,15 @@ class phpbb_template_template_test extends phpbb_test_case { if (is_object($this->template)) { - foreach (glob($this->template->cachepath . '*') as $file) + $template_cache_dir = dirname($this->template->cachepath); + $file_array = scandir($template_cache_dir); + $file_prefix = basename($this->template->cachepath); + foreach ($file_array as $file) { - unlink($file); + if (strpos($file, $file_prefix) === 0) + { + unlink($template_cache_dir . '/' . $file); + } } } } |