mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-10 13:28:55 +00:00
[ticket/11605] Use empty_dir to better delete files and dirs of extensions
PHPBB3-11605
This commit is contained in:
parent
6f86c1dc76
commit
d02f98c635
1 changed files with 6 additions and 23 deletions
|
@ -54,14 +54,18 @@ class phpbb_test_case_helpers
|
||||||
{
|
{
|
||||||
global $phpbb_root_path;
|
global $phpbb_root_path;
|
||||||
|
|
||||||
|
// Remove all of the files we copied from test ext -> board ext
|
||||||
|
$this->empty_dir($phpbb_root_path . 'ext/');
|
||||||
|
|
||||||
// Copy back the board installed extensions from the temp directory
|
// Copy back the board installed extensions from the temp directory
|
||||||
if (file_exists($phpbb_root_path . 'store/temp_ext/'))
|
if (file_exists($phpbb_root_path . 'store/temp_ext/'))
|
||||||
{
|
{
|
||||||
$this->copy_dir($phpbb_root_path . 'store/temp_ext/', $phpbb_root_path . 'ext/');
|
$this->copy_dir($phpbb_root_path . 'store/temp_ext/', $phpbb_root_path . 'ext/');
|
||||||
|
|
||||||
|
// Remove all of the files we copied from board ext -> temp_ext
|
||||||
|
$this->empty_dir($phpbb_root_path . 'store/temp_ext/');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove all of the files we copied around (from board ext -> temp_ext, from test ext -> board ext)
|
|
||||||
$this->remove_files($this->copied_files);
|
|
||||||
$this->copied_files = array();
|
$this->copied_files = array();
|
||||||
|
|
||||||
if (file_exists($phpbb_root_path . 'store/temp_ext/'))
|
if (file_exists($phpbb_root_path . 'store/temp_ext/'))
|
||||||
|
@ -254,27 +258,6 @@ class phpbb_test_case_helpers
|
||||||
return $copied_files;
|
return $copied_files;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove files/directories that are listed in an array
|
|
||||||
* Designed for use with $this->copy_dir()
|
|
||||||
*
|
|
||||||
* @param array $file_list
|
|
||||||
*/
|
|
||||||
public function remove_files($file_list)
|
|
||||||
{
|
|
||||||
foreach ($file_list as $file)
|
|
||||||
{
|
|
||||||
if (is_dir($file))
|
|
||||||
{
|
|
||||||
rmdir($file);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
unlink($file);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Empty directory (remove any subdirectories/files below)
|
* Empty directory (remove any subdirectories/files below)
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Reference in a new issue