Collections functions
General functions
Node functions
Render functions
Theme permission functions
User 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|false Return the checksum value, false otherwise.

Location

include/file_functions.php lines 93 to 114

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,false,null,0,50000);
        
$checksum=md5($use);
        }
    else
        {
        
$checksum=md5_file($path);
        }
    return 
$checksum;
    }

This article was last updated 16th April 2024 18:05 Europe/London time based on the source file dated 28th March 2024 13:54 Europe/London time.