function patterns_download_zip in Patterns 7.2
Same name and namespace in other branches
- 7 includes/io/download.inc \patterns_download_zip()
 
2 calls to patterns_download_zip()
- patterns_export_to_zip in patterns_export/
finalize.inc  - Exports patterns as a donwlodable Zip archive
 - patterns_lab_submit in includes/
forms/ lab.inc  - Exports selected patterns either in a file or as a zip-archive
 
File
- includes/
io/ download.inc, line 61  - Importing Patterns from a file or using an URL.
 
Code
function patterns_download_zip($zip_path) {
  $filename = pathinfo($zip_path, PATHINFO_BASENAME);
  drupal_add_http_header("Content-type", "application/octet-stream");
  drupal_add_http_header("Content-Disposition", "attachment;filename=" . $filename);
  $err = @readfile($zip_path);
  if ($err == FALSE) {
    drupal_set_message("An error occurred: couldn't read " . $zip_path . ".", 'error');
    // TODO: t()
  }
  //@drupal_unlink($zip_path);
  exit;
}