From: Antoine Musso Date: Wed, 2 Oct 2013 10:33:48 +0000 (+0200) Subject: installer: shows status message on DB connection error X-Git-Tag: 1.31.0-rc.0~18170 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=631156fc74ea809bd277315d5a41aca968ef628d;p=lhc%2Fweb%2Fwiklou.git installer: shows status message on DB connection error While installing MediaWiki with a sqlite backend and missing the sqlite extension, I have received the very helpful message: DatabaseInstaller::setupSchemaVars: unexpected DB connection error Which to me is as helpful as: error Since the database connection returns a Status object and that it got a message attached, we might as well pass the error message when raising the exception. We would end up with an error like: DB connection error: could not find driver. Check the data directory and database name below and try again. That let me instantly facepalm and install the sqlite PHP extension instead of wasting time figuring out what is happening. Change-Id: Ife8e97242e1cfbdfbb572ad50cf8e4a7ad5b9dfc --- diff --git a/includes/installer/DatabaseInstaller.php b/includes/installer/DatabaseInstaller.php index 43d90e5561..b4f21943ee 100644 --- a/includes/installer/DatabaseInstaller.php +++ b/includes/installer/DatabaseInstaller.php @@ -243,7 +243,10 @@ abstract class DatabaseInstaller { if ( $status->isOK() ) { $status->value->setSchemaVars( $this->getSchemaVars() ); } else { - throw new MWException( __METHOD__ . ': unexpected DB connection error' ); + $msg = __METHOD__ . ': unexpected error while establishing' + . ' a database connection with message: ' + . $status->getMessage()->plain(); + throw new MWException( $msg ); } }