-
Notifications
You must be signed in to change notification settings - Fork 2
/
prune.php
34 lines (33 loc) · 944 Bytes
/
prune.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
include './archive_common.php.inc';
/**
* Loop through all of the test directories cleaning out any tests that have
* finished processing and have been archived successfully.
*/
archive_scan_dirs(function ($info) {
if (isset($info['dir']) && strlen($info['dir'])) {
$dir = $info['dir'];
$files = scandir($dir);
if ($files !== FALSE) {
$children = array();
foreach( $files as $file) {
if ($file != '.' &&
$file != '..' &&
is_dir("$dir/$file") &&
file_exists("$dir/$file/.ha_archived") &&
file_exists("$dir/$file/.ha_har")) {
$children[] = $file;
}
}
if (count($children)) {
foreach( $children as $child ) {
echo "Pruning $dir/$child\n";
delTree("$dir/$child");
}
}
}
// delete the directory if it is empty
@rmdir($dir);
}
}, true);
?>