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:
authordiosmosis <benaka@piwik.pro>2015-03-20 03:08:33 +0300
committerdiosmosis <benaka@piwik.pro>2015-03-20 03:08:33 +0300
commit8c9214c0ef73e268834d7e016029621ae2a9f1b7 (patch)
tree157e6d678371c1e8bcfd3ca95ae4658c241de13a /plugins/Installation/Controller.php
parentaead5ce7f2ab61c786799a411cdc69120fe4550e (diff)
Fix two regressions where language would not change in installer, and where language would reset to english in the middle of the install process.
Diffstat (limited to 'plugins/Installation/Controller.php')
-rw-r--r--plugins/Installation/Controller.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/plugins/Installation/Controller.php b/plugins/Installation/Controller.php
index 9976f4ad58..cdce51d111 100644
--- a/plugins/Installation/Controller.php
+++ b/plugins/Installation/Controller.php
@@ -13,6 +13,7 @@ use Piwik\Access;
use Piwik\AssetManager;
use Piwik\Common;
use Piwik\Config;
+use Piwik\Container\StaticContainer;
use Piwik\DataAccess\ArchiveTableCreator;
use Piwik\Db;
use Piwik\Db\Adapter;
@@ -31,6 +32,7 @@ use Piwik\Plugins\UsersManager\API as APIUsersManager;
use Piwik\ProxyHeaders;
use Piwik\SettingsPiwik;
use Piwik\Tracker\TrackerCodeGenerator;
+use Piwik\Translation\Translator;
use Piwik\Updater;
use Piwik\Url;
use Piwik\Version;
@@ -547,6 +549,17 @@ class Controller extends \Piwik\Plugin\ControllerAdmin
}
$config->forceSave();
+
+ // re-save the currently viewed language (since we saved the config file, there is now a salt which makes the
+ // existing session cookie invalid)
+ $this->resetLanguageCookie();
+ }
+
+ private function resetLanguageCookie()
+ {
+ /** @var Translator $translator */
+ $translator = StaticContainer::get('Piwik\Translation\Translator');
+ LanguagesManager::setLanguageForSession($translator->getCurrentLanguage());
}
private function checkPiwikIsNotInstalled()
@@ -675,6 +688,10 @@ class Controller extends \Piwik\Plugin\ControllerAdmin
$config = Config::getInstance();
if ($config->existsLocalConfig()) {
$config->deleteLocalConfig();
+
+ // deleting the config file removes the salt, which in turns invalidates existing cookies (including the
+ // one for selected language), so we re-save that cookie now
+ $this->resetLanguageCookie();
}
}