Skip to content

Commit a14e293

Browse files
committed
fix test run, missing helper
1 parent 6ae74eb commit a14e293

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
function removeDirRecursive($dir) {
4+
if (!is_dir($dir)) return;
5+
try {
6+
$iterator = new RecursiveIteratorIterator(
7+
new RecursiveDirectoryIterator($dir, RecursiveDirectoryIterator::SKIP_DOTS),
8+
RecursiveIteratorIterator::CHILD_FIRST
9+
);
10+
foreach ($iterator as $fileinfo) {
11+
if ($fileinfo->isDir()) {
12+
@rmdir($fileinfo->getRealPath());
13+
} else {
14+
@unlink($fileinfo->getRealPath());
15+
}
16+
}
17+
@rmdir($dir);
18+
} catch (UnexpectedValueException $e) { @rmdir($dir); } catch (Exception $e) { @rmdir($dir); }
19+
}

0 commit comments

Comments
 (0)