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:
authorBenaka Moorthi <benaka.moorthi@gmail.com>2013-09-26 06:34:29 +0400
committerBenaka Moorthi <benaka.moorthi@gmail.com>2013-09-26 06:34:29 +0400
commit8f2e36a0ccecbe4e93b331a57fa81fccbf5bd4f3 (patch)
tree8e892816f0988e0f122cbd2ae864cc3e370e7406 /plugins
parent68350b0f4aa93473d03d4757e2a4e64462572954 (diff)
Catch unexpected GeoIP errors when testing the PHP provider so we can tell if a GeoIP database is corrupt.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Live/API.php8
-rw-r--r--plugins/Live/stylesheets/live.less2
-rwxr-xr-xplugins/UserCountry/LocationProvider/GeoIp/Php.php26
3 files changed, 30 insertions, 6 deletions
diff --git a/plugins/Live/API.php b/plugins/Live/API.php
index c6fa365479..54fc50b8ef 100644
--- a/plugins/Live/API.php
+++ b/plugins/Live/API.php
@@ -255,8 +255,8 @@ class API
$result['totalAbandonedCartsItems'] += $action['items'];
}
- if (isset($result['siteSearchKeyword'])) {
- $keyword = $result['siteSearchKeyword'];
+ if (isset($action['siteSearchKeyword'])) {
+ $keyword = $action['siteSearchKeyword'];
if (!isset($siteSearchKeywords[$keyword])) {
$siteSearchKeyword[$keyword] = 0;
@@ -265,8 +265,8 @@ class API
++$siteSearchKeywords[$keyword];
}
- if (isset($result['generationTime'])) {
- $pageGenerationTimeTotal += $result['generationTime'];
+ if (isset($action['generationTime'])) {
+ $pageGenerationTimeTotal += $action['generationTime'];
++$result['totalPageViews'];
}
}
diff --git a/plugins/Live/stylesheets/live.less b/plugins/Live/stylesheets/live.less
index f062aa04bb..2c2791a193 100644
--- a/plugins/Live/stylesheets/live.less
+++ b/plugins/Live/stylesheets/live.less
@@ -185,7 +185,7 @@ a.visitor-log-visitor-profile-link {
position:absolute;
display:none;
right:8px;
- top:8px;
+ top:4px;
font-style:italic;
font-size:13px;
diff --git a/plugins/UserCountry/LocationProvider/GeoIp/Php.php b/plugins/UserCountry/LocationProvider/GeoIp/Php.php
index dc54f5b29c..7bd9ba0e26 100755
--- a/plugins/UserCountry/LocationProvider/GeoIp/Php.php
+++ b/plugins/UserCountry/LocationProvider/GeoIp/Php.php
@@ -187,7 +187,31 @@ class Php extends GeoIp
array('mb_internal_encoding', 'mbstring'));
}
- return parent::isWorking();
+ $geoIpError = false;
+ $catchGeoIpError = function ($errno, $errstr, $errfile, $errline) use (&$geoIpError) {
+ $filename = basename($errfile);
+ if ($filename == 'geoip.inc'
+ || $filename == 'geoipcity.inc'
+ ) {
+ $geoIpError = array($errno, $errstr, $errfile, $errline);
+ } else {
+ throw new \Exception("Error in PHP GeoIP provider: $errstr on line $errline of $errfile"); // unexpected
+ }
+ };
+
+ // catch GeoIP errors
+ set_error_handler($catchGeoIpError);
+ $result = parent::isWorking();
+ restore_error_handler();
+
+ if ($geoIpError) {
+ list($errno, $errstr, $errfile, $errline) = $geoIpError;
+ Piwik::log("Got GeoIP error when testing PHP GeoIP location provider: $errfile($errline): $errstr");
+
+ return Piwik_Translate('UserCountry_GeoIPIncorrectDatabaseFormat');
+ }
+
+ return $result;
}
/**