function _auditfiles_not_in_database_get_files in Audit Files 7.3
Retrieves a list of files in the given path.
Parameters
string $path: The path to search for files in.
Return value
array The list of files and diretories found in the given path.
2 calls to _auditfiles_not_in_database_get_files()
- _auditfiles_not_in_database_batch_display_get_files in ./
auditfiles.notindatabase.inc - Recurse directories and add files to an array.
- _auditfiles_not_in_database_get_files_for_report in ./
auditfiles.notindatabase.inc - Updates a list of files with files found in the specified path.
File
- ./
auditfiles.notindatabase.inc, line 797 - Generates a report showing files on the server, but not in the database.
Code
function _auditfiles_not_in_database_get_files($path) {
// Get the static paths necessary for processing the files.
$file_system_stream = variable_get('auditfiles_file_system_path', 'public');
// The full file system path to the Drupal root directory.
$real_files_path = drupal_realpath($file_system_stream . '://');
// Get the list of any excluded files, extensions, and/or directories.
$exclusions = _auditfiles_get_exclusions();
// The variable to store the data being returned.
$file_list = array();
if (empty($path)) {
$scan_path = $real_files_path;
}
else {
$scan_path = $real_files_path . DIRECTORY_SEPARATOR . $path;
}
// Get the files in the specified directory.
$files = scandir($scan_path);
foreach ($files as $file) {
if ($file != '.' && $file != '..') {
// Check to see if this file should be included.
$include_file = _auditfiles_not_in_database_include_file($real_files_path . DIRECTORY_SEPARATOR . $path, $file, $exclusions);
if ($include_file) {
// The file is to be included, so add it to the data array.
$file_list[] = array(
'file_name' => $file,
'path_from_files_root' => $path,
);
}
}
}
return $file_list;
}