Make install-jsdeps.sh script working without the 'file' program installed (#7325)

pull/7342/head
Aleksander Machniak 4 years ago
parent 30b5803ee4
commit 36532345df

@ -38,6 +38,7 @@ CHANGELOG Roundcube Webmail
- Mailvelope: Fix bug where recipients with name were not handled properly in mail compose (#7312) - Mailvelope: Fix bug where recipients with name were not handled properly in mail compose (#7312)
- Fix characters encoding in group rename input after group creation/rename (#7330) - Fix characters encoding in group rename input after group creation/rename (#7330)
- Fix bug where some message/rfc822 parts could not be attached on forward (#7323) - Fix bug where some message/rfc822 parts could not be attached on forward (#7323)
- Make install-jsdeps.sh script working without the 'file' program installed (#7325)
RELEASE 1.4.3 RELEASE 1.4.3
------------- -------------

@ -36,7 +36,6 @@ if (empty($SOURCES['dependencies'])) {
$CURL = trim(`which curl`); $CURL = trim(`which curl`);
$WGET = trim(`which wget`); $WGET = trim(`which wget`);
$UNZIP = trim(`which unzip`); $UNZIP = trim(`which unzip`);
$FILEINFO = trim(`which file`);
if (($CACHEDIR = getenv("CACHEDIR")) && is_writeable($CACHEDIR)) { if (($CACHEDIR = getenv("CACHEDIR")) && is_writeable($CACHEDIR)) {
// use $CACHEDIR // use $CACHEDIR
@ -154,19 +153,17 @@ function fetch_from_source($package, $useCache = true, &$filetype = null)
*/ */
function extract_filetype($package, &$filetype = null) function extract_filetype($package, &$filetype = null)
{ {
global $FILEINFO, $CACHEDIR; global $CACHEDIR;
$filetype = pathinfo($package['url'], PATHINFO_EXTENSION) ?: 'tmp'; $filetype = pathinfo($package['url'], PATHINFO_EXTENSION) ?: 'tmp';
$cache_file = $CACHEDIR . '/' . $package['lib'] . '-' . $package['version'] . '.' . $filetype; $cache_file = $CACHEDIR . '/' . $package['lib'] . '-' . $package['version'] . '.' . $filetype;
if (empty($FILEINFO)) { // Make sure it is a zip file
rcube::raise_error("Required program 'file' not found.", false, true); if (file_exists($cache_file)) {
} $magic = file_get_contents($cache_file, false, null, 0, 4);
if ($magic === "PK\003\004") {
// detect downloaded/cached file type $filetype = 'zip';
exec(sprintf('%s -b %s', $FILEINFO, $cache_file), $out); }
if (stripos($out[0], 'zip') === 0) {
$filetype = 'zip';
} }
return $cache_file; return $cache_file;

Loading…
Cancel
Save