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:
authorThomas Steur <thomas.steur@googlemail.com>2014-02-07 10:43:27 +0400
committerThomas Steur <thomas.steur@googlemail.com>2014-02-07 10:43:27 +0400
commitd0e5faa1301164e88bb89e4681e604a2e6e659b7 (patch)
tree8c0f9758236d4945aab0be81c4297f57d87eed34 /plugins/Installation/Installation.php
parentd3a423d10a483a6f41835a4c863df7fd294c2d5c (diff)
refs #4631 started to work on installing updates during installation in case we reuse existing tables. Problem: In case there are updates available and one of those updates writes a config the installer thinks we are already done. Therefore we do now create the config file as early as possible and before the install the updates. We create the config file once we have the database information. Also allows us to remove the db_infos session hack. While installation is in progress we set a flag in General currently named install_in_progress (tbd)
Diffstat (limited to 'plugins/Installation/Installation.php')
-rw-r--r--plugins/Installation/Installation.php43
1 files changed, 36 insertions, 7 deletions
diff --git a/plugins/Installation/Installation.php b/plugins/Installation/Installation.php
index 1487e5c67b..539d2c59fc 100644
--- a/plugins/Installation/Installation.php
+++ b/plugins/Installation/Installation.php
@@ -9,6 +9,7 @@
namespace Piwik\Plugins\Installation;
use Piwik\Common;
+use Piwik\Config;
use Piwik\FrontController;
use Piwik\Menu\MenuAdmin;
use Piwik\Piwik;
@@ -29,12 +30,34 @@ class Installation extends \Piwik\Plugin
$hooks = array(
'Config.NoConfigurationFile' => 'dispatch',
'Config.badConfigurationFile' => 'dispatch',
+ 'Request.dispatch' => 'dispatchIfNotInstalledYet',
'Menu.Admin.addItems' => 'addMenu',
'AssetManager.getStylesheetFiles' => 'getStylesheetFiles',
);
return $hooks;
}
+ public function dispatchIfNotInstalledYet(&$module, &$action, &$parameters)
+ {
+ $general = Config::getInstance()->General;
+
+ if (empty($general['install_in_progress'])) {
+ return;
+ }
+
+ if ($module == 'Installation') {
+ return;
+ }
+
+ $module = 'Installation';
+
+ if (!$this->isAllowedAction($action)) {
+ $action = 'welcome';
+ }
+
+ $parameters = array();
+ }
+
public function setControllerToLoad($newControllerName)
{
$this->installationControllerName = $newControllerName;
@@ -58,13 +81,10 @@ class Installation extends \Piwik\Plugin
Translate::loadCoreTranslation();
- $step = Common::getRequestVar('action', 'welcome', 'string');
- $controller = $this->getInstallationController();
- $isActionWhiteListed = in_array($step, array('saveLanguage', 'getBaseCss'));
- if (in_array($step, array_keys($controller->getInstallationSteps()))
- || $isActionWhiteListed
- ) {
- echo FrontController::getInstance()->dispatch('Installation', $step, array($message));
+ $action = Common::getRequestVar('action', 'welcome', 'string');
+
+ if ($this->isAllowedAction($action)) {
+ echo FrontController::getInstance()->dispatch('Installation', $action, array($message));
} else {
Piwik::exitWithErrorMessage(Piwik::translate('Installation_NoConfigFound'));
}
@@ -90,4 +110,13 @@ class Installation extends \Piwik\Plugin
{
$stylesheets[] = "plugins/Installation/stylesheets/systemCheckPage.less";
}
+
+ private function isAllowedAction($action)
+ {
+ $controller = $this->getInstallationController();
+ $isActionWhiteListed = in_array($action, array('saveLanguage', 'getBaseCss', 'reuseTables'));
+
+ return in_array($action, array_keys($controller->getInstallationSteps()))
+ || $isActionWhiteListed;
+ }
}