You are here

function sqlsrv_directory_checksum in Drupal driver for SQL Server and SQL Azure 8

Same name and namespace in other branches
  1. 8.2 sqlsrv.install \sqlsrv_directory_checksum()
  2. 3.0.x sqlsrv.install \sqlsrv_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 :

Return value

string

1 call to sqlsrv_directory_checksum()
sqlsrv_verify_driver in ./sqlsrv.install
Verify that the deployed driver is the same one as the module version.

File

./sqlsrv.install, line 200
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);
}