1.20.x database.inc public static Database::loadDriverFile($driver, array $files = array())

Load a file for the database that might hold a class.

Parameters

$driver: The name of the driver.

array $files: The name of the files the driver specific class can be.

File

includes/database/database.inc, line 1957
Core systems for the database layer.

Class

Database
Primary front-controller for the database system.

Code

public static function loadDriverFile($driver, array $files = array()) {
  $backends = silkscreen_find_backends('database');

  // Load the base classes first
  foreach ($files as $file) {
    $base_class_file = BACKDROP_ROOT . '/core/includes/database/' . $file;
    if (file_exists($base_class_file)) {
      require_once $base_class_file;
    }
  }

  // Then load the driver classes.
  foreach ($files as $file) {
    foreach ($backends as $class => $class_file) {
      if (strpos($class, $driver) && strpos($class_file, $file)) {
        // The OS caches file_exists() and PHP caches require_once(), so
        // we'll let both of those take care of performance here.

        // Load the base file first so that classes extending base classes will
        // have the base class loaded.
        if (file_exists($class_file)) {
          require_once $class_file;
        }
      }
    }
  }
}