protected function UnmanagedFilesService::getFiles in Fancy File Delete 2.0.x
Answer an array of unmanaged files contained in the directories provided.
Parameters
array $paths Directory paths e.g. array("public://", "public://media"):
Return value
array of file objects.
1 call to UnmanagedFilesService::getFiles()
- UnmanagedFilesService::updateView in src/
UnmanagedFilesService.php - Updates the view and populates the unmanaged files table.
File
- src/
UnmanagedFilesService.php, line 206
Class
- UnmanagedFilesService
- Class UnmanagedFilesService.
Namespace
Drupal\fancy_file_deleteCode
protected function getFiles(array $paths) {
// Get all files from default standard file dir.
foreach ($paths as $path) {
$files[] = $this
->getFileUris($path);
}
$file_check = array_merge(...$files);
if ($file_check === NULL) {
$file_check = [];
}
// All the files in the file_managed table
// I changed this to use $this->database->query for performance.
// see issue: https://www.drupal.org/node/2637028
$query = $this->database
->query('SELECT uri FROM {file_managed}');
$db_check = [];
// Set this to a numeric keyed array so we can check this easier.
foreach ($query
->fetchAll() as $result) {
$db_check[] = $result->uri;
}
// Get the files not in the file_managed table.
return array_diff($file_check, $db_check);
}