Skip to content

Commit

Permalink
MDL-43266 testing: Removing duplicated keys
Browse files Browse the repository at this point in the history
  • Loading branch information
David Monllao committed Mar 12, 2014
1 parent f411652 commit 322a47d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/testing/classes/util.php
Expand Up @@ -861,18 +861,19 @@ protected static function save_original_data_files() {
if (!file_exists($jsonfilepath)) {

$listfiles = array();
$listfiles[] = 'filedir/.';
$listfiles[] = 'filedir/..';
$listfiles['filedir/.'] = 'filedir/.';
$listfiles['filedir/..'] = 'filedir/..';

$filedir = self::get_dataroot() . '/filedir';
if (file_exists($filedir)) {
$directory = new RecursiveDirectoryIterator($filedir);
foreach (new RecursiveIteratorIterator($directory) as $file) {
if ($file->isDir()) {
$listfiles[] = substr($file->getPath(), strlen(self::get_dataroot() . '/'));
$key = substr($file->getPath(), strlen(self::get_dataroot() . '/'));
} else {
$listfiles[] = substr($file->getPathName(), strlen(self::get_dataroot() . '/'));
$key = substr($file->getPathName(), strlen(self::get_dataroot() . '/'));
}
$listfiles[$key] = $key;
}
}

Expand Down

0 comments on commit 322a47d

Please sign in to comment.