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:
Diffstat (limited to 'plugins/Provider/Provider.php')
-rw-r--r--plugins/Provider/Provider.php37
1 files changed, 26 insertions, 11 deletions
diff --git a/plugins/Provider/Provider.php b/plugins/Provider/Provider.php
index a547846fc8..aec31c9f51 100644
--- a/plugins/Provider/Provider.php
+++ b/plugins/Provider/Provider.php
@@ -19,11 +19,10 @@ class Piwik_Provider extends Piwik_Plugin
public function getInformation()
{
$info = array(
- 'name' => 'Provider',
- 'description' => 'Reports the Provider of the visitors.',
+ 'description' => Piwik_Translate('Provider_PluginDescription'),
'author' => 'Piwik',
- 'homepage' => 'http://piwik.org/',
- 'version' => '0.1',
+ 'author_homepage' => 'http://piwik.org/',
+ 'version' => Piwik_Version::VERSION,
'TrackerPlugin' => true, // this plugin must be loaded during the stats logging
);
@@ -45,19 +44,25 @@ class Piwik_Provider extends Piwik_Plugin
function install()
{
// add column hostname / hostname ext in the visit table
- $query = "ALTER IGNORE TABLE `".Piwik::prefixTable('log_visit')."` ADD `location_provider` VARCHAR( 100 ) NULL";
+ $query = "ALTER IGNORE TABLE `".Piwik_Common::prefixTable('log_visit')."` ADD `location_provider` VARCHAR( 100 ) NULL";
// if the column already exist do not throw error. Could be installed twice...
try {
Piwik_Exec($query);
}
- catch(Exception $e){}
+ catch(Exception $e) {
+ if(!Zend_Registry::get('db')->isErrNo($e, '1060'))
+ {
+ throw $e;
+ }
+ }
+
}
function uninstall()
{
// add column hostname / hostname ext in the visit table
- $query = "ALTER TABLE `".Piwik::prefixTable('log_visit')."` DROP `location_provider`";
+ $query = "ALTER TABLE `".Piwik_Common::prefixTable('log_visit')."` DROP `location_provider`";
Piwik_Exec($query);
}
@@ -80,9 +85,10 @@ class Piwik_Provider extends Piwik_Plugin
function archivePeriod( $notification )
{
+ $maximumRowsInDataTable = Zend_Registry::get('config')->General->datatable_archiving_maximum_rows_standard;
$archiveProcessing = $notification->getNotificationObject();
$dataTableToSum = array( 'Provider_hostnameExt' );
- $archiveProcessing->archiveDataTable($dataTableToSum);
+ $archiveProcessing->archiveDataTable($dataTableToSum, null, $maximumRowsInDataTable);
}
/**
@@ -96,7 +102,9 @@ class Piwik_Provider extends Piwik_Plugin
$labelSQL = "location_provider";
$interestByProvider = $archiveProcessing->getArrayInterestForLabel($labelSQL);
$tableProvider = $archiveProcessing->getDataTableFromArray($interestByProvider);
- $archiveProcessing->insertBlobRecord($recordName, $tableProvider->getSerialized());
+ $columnToSortByBeforeTruncation = Piwik_Archive::INDEX_NB_VISITS;
+ $maximumRowsInDataTable = Zend_Registry::get('config')->General->datatable_archiving_maximum_rows_standard;
+ $archiveProcessing->insertBlobRecord($recordName, $tableProvider->getSerialized($maximumRowsInDataTable, null, $columnToSortByBeforeTruncation));
destroy($tableProvider);
}
@@ -145,6 +153,13 @@ class Piwik_Provider extends Piwik_Plugin
}
else
{
+ $cleanHostname = null;
+ Piwik_PostEvent('Provider.getCleanHostname', $cleanHostname, $hostname);
+ if($cleanHostname !== null)
+ {
+ return $cleanHostname;
+ }
+
$e = explode('.', $hostname);
$s = sizeof($e);
@@ -173,13 +188,13 @@ class Piwik_Provider extends Piwik_Plugin
return trim(strtolower(@gethostbyaddr(long2ip($ip))));
}
- public function headerUserCountry($notification)
+ static public function headerUserCountry($notification)
{
$out =& $notification->getNotificationObject();
$out = '<div id="leftcolumn">';
}
- public function footerUserCountry($notification)
+ static public function footerUserCountry($notification)
{
$out =& $notification->getNotificationObject();
$out = '</div>