1
0
Fork 0

Fix support for 7z command fallback on linux/macOS, fixes #9994

pull/9996/head
Jordi Boggiano 2021-07-12 14:49:44 +02:00
parent bacbd15b6b
commit db1d9e75be
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
2 changed files with 5 additions and 7 deletions

View File

@ -177,17 +177,12 @@ EOT
$finder = new ExecutableFinder; $finder = new ExecutableFinder;
$hasSystemUnzip = (bool) $finder->find('unzip'); $hasSystemUnzip = (bool) $finder->find('unzip');
if (Platform::isWindows()) {
$hasSystem7zip = (bool) $finder->find('7z', null, array('C:\Program Files\7-Zip')); $hasSystem7zip = (bool) $finder->find('7z', null, array('C:\Program Files\7-Zip'));
$windows7z = ', ' . ($hasSystem7zip ? '<comment>7-Zip present</comment>' : '<comment>7-Zip not available</comment>');
} else {
$windows7z = '';
}
$io->write( $io->write(
'zip: ' . (extension_loaded('zip') ? '<comment>extension present</comment>' : '<comment>extension not loaded</comment>') 'zip: ' . (extension_loaded('zip') ? '<comment>extension present</comment>' : '<comment>extension not loaded</comment>')
. ', ' . ($hasSystemUnzip ? '<comment>unzip present</comment>' : '<comment>unzip not available</comment>') . ', ' . ($hasSystemUnzip ? '<comment>unzip present</comment>' : '<comment>unzip not available</comment>')
. $windows7z . ', ' . ($hasSystem7zip ? '<comment>7-Zip present</comment>' : '<comment>7-Zip not available</comment>')
); );
return $this->exitCode; return $this->exitCode;

View File

@ -46,6 +46,9 @@ class ZipDownloader extends ArchiveDownloader
if ($cmd = $finder->find('unzip')) { if ($cmd = $finder->find('unzip')) {
self::$unzipCommands[] = array('unzip', ProcessExecutor::escape($cmd).' -qq %s -d %s'); self::$unzipCommands[] = array('unzip', ProcessExecutor::escape($cmd).' -qq %s -d %s');
} }
if (!Platform::isWindows() && ($cmd = $finder->find('7z'))) { // 7z linux/macOS support is only used if unzip is not present
self::$unzipCommands[] = array('7z', ProcessExecutor::escape($cmd).' x -bb0 -y %s -o%s');
}
} }
if (null === self::$hasZipArchive) { if (null === self::$hasZipArchive) {