mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 01:16:44 +02:00
MDL-55174 core_testing: Use proper directory separator
While searching for existing files if directory separator is not correct then original files and directories will be deleted. So use DIRECTORY_SEPARATOR.
This commit is contained in:
parent
36a19ecc26
commit
fc2e137750
1 changed files with 5 additions and 3 deletions
|
@ -798,7 +798,7 @@ abstract class testing_util {
|
|||
if (file_exists(self::get_dataroot() . '/filedir')) {
|
||||
$handle = opendir(self::get_dataroot() . '/filedir');
|
||||
while (false !== ($item = readdir($handle))) {
|
||||
if (in_array('filedir/' . $item, $childclassname::$datarootskiponreset)) {
|
||||
if (in_array('filedir' . DIRECTORY_SEPARATOR . $item, $childclassname::$datarootskiponreset)) {
|
||||
continue;
|
||||
}
|
||||
if (is_dir(self::get_dataroot()."/filedir/$item")) {
|
||||
|
@ -1054,8 +1054,10 @@ abstract class testing_util {
|
|||
if (!file_exists($jsonfilepath)) {
|
||||
|
||||
$listfiles = array();
|
||||
$listfiles['filedir/.'] = 'filedir/.';
|
||||
$listfiles['filedir/..'] = 'filedir/..';
|
||||
$currentdir = 'filedir' . DIRECTORY_SEPARATOR . '.';
|
||||
$parentdir = 'filedir' . DIRECTORY_SEPARATOR . '..';
|
||||
$listfiles[$currentdir] = $currentdir;
|
||||
$listfiles[$parentdir] = $parentdir;
|
||||
|
||||
$filedir = self::get_dataroot() . '/filedir';
|
||||
if (file_exists($filedir)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue