Collections functions
Encryption functions
General functions
Theme permission functions
Resource functions

collection_download_process_archive_command()

Parameters

ColumnTypeDefaultDescription
$collection_download_tar
&$zip
$filename
$usertempdir
$archiver
$settings_id
&$zipfile

Location

include/collections_functions.php lines 3565 to 3610

Definition

 
function collection_download_process_archive_command($collection_download_tar, &$zip$filename$usertempdir$archiver$settings_id, &$zipfile)
    {
    global 
$lang$use_zip_extension$collection_download_settings$archiver_listfile_argument$cmdfile$config_windows;

    
$archiver_fullpath get_utility_path("archiver");

    
# Execute the archiver command.
    # If $collection_download is true the $collection_download_settings are used if defined, else the legacy $zipcommand is used.
    
if ($use_zip_extension && !$collection_download_tar)
        {
        
update_zip_progress_file("zipping");
        
$wait=$zip->close();
        
update_zip_progress_file("complete");
        
sleep(1);
        }
     else if (
$collection_download_tar)
        {
        
header("Content-type: application/tar");
        
header("Content-disposition: attachment; filename=" $filename );
        
debug("collection_download tar command: tar -cv -C " $usertempdir " . ");
        
$cmdtempdir escapeshellarg($usertempdir);
        
passthru("find " $cmdtempdir ' -printf "%P\n" | tar -cv --no-recursion --dereference -C ' $cmdtempdir " -T -");
        exit();
        }
    else if (
$archiver)
        {
        
update_zip_progress_file("zipping");
        
$wait=run_command($archiver_fullpath " " $collection_download_settings[$settings_id]["arguments"] . " " escapeshellarg($zipfile) . " " $archiver_listfile_argument escapeshellarg($cmdfile));
        
update_zip_progress_file("complete");
        }
    else if (!
$use_zip_extension)
        {
        
update_zip_progress_file("zipping");    
        if (
$config_windows)
            
# Add the command file, containing the filenames, as an argument.
            
{
            
$wait=exec("$zipcommand " escapeshellarg($zipfile) . " @" escapeshellarg($cmdfile));
            }
        else
            {
            
# Pipe the command file, containing the filenames, to the executable.
            
$wait=exec("$zipcommand " escapeshellarg($zipfile) . " -@ < " escapeshellarg($cmdfile));
            }
            
update_zip_progress_file("complete");
        }
    }

This article was last updated 7th July 2020 09:05 Europe/London time based on the source file dated 3rd July 2020 14:33 Europe/London time.