You are here

function schema_require in Schema 5

Same name and namespace in other branches
  1. 6 schema.module \schema_require()
1 call to schema_require()
schema_menu in ./schema.module

File

./schema.module, line 395

Code

function schema_require() {
  static $done = 0;
  if ($done++) {
    return;
  }
  $path = drupal_get_path('module', 'schema');
  require_once "{$path}/schema_util.inc";

  // Load all our module 'on behalfs' so they will be available for
  // any module (including this one) that needs them.
  $files = drupal_system_listing('schema_.*\\.inc$', $path . '/modules', 'name', 0);
  foreach ($files as $file) {

    // The filename format is very specific. It must be schema_MODULENAME.inc
    $module = substr_replace($file->name, '', 0, 7);
    require_once "./{$file->filename}";
  }
  global $db_type, $schema_engines;
  if (!isset($db_type)) {
    return;
  }
  $schema_engines = array();
  if (0) {

    // Load the schema database engine for the currently active database.
    $engine = drupal_get_path('module', 'schema') . '/engines/schema_' . $db_type . '.inc';
    if (is_file($engine)) {
      require_once $engine;
      $schema_engines[] = $db_type;
    }
  }
  else {

    // Load all Schema database engines.
    $files = drupal_system_listing('schema_.*\\.inc$', $path . '/engines', 'name', 0);
    foreach ($files as $file) {
      require_once "./{$file->filename}";
      $schema_engines[] = substr($file->filename, strlen($path) + 16, -4);
    }
  }
  if (array_search($db_type, $schema_engines) === FALSE) {
    drupal_set_message('The Schema module does not support the "' . $db_type . '" database type.', 'error');
  }
}