From 03ec8cd950d099feb62d865d08b696d8f94439b1 Mon Sep 17 00:00:00 2001 From: Stefan Giehl <stefan@piwik.org> Date: Mon, 17 Jul 2017 22:40:45 +0200 Subject: [PATCH] make it possible to disable installer in config (#11850) --- config/global.ini.php | 3 +++ plugins/Installation/Installation.php | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/config/global.ini.php b/config/global.ini.php index b617395e34..bb63d92bf1 100644 --- a/config/global.ini.php +++ b/config/global.ini.php @@ -544,6 +544,9 @@ enable_plugins_admin = 1 ; an attacker who gained Super User access could execute custom PHP code in a Piwik plugin. enable_plugin_upload = 0 +; By setting this option to 0 (e.g. in common.config.ini.php) the installer will be disabled. +enable_installer = 1 + ; By setting this option to 0, you can prevent Super User from editing the Geolocation settings. enable_geolocation_admin = 1 diff --git a/plugins/Installation/Installation.php b/plugins/Installation/Installation.php index 023723c3b3..758d0dc0f6 100644 --- a/plugins/Installation/Installation.php +++ b/plugins/Installation/Installation.php @@ -14,6 +14,7 @@ use Piwik\Config; use Piwik\FrontController; use Piwik\Piwik; use Piwik\Plugins\Installation\Exception\DatabaseConnectionFailedException; +use Piwik\SettingsPiwik; use Piwik\View as PiwikView; /** @@ -62,6 +63,10 @@ class Installation extends \Piwik\Plugin { $general = Config::getInstance()->General; + if (!SettingsPiwik::isPiwikInstalled() && !$general['enable_installer']) { + throw new \Exception('Piwik is not set up yet'); + } + if (empty($general['installation_in_progress'])) { return; } -- GitLab