diff options
author | robocoder <anthon.pang@gmail.com> | 2010-11-08 08:00:36 +0300 |
---|---|---|
committer | robocoder <anthon.pang@gmail.com> | 2010-11-08 08:00:36 +0300 |
commit | e0c60a4c9fe1119d3746a71ed9780de0b57a4e54 (patch) | |
tree | a1947b96e86ad57b009a118eae589f0decfaff76 | |
parent | c2e0b0b294d0f7290f0cfea41cab8fec3f31a462 (diff) |
fixes #1460 - add Installation check for the tracker (GET piwik.php?url=http://example.com); fix the tracker proxy when using POST
git-svn-id: http://dev.piwik.org/svn/trunk@3304 59fd770c-687e-43c8-a1e3-f5a4ff64c105
-rw-r--r-- | js/index.php | 2 | ||||
-rw-r--r-- | lang/en.php | 2 | ||||
-rw-r--r-- | plugins/Installation/Controller.php | 3 | ||||
-rw-r--r-- | plugins/Installation/templates/systemCheck.tpl | 11 | ||||
-rw-r--r-- | plugins/Installation/templates/welcome.tpl | 20 |
5 files changed, 34 insertions, 4 deletions
diff --git a/js/index.php b/js/index.php index 727bbc79b4..4be88691e9 100644 --- a/js/index.php +++ b/js/index.php @@ -10,7 +10,7 @@ /** * Tracker proxy */ -if(!empty($_SERVER['QUERY_STRING'])) { +if($_SERVER['REQUEST_METHOD'] == 'POST' || !empty($_SERVER['QUERY_STRING'])) { include '../piwik.php'; exit; } diff --git a/lang/en.php b/lang/en.php index f28ee66970..1406773483 100644 --- a/lang/en.php +++ b/lang/en.php @@ -569,6 +569,8 @@ $translations = array( 'Installation_SystemCheckProtocolHelp' => 'If you are behind a reverse proxy, add these lines to config/config.ini.php under the [General] section:', 'Installation_SystemCheckIpv4' => 'IPv4', 'Installation_SystemCheckIpv4Help' => 'You should disable IPv6 in your web server configuration.', + 'Installation_SystemCheckTracker' => 'Tracker status', + 'Installation_SystemCheckTrackerHelp' => 'GET request to piwik.php failed. Try whitelisting this URL from mod_security and HTTP Authentication.', 'Installation_Tables' => 'Creating the Tables', 'Installation_TablesWithSameNamesFound' => 'Some %1$s tables in your database %2$s have the same names as the tables Piwik is trying to create', 'Installation_TablesFound' => 'The following tables have been found in the database', diff --git a/plugins/Installation/Controller.php b/plugins/Installation/Controller.php index 2853d79304..6693a25c04 100644 --- a/plugins/Installation/Controller.php +++ b/plugins/Installation/Controller.php @@ -832,6 +832,9 @@ class Piwik_Installation_Controller extends Piwik_Controller } $infos['timezone'] = Piwik::isTimezoneSupportEnabled(); + + $infos['tracker_status'] = Piwik_Common::getRequestVar('trackerStatus', 0, 'int'); + return $infos; } diff --git a/plugins/Installation/templates/systemCheck.tpl b/plugins/Installation/templates/systemCheck.tpl index b10338155b..8525a3b20a 100644 --- a/plugins/Installation/templates/systemCheck.tpl +++ b/plugins/Installation/templates/systemCheck.tpl @@ -152,6 +152,17 @@ </td> </tr> <tr> + <td class="label">{'Installation_SystemCheckTracker'|translate}</td> + <td> + {if $infos.tracker_status == 0} + {$ok} + {else} + {$warning} {$infos.tracker_status} + <br /><i>{'Installation_SystemCheckTrackerHelp'|translate}</i> + {/if} + </td> + </tr> + <tr> <td class="label">{'Installation_SystemCheckMemoryLimit'|translate}</td> <td> {if $infos.memory_ok} diff --git a/plugins/Installation/templates/welcome.tpl b/plugins/Installation/templates/welcome.tpl index da857975e0..526f04452f 100644 --- a/plugins/Installation/templates/welcome.tpl +++ b/plugins/Installation/templates/welcome.tpl @@ -14,9 +14,23 @@ <script type="text/javascript"> <!-- $(function() { -if (document.location.protocol === 'https:') { - $('p.nextStep a').attr('href', $('p.nextStep a').attr('href') + '&clientProtocol=https'); -} + // 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({ + url: 'piwik.php', + data: 'url=http://example.com', + complete: function() { + $('p.nextStep').show(); + }, + error: function(req) { + $('p.nextStep a').attr('href', $('p.nextStep a').attr('href') + '&trackerStatus=' + req.status); + } + }); }); //--> </script> |