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 /plugins/Installation/Installation.php | |
parent | 9e1f40795bd4060ab05fce3302bffe2b1ebd876d (diff) |
Fixes #5400, display useful error message when a database connection cannot be achieved. Deprecating Config.badConfigurationFile event.
Diffstat (limited to 'plugins/Installation/Installation.php')
-rw-r--r-- | plugins/Installation/Installation.php | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/plugins/Installation/Installation.php b/plugins/Installation/Installation.php index 24e1a767e1..4a7d8a44cf 100644 --- a/plugins/Installation/Installation.php +++ b/plugins/Installation/Installation.php @@ -14,6 +14,7 @@ use Piwik\FrontController; use Piwik\Menu\MenuAbstract; use Piwik\Piwik; use Piwik\Translate; +use Piwik\View; /** * @@ -29,13 +30,21 @@ class Installation extends \Piwik\Plugin { $hooks = array( 'Config.NoConfigurationFile' => 'dispatch', - 'Config.badConfigurationFile' => 'dispatch', + 'Db.cannotConnectToDb' => 'displayDbConnectionMessage', 'Request.dispatch' => 'dispatchIfNotInstalledYet', 'AssetManager.getStylesheetFiles' => 'getStylesheetFiles', ); return $hooks; } + public function displayDbConnectionMessage($exception = null) + { + $view = new View("@Installation/cannotConnectToDb"); + $view->exceptionMessage = $exception->getMessage(); + + Piwik_ExitWithMessage($view->render()); + } + public function dispatchIfNotInstalledYet(&$module, &$action, &$parameters) { $general = Config::getInstance()->General; |