diff options
author | diosmosis <benakamoorthi@fastmail.fm> | 2014-07-04 09:24:16 +0400 |
---|---|---|
committer | diosmosis <benakamoorthi@fastmail.fm> | 2014-07-04 09:24:22 +0400 |
commit | 080829b2660b0b598805996974783f153c22b5b9 (patch) | |
tree | 4fc1893d2996d8b3a67ff15e062b96512736b7ee /core/FrontController.php | |
parent | 9e1f40795bd4060ab05fce3302bffe2b1ebd876d (diff) |
Fixes #5400, display useful error message when a database connection cannot be achieved. Deprecating Config.badConfigurationFile event.
Diffstat (limited to 'core/FrontController.php')
-rw-r--r-- | core/FrontController.php | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/core/FrontController.php b/core/FrontController.php index fb4f27de5c..09dd6e97d8 100644 --- a/core/FrontController.php +++ b/core/FrontController.php @@ -284,7 +284,6 @@ class FrontController extends Singleton try { Db::createDatabaseObject(); Option::get('TestingIfDatabaseConnectionWorked'); - } catch (Exception $exception) { if (self::shouldRethrowException()) { throw $exception; @@ -293,15 +292,21 @@ class FrontController extends Singleton Log::debug($exception); /** - * Triggered if the INI config file has the incorrect format or if certain required configuration - * options are absent. - * - * This event can be used to start the installation process or to display a custom error message. - * + * Triggered when Piwik cannot connect to the database. + * + * This event can be used to start the installation process or to display a custom error + * message. + * * @param Exception $exception The exception thrown from creating and testing the database * connection. */ + Piwik::postEvent('Db.cannotConnectToDb', array($exception), $pending = true); + + /** + * @deprecated + */ Piwik::postEvent('Config.badConfigurationFile', array($exception), $pending = true); + throw $exception; } |