The following code assumes zip_open exists, when for many servers it doesn't.
/**
* hook_link() implementation.
*/
function filebrowser_link($type, $node= NULL, $teaser= FALSE) {
if ($node->type == 'dir_listing' && !$teaser) {
$links= array ();
foreach ($node->file_listing as $file) {
if ($file['kind'] == 0) {
$links['file_browser_download_archive']= array (
'href' => 'filebrowser_download/'.$node->nid.$node->relative_path. ($node->relative_path == '/' ? $node->title : basename($node->relative_path)).".zip",
'title' => t("Download files as an Archive")
);
break;
}
}
return $links;
}
}
So we don't get a link to download all as a zip, when it isn't possible, please change it to:
/**
* hook_link() implementation.
*/
function filebrowser_link($type, $node= NULL, $teaser= FALSE) {
if ($node->type == 'dir_listing' && !$teaser && function_exists('zip_open')) {
$links= array ();
foreach ($node->file_listing as $file) {
if ($file['kind'] == 0) {
$links['file_browser_download_archive']= array (
'href' => 'filebrowser_download/'.$node->nid.$node->relative_path. ($node->relative_path == '/' ? $node->title : basename($node->relative_path)).".zip",
'title' => t("Download files as an Archive")
);
break;
}
}
return $links;
}
}
Comments
Comment #1
Yoran commentedThank you for this. Patch applied in RC10
Comment #3
larskleiner commentedIn addition to the link hook, _filebrowser_download_callback either opens the zip file if zip_open exists or displays an error message. Wouldn't it be better to just download the zip file if zip_open doesn't exists?
Comment #4
Yoran commentedI think this is fixed with las dev version. But anyway I'm a bit confused with this PHP/Zip library as it don't handle correctly national characters. I wonder if we can't make this a bit more clever by first trying to find a zip utility on the server before trying with PHP/Zip broken library.
Comment #5
Yoran commentedComment #6
dead_account_kill_it_please commented