You are here

function sqlsrv_directory_checksum in Drupal driver for SQL Server and SQL Azure 3.0.x

Same name and namespace in other branches
  1. 8.2 sqlsrv.install \sqlsrv_directory_checksum()
  2. 8 sqlsrv.install \sqlsrv_directory_checksum()

Directory Checksum.

Calculate a unique identifier for a directory and it's contents based on file sizes and names.

TODO:// This thing will not notice files being moved around in directories as long as they keep same name and size.

Parameters

string $directory: Directory.

Return value

string Checksum.

1 call to sqlsrv_directory_checksum()
sqlsrv_verify_driver in ./sqlsrv.install
Verify Deployed Driver.

File

./sqlsrv.install, line 194
Installation file for sqlsrv module.

Code

function sqlsrv_directory_checksum($directory) {
  $files = file_scan_directory($directory, '/\\.*/i');
  $checksum = 0;
  $names = '';
  foreach ($files as $file) {
    $checksum += filesize($file->uri);
    $names .= $file->name;
  }
  return $checksum . '-' . md5($names);
}