Last modified: 2014-07-13 17:08:14 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T66365, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 64365 - $defaultSchemas is not available as a $wg
$defaultSchemas is not available as a $wg
Status: PATCH_TO_REVIEW
Product: MediaWiki
Classification: Unclassified
Database (Other open bugs)
1.24rc
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-04-24 14:47 UTC by Liangent
Modified: 2014-07-13 17:08 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Liangent 2014-04-24 14:47:15 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
Comment 1 Liangent 2014-04-24 14:48:15 UTC
This is caused by f7174057a4ec7b9c74babfe74290bb000204a581
Comment 2 Ryan Schmidt 2014-04-24 21:57:53 UTC
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.
Comment 3 Gerrit Notification Bot 2014-05-21 05:51:14 UTC
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
Comment 4 Gerrit Notification Bot 2014-07-13 17:08:14 UTC
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

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links