Collections functions
Encryption functions
General functions
Render functions
Theme permission functions
Video functions
Resource functions

get_checksum()

Description

Return a checksum for the given file path.

Parameters

ColumnTypeDefaultDescription
$path string Path to file
$forcefull bool false Force use of whole file and ignore $file_checksums_50k setting

Return

string

Location

include/file_functions.php lines 92 to 113

Definition

 
function get_checksum($path$forcefull false)
    {
    
debug("get_checksum( \$path = {$path} );");
    global 
$file_checksums_50k;
    if (!
is_readable($path))
        {
        return 
false;    
        }

    
# Generate the ID
    
if ($file_checksums_50k && !$forcefull)
        {
        
# Fetch the string used to generate the unique ID
        
$use=filesize_unlimited($path) . "_" file_get_contents($path,null,null,0,50000);
        
$checksum=md5($use);
        }
    else
        {
        
$checksum=md5_file($path);
        }
    return 
$checksum;
    }

This article was last updated 26th November 2020 04:35 Europe/London time based on the source file dated 13th November 2020 16:50 Europe/London time.