Coding standards
Security in ResourceSpace
Developer reference
Database
User api session functions
Geolocation functions
Storage test functions
Cli functions
Lang translation functions
Log export functions
Mcp functions

log_export_request()

Description

Read and validate export filters before running or queuing an export.

@throws InvalidArgumentException For an invalid scope, target or date range.

Parameters

ColumnTypeDefaultDescription
array { : getval'scope'
'';

Return

array Normalised log filters.

Location

include/log_export_functions.php lines 11 to 43

Definition

 
function log_export_request(): array
{
    global 
$lang;
    
$scope = getval('scope', '');
    
$range = log_date_range();
    if (
$range === null) {
        throw new 
InvalidArgumentException($lang['log_export_dates']);
    }
    
$filters = ['scope' => $scope] + $range;
    if (
$scope === 'system') {
        foreach ([
'actasuser', 'table_reference'] as $key) {
            
$value = getval($key, '0');
            if (!
ctype_digit($value)) {
                throw new 
InvalidArgumentException($lang['error_invalid_input']);
            }
            
$filters[$key] = (int) $value;
        }
        
$filters['table'] = getval('table', '');
        
$filters['log_search'] = getval('log_search', '');
    } elseif (
in_array($scope, ['resource', 'collection'], true)) {
        
$filters['ref'] = (int) getval('ref', 0, false, 'is_int_loose');
        if (
$filters['ref'] <= 0) {
            throw new 
InvalidArgumentException($lang['error_invalid_input']);
        }
        if (
$scope === 'resource') {
            
$filters['filter_by_type'] = getval('filter_by_type', '');
            
$filters['filter_by_usageoption'] = getval('filter_by_usageoption', null, false, 'is_int_loose');
        }
    } else {
        throw new 
InvalidArgumentException($lang['error_invalid_input']);
    }
    return 
$filters;
}

This article was last updated 3rd December 2026 15:35 Europe/London time based on the source file dated 3rd December 2026 13:55 Europe/London time.