You are here

function _auditfiles_not_in_database_get_reports_files in Audit Files 7.3

Recurse directories and add files to an array.

Return value

array The list of file names to display.

1 call to _auditfiles_not_in_database_get_reports_files()
auditfiles_not_in_database_form in ./auditfiles.notindatabase.inc
Generates the report.

File

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

Code

function _auditfiles_not_in_database_get_reports_files() {

  // Set up the variables for holding the file data.
  $report_files = array();
  $reported_files = array();
  _auditfiles_not_in_database_get_files_for_report('', $report_files);
  if (!empty($report_files)) {

    // 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 chosen date format for displaying the file dates with.
    $date_format = variable_get('auditfiles_report_options_date_format', 'long');
    foreach ($report_files as $report_file) {

      // Check to see if the file is in the database.
      if (empty($report_file['path_from_files_root'])) {
        $file_to_check = $report_file['file_name'];
      }
      else {
        $file_to_check = $report_file['path_from_files_root'] . DIRECTORY_SEPARATOR . $report_file['file_name'];
      }
      $file_in_database = _auditfiles_not_in_database_is_file_in_database($file_to_check);

      // If the file is not in the database, add it to the list for displaying.
      if (!$file_in_database) {

        // Gets the file's information (size, date, etc.) and assempbles the
        // array for the table.
        $reported_files += _auditfiles_not_in_database_format_row_data($report_file, $real_files_path, $date_format);
      }
    }
  }
  return $reported_files;
}