32 $archivePath = tempnam(
'/tmp',
'sf-');
37 if (self::zipFunctional()) {
39 $zip =
new ZipArchive();
40 if ($zip->open($archivePath, ZIPARCHIVE::CREATE) ==
true) {
41 foreach ($files as $serverPath => $clientFilename) {
42 $zip->addFile($filesDir .
'/' . $serverPath, $clientFilename);
46 } elseif (self::tarFunctional()) {
49 '-f ' . escapeshellarg($archivePath) .
' ' .
50 '-C ' . escapeshellarg($filesDir) .
' ' .
51 implode(
' ', array_map(
'escapeshellarg', array_keys($files)))
54 throw new Exception(
'No archive tool is available!');
65 return (extension_loaded(
'zip'));
73 return !empty($tarBinary) && file_exists($tarBinary);