jenkins-bot has submitted this change and it was merged.

Change subject: installer: shows status message on DB connection error
......................................................................


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
---
M includes/installer/DatabaseInstaller.php
1 file changed, 4 insertions(+), 1 deletion(-)

Approvals:
  Nikerabbit: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/installer/DatabaseInstaller.php 
b/includes/installer/DatabaseInstaller.php
index 43d90e5..b4f2194 100644
--- a/includes/installer/DatabaseInstaller.php
+++ b/includes/installer/DatabaseInstaller.php
@@ -243,7 +243,10 @@
                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 );
                }
        }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/87054
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ife8e97242e1cfbdfbb572ad50cf8e4a7ad5b9dfc
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Hashar <has...@free.fr>
Gerrit-Reviewer: Addshore <addshorew...@gmail.com>
Gerrit-Reviewer: Alex Monk <kren...@gmail.com>
Gerrit-Reviewer: Bartosz DziewoƄski <matma....@gmail.com>
Gerrit-Reviewer: Hashar <has...@free.fr>
Gerrit-Reviewer: Nikerabbit <niklas.laxst...@gmail.com>
Gerrit-Reviewer: Parent5446 <tylerro...@gmail.com>
Gerrit-Reviewer: Waldir <wal...@email.com>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to