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:
authorbenakamoorthi <benaka.moorthi@gmail.com>2012-10-08 01:15:40 +0400
committerbenakamoorthi <benaka.moorthi@gmail.com>2012-10-08 01:15:40 +0400
commitb2e1f41db099865d7dbea4606f824c1ac99b26a1 (patch)
treeea622a9c64f6f5c2512a54415f6d981a0c763f26 /core/Common.php
parent6a10ea4aaf72e6b23ad1728bf2ba77bbd4e18dd1 (diff)
Refs #1823, modified UserCountry plugin to allow use of GeoIP databases if desired. Added two reports, getVisitsByRegion + getVisitsByCity.
Notes: * Supports country, region, city, org & isp GeoIP databases. * Supports GeoIP PHP API, PECL module & server modules. * Added ability to regenerate 'general' tracker cache. * Removed location_continent column from log_visit & log_conversion tables, and removed visits by continent blob record. Report is now a view over country report. git-svn-id: http://dev.piwik.org/svn/trunk@7122 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'core/Common.php')
-rw-r--r--core/Common.php26
1 files changed, 24 insertions, 2 deletions
diff --git a/core/Common.php b/core/Common.php
index 61e83ec07a..871375247b 100644
--- a/core/Common.php
+++ b/core/Common.php
@@ -219,7 +219,7 @@ class Piwik_Common
{
$cache = self::getTrackerCache();
$cacheId = 'general';
- $expectedRows = 2;
+ $expectedRows = 3;
if(($cacheContent = $cache->get($cacheId)) !== false
&& count($cacheContent) == $expectedRows)
{
@@ -228,7 +228,8 @@ class Piwik_Common
self::initCorePiwikInTrackerMode();
$cacheContent = array (
'isBrowserTriggerArchivingEnabled' => Piwik_ArchiveProcessing::isBrowserTriggerArchivingEnabled(),
- 'lastTrackerCronRun' => Piwik_GetOption('lastTrackerCronRun')
+ 'lastTrackerCronRun' => Piwik_GetOption('lastTrackerCronRun'),
+ 'currentLocationProviderId' => Piwik_UserCountry_LocationProvider::getCurrentProviderId(),
);
return $cacheContent;
}
@@ -246,6 +247,15 @@ class Piwik_Common
$cache->set($cacheId, $value);
return true;
}
+
+ /**
+ * Delete and regenerate the 'general' tracker cache.
+ */
+ static public function regenerateCacheGeneral()
+ {
+ self::clearCacheGeneral();
+ self::getCacheGeneral();
+ }
/**
* Regenerate Tracker cache files
@@ -1905,6 +1915,18 @@ class Piwik_Common
header($header, $replace);
}
}
+
+ /**
+ * Returns the ID of the current LocationProvider (see UserCountry plugin code) from
+ * the Tracker cache.
+ */
+ public static function getCurrentLocationProviderId()
+ {
+ $cache = self::getCacheGeneral();
+ return empty($cache['currentLocationProviderId'])
+ ? Piwik_UserCountry_LocationProvider_Default::ID
+ : $cache['currentLocationProviderId'];
+ }
}
/**