diff options
author | matt <matt@59fd770c-687e-43c8-a1e3-f5a4ff64c105> | 2010-06-23 07:45:36 +0400 |
---|---|---|
committer | matt <matt@59fd770c-687e-43c8-a1e3-f5a4ff64c105> | 2010-06-23 07:45:36 +0400 |
commit | 7e1b5d6b762340cbff1bb928d15815980c7649a7 (patch) | |
tree | e07da179b9e1372866d2349777bd1cc6b4c9e8cf /plugins/Provider | |
parent | 999f46479294713104c962bfe7469e9b6e7a4bbf (diff) | |
parent | c98ea06f2cccec81c6ccce49162a583494e44d91 (diff) |
Diffstat (limited to 'plugins/Provider')
-rw-r--r-- | plugins/Provider/API.php | 4 | ||||
-rw-r--r-- | plugins/Provider/Provider.php | 37 | ||||
-rw-r--r-- | plugins/Provider/functions.php | 6 |
3 files changed, 32 insertions, 15 deletions
diff --git a/plugins/Provider/API.php b/plugins/Provider/API.php index 9f29baba58..272925dded 100644 --- a/plugins/Provider/API.php +++ b/plugins/Provider/API.php @@ -10,9 +10,6 @@ * @package Piwik_Provider */ -// no direct access -defined('PIWIK_INCLUDE_PATH') or die; - /** * @see plugins/Provider/functions.php */ @@ -45,6 +42,7 @@ class Piwik_Provider_API $dataTable->queueFilter('ColumnCallbackAddMetadata', array('label', 'url', 'Piwik_getHostnameUrl')); $dataTable->queueFilter('ColumnCallbackReplace', array('label', 'Piwik_getHostnameName')); $dataTable->queueFilter('ReplaceColumnNames'); + $dataTable->queueFilter('ReplaceSummaryRowLabel'); return $dataTable; } } 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> diff --git a/plugins/Provider/functions.php b/plugins/Provider/functions.php index 4397c40867..7966fe64aa 100644 --- a/plugins/Provider/functions.php +++ b/plugins/Provider/functions.php @@ -20,7 +20,7 @@ function Piwik_getHostnameName($in) { if(empty($in)) { - return Piwik_Translate('General_Unknown'); + return html_entity_decode(Piwik_Translate('General_Unknown'), ENT_COMPAT, 'UTF-8'); } if(strtolower($in) === 'ip') { @@ -41,6 +41,10 @@ function Piwik_getHostnameName($in) */ function Piwik_getHostnameUrl($in) { + if($in == Piwik_DataTable::LABEL_SUMMARY_ROW) + { + return false; + } if(empty($in) || strtolower($in) === 'ip') { |