You are here

function sqlsrv_verify_driver 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_verify_driver()
  2. 8 sqlsrv.install \sqlsrv_verify_driver()

Verify Deployed Driver.

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

Return value

bool Drivers match.

1 call to sqlsrv_verify_driver()
sqlsrv_requirements in ./sqlsrv.install
Implements hook_requirements().

File

./sqlsrv.install, line 165
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.
  $path_array = [
    'drivers',
    'lib',
    'drupal',
    'driver',
    'database',
    'sqlsrv',
  ];
  $module_dir = dirname(__FILE__) . DIRECTORY_SEPARATOR . implode(DIRECTORY_SEPARATOR, $path_array);
  return sqlsrv_directory_checksum($driver_dir) === sqlsrv_directory_checksum($module_dir);
}