You are here

function _auditfiles_not_in_database_is_file_in_database in Audit Files 7.3

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.

2 calls to _auditfiles_not_in_database_is_file_in_database()
_auditfiles_not_in_database_batch_display_process_files in ./auditfiles.notindatabase.inc
Retrieves file data from the database and checks if it is on the server.
_auditfiles_not_in_database_get_reports_files in ./auditfiles.notindatabase.inc
Recurse directories and add files to an array.

File

./auditfiles.notindatabase.inc, line 930
Generates a report showing files on the server, but not in the database.

Code

function _auditfiles_not_in_database_is_file_in_database($filepathname) {
  $file_uri = file_build_uri($filepathname);
  $query = "SELECT fid FROM {file_managed} WHERE uri = :file_uri";
  $fid = db_query($query, array(
    ':file_uri' => $file_uri,
  ))
    ->fetchField();
  return empty($fid) ? FALSE : TRUE;
}