Collections functions
General functions
Node functions
Render functions
Theme permission functions
User functions
Resource functions

collection_download_process_csv_metadata_file()

Description

Add a CSV containing resource metadata to a downloaded zip file during creation of the zip.

Parameters

ColumnTypeDefaultDescription
$result array
$id integer
$collection integer
$collection_download_tar boolean
$use_zip_extension boolean
&$zip
&$path
&$deletion_array array
$zip object
$path string
$deletion_array array

Return

void

Location

include/collections_functions.php lines 5040 to 5066

Definition

 
function collection_download_process_csv_metadata_file(array $result$id$collection$collection_download_tar$use_zip_extension, &$zip, &$path, array &$deletion_array)
    {
    
// Include the CSV file with the metadata of the resources found in this collection
    
$csv_file    get_temp_dir(false$id) . '/Col-' $collection '-metadata-export.csv';
        if(isset(
$result[0]["ref"]))
        {
        
$result array_column($result,"ref");  
        }
    
generateResourcesMetadataCSV($resultfalse,false,$csv_file);
    
    
// Add link to file for use by tar to prevent full paths being included.
    
if($collection_download_tar)
        {
        global 
$p$usertempdir$filename;
        
debug("collection_download adding symlink: " $p " - " $usertempdir DIRECTORY_SEPARATOR $filename);
        @
symlink($csv_file$usertempdir DIRECTORY_SEPARATOR 'Col-' $collection '-metadata-export.csv');
        }
    elseif(
$use_zip_extension)
        {
        
$zip->addFile($csv_file'Col-' $collection '-metadata-export.csv');
        }
    else
        {
        
$path .= $csv_file "\r\n";
        }
    
$deletion_array[] = $csv_file;
    }

This article was last updated 19th March 2024 11:35 Europe/London time based on the source file dated 15th March 2024 17:00 Europe/London time.