mirror of
https://github.com/phpbb/phpbb.git
synced 2025-05-20 14:29:48 +02:00
Merge remote-tracking branch 'nickvergessen/ticket/11605' into develop
* nickvergessen/ticket/11605: [ticket/11605] Remove unused copied_files property [ticket/11605] Use empty_dir to better delete files and dirs of extensions
This commit is contained in:
commit
97c29c3876
@ -18,8 +18,6 @@ class phpbb_test_case_helpers
|
|||||||
$this->test_case = $test_case;
|
$this->test_case = $test_case;
|
||||||
}
|
}
|
||||||
|
|
||||||
private $copied_files = array();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This should only be called once before the tests are run.
|
* This should only be called once before the tests are run.
|
||||||
* This is used to copy the fixtures to the phpBB install
|
* This is used to copy the fixtures to the phpBB install
|
||||||
@ -28,12 +26,10 @@ class phpbb_test_case_helpers
|
|||||||
{
|
{
|
||||||
global $phpbb_root_path;
|
global $phpbb_root_path;
|
||||||
|
|
||||||
$this->copied_files = array();
|
|
||||||
|
|
||||||
if (file_exists($phpbb_root_path . 'ext/'))
|
if (file_exists($phpbb_root_path . 'ext/'))
|
||||||
{
|
{
|
||||||
// First, move any extensions setup on the board to a temp directory
|
// First, move any extensions setup on the board to a temp directory
|
||||||
$this->copied_files = $this->copy_dir($phpbb_root_path . 'ext/', $phpbb_root_path . 'store/temp_ext/');
|
$this->copy_dir($phpbb_root_path . 'ext/', $phpbb_root_path . 'store/temp_ext/');
|
||||||
|
|
||||||
// Then empty the ext/ directory on the board (for accurate test cases)
|
// Then empty the ext/ directory on the board (for accurate test cases)
|
||||||
$this->empty_dir($phpbb_root_path . 'ext/');
|
$this->empty_dir($phpbb_root_path . 'ext/');
|
||||||
@ -42,7 +38,7 @@ class phpbb_test_case_helpers
|
|||||||
// Copy our ext/ files from the test case to the board
|
// Copy our ext/ files from the test case to the board
|
||||||
foreach ($fixtures as $fixture)
|
foreach ($fixtures as $fixture)
|
||||||
{
|
{
|
||||||
$this->copied_files = array_merge($this->copied_files, $this->copy_dir($fixtures_dir . $fixture, $phpbb_root_path . 'ext/' . $fixture));
|
$this->copy_dir($fixtures_dir . $fixture, $phpbb_root_path . 'ext/' . $fixture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,15 +50,17 @@ 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 around (from board ext -> temp_ext, from test ext -> board ext)
|
// Remove all of the files we copied from board ext -> temp_ext
|
||||||
$this->remove_files($this->copied_files);
|
$this->empty_dir($phpbb_root_path . 'store/temp_ext/');
|
||||||
$this->copied_files = array();
|
}
|
||||||
|
|
||||||
if (file_exists($phpbb_root_path . 'store/temp_ext/'))
|
if (file_exists($phpbb_root_path . 'store/temp_ext/'))
|
||||||
{
|
{
|
||||||
@ -254,27 +252,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…
x
Reference in New Issue
Block a user