function _drush_print_pdf_download_extract in Printer, email and PDF versions 6
Same name and namespace in other branches
- 7 print_pdf/print_pdf.drush.inc \_drush_print_pdf_download_extract()
Helper to download and extract the zip/tar archive.
1 call to _drush_print_pdf_download_extract()
- drush_print_pdf_download in print_pdf/
print_pdf.drush.inc - Download and extract PDF archive.
File
- print_pdf/
print_pdf.drush.inc, line 141 - drush integration for print_pdf module PDF libraries download.
Code
function _drush_print_pdf_download_extract($filename) {
$arch_ret = FALSE;
if (drush_op('is_file', $filename)) {
switch (drush_op('mime_content_type', $filename)) {
case 1:
$arch_ret = TRUE;
break;
case 'application/zip':
// Decompress the zip archive
$arch_ret = drush_shell_exec('unzip -qq -o ' . $filename);
// ZIP archives usually get the access rights wrong
drush_log(dt('@filename is a Zip file. Check the access permissions of the extracted files.', array(
'@filename' => $filename,
)), 'warning');
break;
case 'application/x-gzip':
// Decompress the tar gz archive
$arch_ret = drush_shell_exec('tar xzf ' . $filename);
break;
case 'application/x-bzip2':
// Decompress the tar bz2 archive
$arch_ret = drush_shell_exec('tar xjf ' . $filename);
break;
case 'application/x-xz':
// Decompress the tar xz archive
$arch_ret = drush_shell_exec('tar xJf %s', $filename);
break;
}
}
else {
drush_log(dt('@filename not found.', array(
'@filename' => $filename,
)), 'error');
}
return $arch_ret;
}