From de33f74b4040cc3f7880269152b277d90b081cc8 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sun, 11 Apr 2010 17:16:45 +0000 Subject: - Patch #688704 by Crell, boombatower, noahb: give DB its own autoload function. --- includes/install.inc | 31 +------------------------------ 1 file changed, 1 insertion(+), 30 deletions(-) (limited to 'includes/install.inc') diff --git a/includes/install.inc b/includes/install.inc index 9af6644e0..c134e676a 100644 --- a/includes/install.inc +++ b/includes/install.inc @@ -219,20 +219,14 @@ function drupal_detect_baseurl($file = 'install.php') { function drupal_detect_database_types() { $databases = array(); - // Initialize the database system if it has not been - // initialized yet. We do not initialize it earlier to make - // requirements check during the installation. - require_once DRUPAL_ROOT . '/includes/database/database.inc'; - // We define a driver as a directory in /includes/database that in turn // contains a database.inc file. That allows us to drop in additional drivers // without modifying the installer. // Because we have no registry yet, we need to also include the install.inc // file for the driver explicitly. require_once DRUPAL_ROOT . '/includes/database/database.inc'; + spl_autoload_register('db_autoload'); foreach (file_scan_directory(DRUPAL_ROOT . '/includes/database', '/^[a-z]*$/i', array('recurse' => FALSE)) as $file) { - include_once "{$file->uri}/install.inc"; - include_once "{$file->uri}/database.inc"; $drivers[$file->filename] = $file->uri; } @@ -546,28 +540,6 @@ function drupal_verify_profile($install_state) { return $requirements; } -/** - * Manually include all files for the active database. - * - * Because we have no registry yet, we need to manually include the - * necessary database include files. - */ -function drupal_install_initialize_database() { - static $included = FALSE; - - if (!$included) { - $connection_info = Database::getConnectionInfo(); - $driver = $connection_info['default']['driver']; - require_once DRUPAL_ROOT . '/includes/database/query.inc'; - require_once DRUPAL_ROOT . '/includes/database/select.inc'; - require_once DRUPAL_ROOT . '/includes/database/schema.inc'; - foreach (glob(DRUPAL_ROOT . '/includes/database/' . $driver . '/*.inc') as $include_file) { - require_once $include_file; - } - $included = TRUE; - } -} - /** * Callback to install the system module. * @@ -577,7 +549,6 @@ function drupal_install_initialize_database() { function drupal_install_system() { $system_path = dirname(drupal_get_filename('module', 'system', NULL)); require_once DRUPAL_ROOT . '/' . $system_path . '/system.install'; - drupal_install_initialize_database(); module_invoke('system', 'install'); $system_versions = drupal_get_schema_versions('system'); -- cgit v1.2.3