function _auditfiles_directorytoarray in Audit Files 5
Same name and namespace in other branches
- 6.3 notindb.admin.inc \_auditfiles_directorytoarray()
- 6.2 notindb.admin.inc \_auditfiles_directorytoarray()
Helper function - recurse directories and files in to an array http://snippets.dzone.com/posts/show/155
1 call to _auditfiles_directorytoarray()
- _auditfiles_filesnotindb in ./
auditfiles.module - Helper function - retrieve sorted list of files that are on the server but not in the database
File
- ./
auditfiles.module, line 248
Code
function _auditfiles_directorytoarray($directory, $recursive) {
$array_items = array();
if ($handle = opendir($directory)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
if (is_dir($directory . "/" . $file)) {
if ($recursive) {
$array_items = array_merge($array_items, _auditfiles_directorytoarray($directory . "/" . $file, $recursive));
}
$file = $directory . "/" . $file;
$array_items[] = preg_replace("/\\/\\//si", "/", $file);
}
else {
$file = $directory . "/" . $file;
$array_items[] = preg_replace("/\\/\\//si", "/", $file);
}
}
}
closedir($handle);
}
return $array_items;
}