Code Duplication    Length = 13-15 lines in 3 locations

install/Install.php 1 location

@@ 129-141 (lines=13) @@
126
127
    }
128
129
    function deleteUploadDirectory($f)
130
    {
131
        if ( is_dir( $f ) ){
132
            foreach ( scandir( $f ) as $item ){
133
                if ( !strcmp( $item, '.' ) || !strcmp( $item, '..' ) )
134
                    continue;
135
                $this->deleteUploadDirectory( $f . "/" . $item );
136
            }
137
            rmdir( $f );
138
        } else{
139
            @unlink( $f );
140
        }
141
    }
142
143
    /**
144
     * grants access to given modules

tests/unit/Filehandler/file_functions.php 2 locations

@@ 2-16 (lines=15) @@
1
<?php
2
function fht_deltree($f)
3
{
4
5
    if (is_dir($f)) {
6
        foreach (scandir($f) as $item) {
7
            if (!strcmp($item, '.') || !strcmp($item, '..')) {
8
                continue;
9
            }
10
            fht_deltree($f . "/" . $item);
11
        }
12
        rmdir($f);
13
    } else{
14
        @unlink($f);
15
    }
16
}
17
18
19
function iht_deltree($f)
@@ 19-33 (lines=15) @@
16
}
17
18
19
function iht_deltree($f)
20
{
21
22
    if (is_dir($f)) {
23
        foreach (scandir($f) as $item) {
24
            if (!strcmp($item, '.') || !strcmp($item, '..')) {
25
                continue;
26
            }
27
            iht_deltree($f . "/" . $item);
28
        }
29
        rmdir($f);
30
    } else{
31
        @unlink($f);
32
    }
33
}
34