You are here

function backup_migrate_file_download in Backup and Migrate 6

Same name and namespace in other branches
  1. 5 backup_migrate.module \backup_migrate_file_download()

Implementation of hook_file_download.()

Allow users with the appropriate permissions to download backup files.

File

./backup_migrate.module, line 899
Create (manually or scheduled) and restore backups of your Drupal MySQL database with an option to exclude table data (f.e. cache_*)

Code

function backup_migrate_file_download($path) {
  if ($path = _backup_migrate_path_is_in_save_dir($path)) {
    if (user_access('access backup files') && ($info = _backup_migrate_file_info($path))) {
      return array(
        'Content-Type: ' . $info['filemime'],
        'Content-Length: ' . $info['filesize'],
        'Content-Disposition: attachment; filename="' . $info['filename'] . '"',
      );
    }
    else {
      return -1;
    }
  }
  return NULL;
}