You are here

function file_module_test_file_download in Drupal 7

Implements hook_file_download().

File

modules/file/tests/file_module_test.module, line 74
Provides File module pages for testing purposes.

Code

function file_module_test_file_download($uri) {
  if (variable_get('file_module_test_grant_download_access')) {

    // Mimic what file_get_content_headers() would do if we had a full $file
    // object to pass to it.
    return array(
      'Content-Type' => mime_header_encode(file_get_mimetype($uri)),
      'Content-Length' => filesize($uri),
      'Cache-Control' => 'private',
    );
  }
}