diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-11-29 04:45:11 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-11-29 04:45:11 +0000 |
commit | 1a685474e698ce3e90dbae87f6a1f83966d9ef63 (patch) | |
tree | 309dd1ee9c5321635ef2a676373d324153fe9e1e /includes/install.inc | |
parent | 4e90d24dd9ff1474bf679f70a351dee371e87b51 (diff) | |
download | brdo-1a685474e698ce3e90dbae87f6a1f83966d9ef63.tar.gz brdo-1a685474e698ce3e90dbae87f6a1f83966d9ef63.tar.bz2 |
#851136 by Crell, chx, Damien Tournoud: Make the database autoloading more robust.
Diffstat (limited to 'includes/install.inc')
-rw-r--r-- | includes/install.inc | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/includes/install.inc b/includes/install.inc index 2c9810a08..1b7d7a796 100644 --- a/includes/install.inc +++ b/includes/install.inc @@ -254,7 +254,6 @@ function drupal_get_database_types() { // 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) { if (file_exists($file->uri . '/database.inc') && file_exists($file->uri . '/install.inc')) { $drivers[$file->filename] = $file->uri; @@ -262,8 +261,7 @@ function drupal_get_database_types() { } foreach ($drivers as $driver => $file) { - $class = 'DatabaseTasks_' . $driver; - $installer = new $class(); + $installer = db_installer_object($driver); if ($installer->installable()) { $databases[$driver] = $installer; } @@ -1248,8 +1246,18 @@ function install_profile_info($profile, $locale = 'en') { * encoding. */ function db_run_tasks($driver) { - $task_class = 'DatabaseTasks_' . $driver; - $DatabaseTasks = new $task_class(); - $DatabaseTasks->runTasks(); + db_installer_object($driver)->runTasks(); return TRUE; } + +/** + * Returns a database installer object. + * + * @param $driver + * The name of the driver. + */ +function db_installer_object($driver) { + Database::loadDriverFile($driver, array('install.inc')); + $task_class = 'DatabaseTasks_' . $driver; + return new $task_class(); +} |