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.php23
-rw-r--r--core/SettingsPiwik.php2
-rw-r--r--plugins/Installation/Installation.php1
-rw-r--r--tests/PHPUnit/TestingEnvironment.php4
4 files changed, 26 insertions, 4 deletions
diff --git a/core/FrontController.php b/core/FrontController.php
index 09dd6e97d8..a59e425ba7 100644
--- a/core/FrontController.php
+++ b/core/FrontController.php
@@ -281,9 +281,10 @@ class FrontController extends Singleton
throw $exceptionToThrow;
}
+ // try to connect to the database
try {
Db::createDatabaseObject();
- Option::get('TestingIfDatabaseConnectionWorked');
+ Db::fetchAll("SELECT DATABASE()");
} catch (Exception $exception) {
if (self::shouldRethrowException()) {
throw $exception;
@@ -302,8 +303,26 @@ class FrontController extends Singleton
*/
Piwik::postEvent('Db.cannotConnectToDb', array($exception), $pending = true);
+ throw $exception;
+ }
+
+ // try to get an option (to check if data can be queried)
+ try {
+ Option::get('TestingIfDatabaseConnectionWorked');
+ } catch (Exception $exception) {
+ if (self::shouldRethrowException()) {
+ throw $exception;
+ }
+
+ Log::debug($exception);
+
/**
- * @deprecated
+ * Triggered when Piwik cannot access database data.
+ *
+ * This event can be used to start the installation process or to display a custom error
+ * message.
+ *
+ * @param Exception $exception The exception thrown from trying to get an option value.
*/
Piwik::postEvent('Config.badConfigurationFile', array($exception), $pending = true);
diff --git a/core/SettingsPiwik.php b/core/SettingsPiwik.php
index f620112805..608d7c55c7 100644
--- a/core/SettingsPiwik.php
+++ b/core/SettingsPiwik.php
@@ -191,7 +191,7 @@ class SettingsPiwik
*/
public static function isPiwikInstalled()
{
- $config = Config::getInstance()->getLocalConfigPath();
+ $config = Config::getInstance()->getLocalPath();
$exists = file_exists($config);
// Piwik is installed if the config file is found
diff --git a/plugins/Installation/Installation.php b/plugins/Installation/Installation.php
index 4a7d8a44cf..1c13d6b699 100644
--- a/plugins/Installation/Installation.php
+++ b/plugins/Installation/Installation.php
@@ -30,6 +30,7 @@ class Installation extends \Piwik\Plugin
{
$hooks = array(
'Config.NoConfigurationFile' => 'dispatch',
+ 'Config.badConfigurationFile' => 'dispatch',
'Db.cannotConnectToDb' => 'displayDbConnectionMessage',
'Request.dispatch' => 'dispatchIfNotInstalledYet',
'AssetManager.getStylesheetFiles' => 'getStylesheetFiles',
diff --git a/tests/PHPUnit/TestingEnvironment.php b/tests/PHPUnit/TestingEnvironment.php
index b3b6028ec6..c64832db1e 100644
--- a/tests/PHPUnit/TestingEnvironment.php
+++ b/tests/PHPUnit/TestingEnvironment.php
@@ -85,7 +85,9 @@ class Piwik_TestingEnvironment
public function logVariables()
{
try {
- if (isset($_SERVER['QUERY_STRING'])) {
+ if (isset($_SERVER['QUERY_STRING'])
+ && !$this->dontUseTestConfig
+ ) {
\Piwik\Log::verbose("Test Environment Variables for (%s):\n%s", $_SERVER['QUERY_STRING'], print_r($this->behaviorOverrideProperties, true));
}
} catch (Exception $ex) {