- 🇺🇸United States smustgrave
Wonder with so many years of inactivity if this is still a desired feature request for D10+?
- Issue was unassigned.
This is half bug/half feature request.
I am creating a module for fine tuning master/slave database interaction. Basically writes and reads go through different connections as long as there is not a transaction happening. I know the pitfalls that ensue, we are carefully considering those in the process.
Now to the issue: In /includes/database/database.inc, class Database, the method Database::openConnection attempts to open a DatabaseConnection file in order to load said class and then instantiate it, Here's the current code (please bear with me):
...
$driver_class = 'DatabaseConnection_' . $driver;
require_once DRUPAL_ROOT . '/includes/database/' . $driver . '/database.inc';
$new_connection = new $driver_class(self::$databaseInfo[$key][$target]);
...
Regardless of my ultimate goal, I propose for us to change the code to this:
...
$driver_class = 'DatabaseConnection_' . $driver;
if (file_exists(DRUPAL_ROOT . '/includes/database/' . $driver . '/database.inc')) {
require_once DRUPAL_ROOT . '/includes/database/' . $driver . '/database.inc';
} else if (!class_exists($driver_class)) {
/* issue warning, or error message and stop loading the page */
}
$new_connection = new $driver_class(self::$databaseInfo[$key][$target]);
...
I have two reasons for doing this:
If we like this approach I can go and propose the patch for it, along with a sample module to test it and show how to exploit the possibilities brought by it.
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
Wonder with so many years of inactivity if this is still a desired feature request for D10+?