Last modified: 2014-07-13 17:08:14 UTC
So when an extension adds a new database type, it's impossible to add the new dbtype to this array, causing Notice: Undefined index: *** in .../includes/db/Database.php on line 876
This is caused by f7174057a4ec7b9c74babfe74290bb000204a581
There's definitely a change that needs to be made here (at the very least it needs to gracefully fall back to no schema if the $dbType isn't in the list without emitting an E_NOTICE for not finding the index), but I'm not certain that a config variable is necessary for this, for a couple of reasons. 1) You can pass the desired schema in as part of the $options array to DatabaseBase::factory(), e.g. $dbw = DatabaseBase::factory( 'customdb', array( 'schema' => 'foobar' ) ); 2) By making it a configuration variable, that indicates that changing the default values for existing database types is supported, when in reality that is not the case (trying to set a schema for MySQL will end badly in all cases, and even though Postgres and Oracle support them, the MediaWiki drivers for them assume that there isn't one/it doesn't need to be specified so things may subtly break). An alternative would be a new hook to define the default schema for a new database type, it would be passed in $dbType and &$schema (which allows for setting a single schema for that database, defaulting to null). This way we avoid the pitfalls of point 2 by not allowing the defaults for existing drivers to be changed, while also avoiding the extra boilerplate required in the solution presented in point 1 in the event a db object needs to be constructed multiple times.
Change 134562 had a related patch set uploaded by Skizzerz: (bug 64365) Gracefully fail when getting the default schema if we get a non-standard db type instead of throwing notices. Also add a hook to allow extensions that add non-standard types to configure said default https://gerrit.wikimedia.org/r/134562
Change 134562 had a related patch set uploaded by Krinkle: database: Gracefully fail when non-standard dbType has no default schema https://gerrit.wikimedia.org/r/134562