Back to Installer class

Method loadMD5Sum

public array
loadMD5Sum
(mixed $filename)
Loads an MD5SUMS file into an associative array
Parameters
  • string $filename Filename to load
Returns
  • array Associative array with filenames as the index and the MD5 as the value
Since
  • 3.1
Class: Installer
Project: Joomla

Method loadMD5Sum - Source code

/**
 * Loads an MD5SUMS file into an associative array
 *
 * @param   string  $filename  Filename to load
 *
 * @return  array  Associative array with filenames as the index and the MD5 as the value
 *
 * @since   3.1
 */
public function loadMD5Sum($filename)
{
    if (!file_exists($filename)) {
        // Bail if the file doesn't exist
        return false;
    }
    $data = file($filename, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
    $retval = array();
    foreach ($data as $row) {
        // Split up the data
        $results = explode('  ', $row);
        // Cull any potential prefix
        $results[1] = str_replace('./', '', $results[1]);
        // Throw into the array
        $retval[$results[1]] = $results[0];
    }
    return $retval;
}