API16

API16:JInstaller/loadMD5Sum

From Joomla! Documentation

Revision as of 22:54, 22 March 2010 by Doxiki (talk | contribs) (New page: ===Description=== Loads an MD5SUMS file into an associative array <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>[[Description:JInstaller/loadMD5Sum|Edit Descrip...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Description

Loads an MD5SUMS file into an associative array

[Edit Descripton]

Template:Description:JInstaller/loadMD5Sum

Syntax

loadMD5Sum($filename)
Parameter Name Default Value Description
$filename Filename to load

Returns

Array Associative array with filenames as the index and the MD5 as the value

Defined in

libraries/joomla/installer/installer.php

Importing

jimport( 'joomla.installer.installer' );

Source Body

function loadMD5Sum($filename)
{
        if (!file_exists($filename)) return false; // bail if the file doesn't exist
        $data = file($filename, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
        $retval = Array();
        foreach ($data as $row)
        {
                $results = explode('  ', $row); // split up the data
                $results[1] = str_replace('./','', $results[1]); // cull any potential prefix
                $retval[$results[1]] = $results[0]; // throw into the array
        }
        return $retval;
}

[Edit See Also] Template:SeeAlso:JInstaller/loadMD5Sum

Examples

<CodeExamplesForm />