You are here

function sqlsrv_verify_driver in Drupal driver for SQL Server and SQL Azure 8.2

Same name and namespace in other branches
  1. 8 sqlsrv.install \sqlsrv_verify_driver()
  2. 3.0.x sqlsrv.install \sqlsrv_verify_driver()

Verify that the deployed driver is the same one as the module version.

Return value

bool

File

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

Code

function sqlsrv_verify_driver() {

  // Location of the effective driver.
  $class = Connection::class;
  $reflector = new ReflectionClass($class);
  $driver_dir = dirname($reflector
    ->getFileName());

  // Location for the module's driver.
  $module_dir = dirname(__FILE__) . DIRECTORY_SEPARATOR . implode(DIRECTORY_SEPARATOR, array(
    'drivers',
    'lib',
    'drupal',
    'driver',
    'database',
    'sqlsrv',
  ));
  return sqlsrv_directory_checksum($driver_dir) === sqlsrv_directory_checksum($module_dir);
}