new-installer: Delay database object construction until ->execute time
authorÆvar Arnfjörð Bjarmason <avar@users.mediawiki.org>
Tue, 6 Jul 2010 20:40:05 +0000 (20:40 +0000)
committerÆvar Arnfjörð Bjarmason <avar@users.mediawiki.org>
Tue, 6 Jul 2010 20:40:05 +0000 (20:40 +0000)
commit5d005d431a4a207243dbbbc09b483849771b23bf
tree607dea24f3d4e56a611f505fa05a68ba67494440
parentdb61190881b40852f043e64b70517810ddd3ba66
new-installer: Delay database object construction until ->execute time

My method of putting code that alters $this->parent->installSteps in
the MySQL constructor didn't work because the installer will construct
objects for all the databases, even those it doesn't use.

This ostensibly happens because it needs to be able to provide
defaults for all of them on the DBConnect page.

But when I was going to fix that by exiting the MySQL constructior by
checking $wgDBtype I found that it didn't work, because WebInstaller
calls Installer's __construct *before* any sessions are read or set
up, so $wgDBtype will always be mysql, since that's the default.

Fix that by delaying the construction of the database objects. The
WebInstaller (or equivalent) now has to call ->setupDatabaseObjects()
in its ->execute method. This way the defaults on the DBConnect will
still be provided, but we'll have access to session data in the
database constructors.

Ughed-by: Chad <innocentkiller@gmail.com>
includes/installer/Installer.php
includes/installer/MysqlInstaller.php
includes/installer/WebInstaller.php