public static function Database::loadDriverFile

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 1795
Core systems for the database layer.

Class

Database
Primary front-controller for the database system.

Code

public static function loadDriverFile($driver, array $files = array()) {
  static $base_path;

  if (empty($base_path)) {
    $base_path = dirname(realpath(__FILE__));
  }

  $driver_base_path = "$base_path/$driver";
  foreach ($files as $file) {
    // Load the base file first so that classes extending base classes will
    // have the base class loaded.
    foreach (array("$base_path/$file", "$driver_base_path/$file") as $filename) {
      // The OS caches file_exists() and PHP caches require_once(), so
      // we'll let both of those take care of performance here.
      if (file_exists($filename)) {
        require_once $filename;
      }
    }
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!database!database.inc/function/Database::loadDriverFile/7.x