Skip to content

Commit

Permalink
Refs matomo-org#4990 Fix bug reported in forums when nFS is detected
Browse files Browse the repository at this point in the history
  • Loading branch information
mattab committed May 4, 2014
1 parent 55f0682 commit dc30088
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 28 deletions.
6 changes: 1 addition & 5 deletions core/FrontController.php
Original file line number Diff line number Diff line change
Expand Up @@ -270,10 +270,6 @@ public function init()

$exceptionToThrow = self::createConfigObject();

if (Session::isFileBasedSessions()) {
Session::start();
}

$this->handleMaintenanceMode();
$this->handleProfiler();
$this->handleSSLRedirection();
Expand Down Expand Up @@ -387,7 +383,7 @@ protected function prepareDispatch($module, $action, $parameters)
$action = Common::getRequestVar('action', false);
}

if (!Session::isFileBasedSessions()
if (SettingsPiwik::isPiwikInstalled()
&& ($module !== 'API' || ($action && $action !== 'index'))
) {
Session::start();
Expand Down
13 changes: 12 additions & 1 deletion core/SettingsPiwik.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,18 @@ public static function isPiwikInstalled()
$exists = file_exists($config);

// Piwik is installed if the config file is found
return $exists;
if(!$exists) {
return false;
}

$general = Config::getInstance()->General;

$isInstallationInProgress = false;
if (array_key_exists('installation_in_progress', $general)) {
$isInstallationInProgress = (bool) $general['installation_in_progress'];
}
return !$isInstallationInProgress;

}

/**
Expand Down
26 changes: 4 additions & 22 deletions plugins/Installation/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ function welcome($message = false)
__FUNCTION__
);

$view->newInstall = !$this->isFinishedInstallation();
$view->newInstall = !SettingsPiwik::isPiwikInstalled();
$view->errorMessage = $message;
$view->showNextStep = $view->newInstall;
return $view->render();
Expand Down Expand Up @@ -343,6 +343,8 @@ public function trackingCode()
{
$this->checkPiwikIsNotInstalled();

$this->markInstallationAsCompleted();

$view = new View(
'@Installation/trackingCode',
$this->getInstallationSteps(),
Expand Down Expand Up @@ -379,10 +381,6 @@ public function finished()
__FUNCTION__
);

if (!$this->isFinishedInstallation()) {
$this->markInstallationAsCompleted();
}

$view->showNextStep = false;
$output = $view->render();

Expand Down Expand Up @@ -505,7 +503,7 @@ private function createConfigFile($dbInfos)

private function checkPiwikIsNotInstalled()
{
if(!$this->isFinishedInstallation()) {
if(!SettingsPiwik::isPiwikInstalled()) {
return;
}
\Piwik\Plugins\Login\Controller::clearSession();
Expand Down Expand Up @@ -634,22 +632,6 @@ private function createSuperUser($login, $password, $email)
$api->setSuperUserAccess($login, true);
}

private function isFinishedInstallation()
{
if (!SettingsPiwik::isPiwikInstalled()) {
return false;
}

$general = Config::getInstance()->General;

$isInstallationInProgress = false;
if (array_key_exists('installation_in_progress', $general)) {
$isInstallationInProgress = (bool) $general['installation_in_progress'];
}

return !$isInstallationInProgress;
}

private function hasEnoughTablesToReuseDb($tablesInstalled)
{
if (empty($tablesInstalled) || !is_array($tablesInstalled)) {
Expand Down

0 comments on commit dc30088

Please sign in to comment.