function _backup_migrate_send_file_to_download in Backup and Migrate 5
Same name and namespace in other branches
- 6 backup_migrate.module \_backup_migrate_send_file_to_download()
Force a browser download for the file.
1 call to _backup_migrate_send_file_to_download()
- _backup_migrate_dump_tables in ./
backup_migrate.module - Build the database dump file. Takes a list of tables to exclude and some formatting options.
File
- ./
backup_migrate.module, line 570 - 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_send_file_to_download($filename, $filetype, $file_path) {
header('Content-Type: ' . $filetype);
header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Content-Length: ' . filesize($file_path));
header('Content-Disposition: attachment; filename="' . $filename . '"');
// Transfer file in 1024 byte chunks to save memory usage.
if ($fd = fopen($file_path, 'rb')) {
while (!feof($fd)) {
print fread($fd, 1024);
}
fclose($fd);
}
// Delete any temporary files we've created.
_backup_migrate_temp_file("", TRUE);
watchdog('backup_migrate', 'Database backup downloaded');
module_invoke_all('exit');
exit;
}