Zip archive
When the zip
command-line tool is installed on the Swarm server, Swarm allows users to download ZIP archives of files and folders. You can download a Zip archive using the Download zip option from the following Swarm pages:
- Review display page.
- Changelist page.
- Files page.
Installation
Install the zip command-line tool from your operating system distribution using apt-get
, yum
, etc.
Configuration
If you make a configuration change, Swarm will not use it until the configuration cache has been reloaded, this forces Swarm to use the new configuration. You must be an admin or super user to reload the Swarm config cache. Navigate to the User id dropdown menu, select System Information, click the Cache Info tab, and click the Reload Configuration button.
Configure the archiving feature with the following configuration block in the SWARM_ROOT/data/config.php
file:
<?php
// this block should be a peer of 'p4'
'archives' => array(
'max_input_size' => 512 * 1024 * 1024, // 512M (in bytes)
'archive_timeout' => 1800, // 30 minutes
'compression_level' => 1, // 0-9
'cache_lifetime' => 60 * 60 * 24, // 1 day
),
The max_input_size
key specifies the maximum file/folder content size that can be processed into a ZIP archive. The default value permits up to 512 megabytes of content to be compressed. Smaller values limit the amount of file/folder content but provide faster downloads; larger values can allow increased scanning, syncing, compressing, and downloading times.
The archive_timeout
key specifies the amount of time, in seconds, to allow Swarm to prepare the ZIP archive for downloading. Shorter times can limit the practical size of a ZIP archive, depending on the performance of your network and the filesystem hosting Swarm; even with a generous max_input_size
setting, if archive_timeout
seconds have elapsed, the archive operation is terminated.
The compression_level
key specifies the compression level to use, and must be within the range 0
to 9
. 0 means no compression, 9
means maximum compression. As this value is increased, smaller ZIP archives may result, but may require greater compression time. Swarm uses the default of 1
, which provides a reasonable tradeoff of fast compression times with light compression that can still result in an archive notably smaller than the original file/folder content.
The cache_lifetime
key specifies the desired maximum age of cached ZIP archives. Increasing the value increases the amount of time that ZIP archives exist in the cache, which can improve the user experience for frequently downloaded files. However, ZIP archives can be quite large (depending on the size of your depot within the Helix Core Server) and can require significant disk storage. Decreasing the value can mitigate the amount of disk space required for the cache; the tradeoff is that frequently accessed ZIP archives may need to be generated more frequently, which can have an impact on CPU and disk resources.
Download files as a Zip archive
To download the zip archive navigate to the review, changelist, file or folder:
The Download zip option is not displayed if the zip command-line tool is not installed on the Swarm server.
When you select the Download zip option, Swarm performs the following steps:
- Scans the files/folders:
- Checks that you have permission to access their contents, according to the Helix Core Server protections.
- Checks that the total file size is small enough to be processed by Swarm.
- Syncs the file contents to the Swarm server from the Helix Core Server.
- Creates the ZIP archive by compressing the file content.
- Starts a download of the generated ZIP archive.
- You might not see all of the above steps; Swarm caches the resulting ZIP archives so that repeated requests to the same files/folders can skip the sync and compress steps whenever possible.
- If an error occurs while scanning, syncing, or compressing, Swarm indicates the error.