Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/FrontController.php17
-rw-r--r--lang/en.json4
-rw-r--r--plugins/Installation/Installation.php11
-rw-r--r--tests/PHPUnit/TestingEnvironment.php4
m---------tests/PHPUnit/UI0
-rw-r--r--tests/PHPUnit/proxy/index.php4
6 files changed, 28 insertions, 12 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;
}
diff --git a/lang/en.json b/lang/en.json
index 0e88a97a24..2705060bb7 100644
--- a/lang/en.json
+++ b/lang/en.json
@@ -1169,7 +1169,9 @@
"WeHopeYouWillEnjoyPiwik": "We hope you will enjoy using Piwik as much as we enjoy making it.",
"Welcome": "Welcome!",
"WelcomeHelp": "<p>Piwik is a free/libre web analytics software that makes it easy to get the information you want from your visitors.<\/p><p>This process is split up into %s easy steps and will take around 5 minutes.<\/p>",
- "WelcomeToCommunity": "Welcome to the Piwik community!"
+ "WelcomeToCommunity": "Welcome to the Piwik community!",
+ "CannotConnectToDb": "Cannot connect to the database",
+ "CannotConnectToDbResolvingExplanation": "This may be a temporary issue, try %1$srefreshing the page%2$s. If the problem persists please contact your Piwik administrator."
},
"LanguagesManager": {
"AboutPiwikTranslations": "About Piwik translations",
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;
diff --git a/tests/PHPUnit/TestingEnvironment.php b/tests/PHPUnit/TestingEnvironment.php
index fb701b9bfc..88fbe97880 100644
--- a/tests/PHPUnit/TestingEnvironment.php
+++ b/tests/PHPUnit/TestingEnvironment.php
@@ -184,6 +184,10 @@ class Piwik_TestingEnvironment
});
}
Piwik::addAction('Request.dispatch', function() use ($testingEnvironment) {
+ if (empty($_GET['ignoreClearAllViewDataTableParameters'])) { // TODO: should use testingEnvironment variable, not query param
+ \Piwik\ViewDataTable\Manager::clearAllViewDataTableParameters();
+ }
+
if ($testingEnvironment->optionsOverride) {
foreach ($testingEnvironment->optionsOverride as $name => $value) {
Option::set($name, $value);
diff --git a/tests/PHPUnit/UI b/tests/PHPUnit/UI
-Subproject 3fcf6f33450feb53932cf06f7e2f99722e444fd
+Subproject 7fc4266c8211576d16feab3c2bb60ef8de33968
diff --git a/tests/PHPUnit/proxy/index.php b/tests/PHPUnit/proxy/index.php
index 7d199a5615..594ad5da36 100644
--- a/tests/PHPUnit/proxy/index.php
+++ b/tests/PHPUnit/proxy/index.php
@@ -8,10 +8,6 @@ require realpath(dirname(__FILE__)) . "/includes.php";
Piwik_TestingEnvironment::addHooks();
-if (empty($_GET['ignoreClearAllViewDataTableParameters'])) {
- \Piwik\ViewDataTable\Manager::clearAllViewDataTableParameters();
-}
-
\Piwik\Profiler::setupProfilerXHProf();
include PIWIK_INCLUDE_PATH . '/index.php'; \ No newline at end of file