diff options
-rw-r--r-- | core/ProxyHeaders.php | 4 | ||||
-rw-r--r-- | lang/en.json | 2 | ||||
-rw-r--r-- | plugins/Installation/Controller.php | 14 | ||||
-rw-r--r-- | plugins/Installation/SystemCheck.php | 5 | ||||
-rwxr-xr-x | plugins/Installation/templates/_systemCheckSection.twig | 12 | ||||
-rw-r--r-- | plugins/Installation/templates/systemCheck.twig | 10 | ||||
-rw-r--r-- | plugins/Installation/templates/welcome.twig | 5 | ||||
m--------- | tests/PHPUnit/UI | 0 |
8 files changed, 23 insertions, 29 deletions
diff --git a/core/ProxyHeaders.php b/core/ProxyHeaders.php index 4a6fa3fd75..802d1c311e 100644 --- a/core/ProxyHeaders.php +++ b/core/ProxyHeaders.php @@ -22,10 +22,6 @@ class ProxyHeaders */ public static function getProtocolInformation() { - if (Common::getRequestVar('clientProtocol', 'http', 'string') == 'https') { - return 'https'; - } - if (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == 443) { return 'SERVER_PORT=443'; } diff --git a/lang/en.json b/lang/en.json index 42d5423731..1f0af23947 100644 --- a/lang/en.json +++ b/lang/en.json @@ -1135,8 +1135,6 @@ "SystemCheckPdoAndMysqliHelp": "On a Linux server you can compile php with the following options: %1$s In your php.ini, add the following lines: %2$s", "SystemCheckPhp": "PHP version", "SystemCheckPhpPdoAndMysqli": "More information on: %1$sPHP PDO%2$s and %3$sMYSQLI%4$s.", - "SystemCheckSecureProtocol": "Secure protocol", - "SystemCheckSecureProtocolHelp": "It appears you're using https with your web server. These lines will be added to config\/config.ini.php:", "SystemCheckSplHelp": "You need to configure and rebuild PHP with the Standard PHP Library (SPL) enabled (by default).", "SystemCheckSummaryNoProblems": "Huzzah! There are no problems with your Piwik setup. Give yourself a pat on the back.", "SystemCheckSummaryThereWereErrors": "Uh-oh! Piwik has detected some %1$scritical issues%2$s with your Piwik setup. %3$sThese issues should be fixed immediately.%4$s", diff --git a/plugins/Installation/Controller.php b/plugins/Installation/Controller.php index 972d851747..8b0f8594b2 100644 --- a/plugins/Installation/Controller.php +++ b/plugins/Installation/Controller.php @@ -476,6 +476,18 @@ class Controller extends \Piwik\Plugin\ControllerAdmin if (count($headers = ProxyHeaders::getProxyHostHeaders()) > 0) { $config->General['proxy_host_headers'] = $headers; } + + if (Common::getRequestVar('clientProtocol', 'http', 'string') == 'https') { + $protocol = 'https'; + } else { + $protocol = ProxyHeaders::getProtocolInformation(); + } + + if (!empty($protocol) + && !\Piwik\ProxyHttp::isHttps()) { + $config->General['assume_secure_protocol'] = '1'; + } + $config->General['salt'] = Common::generateUniqId(); $config->General['installation_in_progress'] = 1; @@ -483,8 +495,8 @@ class Controller extends \Piwik\Plugin\ControllerAdmin if (!DbHelper::isDatabaseConnectionUTF8()) { $config->database['charset'] = 'utf8'; } - $config->forceSave(); + $config->forceSave(); } private function checkPiwikIsNotInstalled() diff --git a/plugins/Installation/SystemCheck.php b/plugins/Installation/SystemCheck.php index e650c8004e..16d55810ba 100644 --- a/plugins/Installation/SystemCheck.php +++ b/plugins/Installation/SystemCheck.php @@ -177,11 +177,6 @@ class SystemCheck $infos['tracker_status'] = Common::getRequestVar('trackerStatus', 0, 'int'); - $infos['protocol'] = ProxyHeaders::getProtocolInformation(); - if (!\Piwik\ProxyHttp::isHttps() && $infos['protocol'] !== null) { - $infos['assume_secure_protocol'] = '1'; - } - // check if filesystem is NFS, if it is file based sessions won't work properly $infos['is_nfs'] = Filesystem::checkIfFileSystemIsNFS(); $infos = self::enrichSystemChecks($infos); diff --git a/plugins/Installation/templates/_systemCheckSection.twig b/plugins/Installation/templates/_systemCheckSection.twig index c7e1d23e96..7b4c6177b6 100755 --- a/plugins/Installation/templates/_systemCheckSection.twig +++ b/plugins/Installation/templates/_systemCheckSection.twig @@ -288,18 +288,6 @@ </td> </tr> {% endif %} - {% if infos.assume_secure_protocol is defined %} - <tr> - <td class="label">{{ 'Installation_SystemCheckSecureProtocol'|translate }}</td> - <td> - {{ warning }} <span class="warn">{{ infos.protocol }} </span><br/> - {{ 'Installation_SystemCheckSecureProtocolHelp'|translate }} - <br/><br/> - <code>[General]<br/> - assume_secure_protocol = 1</code><br/> - </td> - </tr> - {% endif %} {% if infos.extra.load_data_infile_available is defined %} <tr> <td class="label">{{ 'Installation_DatabaseAbilities'|translate }}</td> diff --git a/plugins/Installation/templates/systemCheck.twig b/plugins/Installation/templates/systemCheck.twig index 0cc06ae41d..d0b6514029 100644 --- a/plugins/Installation/templates/systemCheck.twig +++ b/plugins/Installation/templates/systemCheck.twig @@ -1,6 +1,16 @@ {% extends '@Installation/layout.twig' %} {% block content %} + +<script type="text/javascript"> + $(function () { + // client-side test for https to handle the case where the server is behind a reverse proxy + if (document.location.protocol === 'https:') { + $('p.nextStep a').attr('href', $('p.nextStep a').attr('href') + '&clientProtocol=https'); + } + }); +</script> + {% if not showNextStep %} {% include "@Installation/_systemCheckLegend.twig" %} <br style="clear:both;"> diff --git a/plugins/Installation/templates/welcome.twig b/plugins/Installation/templates/welcome.twig index 5df83aad30..89df7ac8aa 100644 --- a/plugins/Installation/templates/welcome.twig +++ b/plugins/Installation/templates/welcome.twig @@ -16,11 +16,6 @@ <script type="text/javascript"> <!-- $(function () { - // client-side test for https to handle the case where the server is behind a reverse proxy - if (document.location.protocol === 'https:') { - $('p.nextStep a').attr('href', $('p.nextStep a').attr('href') + '&clientProtocol=https'); - } - // client-side test for broken tracker (e.g., mod_security rule) $('p.nextStep').hide(); $.ajax({ diff --git a/tests/PHPUnit/UI b/tests/PHPUnit/UI -Subproject 66597ff1e4b6ce6e9ebf556b6db608bbf744ee0 +Subproject a1277c5eff046943b1f785ba2435d77bbc74cf0 |