function ServiceAuditFilesNotInDatabase::_auditfiles_not_in_database_is_file_in_database in Audit Files 8
Checks if the specified file is in the database.
Parameters
string $filepathname: The path and filename, from the "files" directory, of the file to check.
Return value
bool Returns TRUE if the file was found in the database, or FALSE, if not.
1 call to ServiceAuditFilesNotInDatabase::_auditfiles_not_in_database_is_file_in_database()
- ServiceAuditFilesNotInDatabase::_auditfiles_not_in_database_get_reports_files in src/
ServiceAuditFilesNotInDatabase.php - Get the files that are not in database.
File
- src/
ServiceAuditFilesNotInDatabase.php, line 96 - providing the service that used in not in database functionality.
Class
Namespace
Drupal\auditfilesCode
function _auditfiles_not_in_database_is_file_in_database($filepathname) {
$file_uri = file_build_uri($filepathname);
$connection = Database::getConnection();
$query = $connection
->select('file_managed', 'fm');
$query
->condition('fm.uri', $file_uri);
$query
->fields('fm', [
'fid',
]);
$fid = $query
->execute()
->fetchField();
return empty($fid) ? FALSE : TRUE;
}