Skip to content
Extraits de code Groupes Projets
Valider 34aa3a56 rédigé par mattpiwik's avatar mattpiwik
Parcourir les fichiers

Fixes #1011 Provider plugin now limits row count to 500

git-svn-id: http://dev.piwik.org/svn/trunk@1917 59fd770c-687e-43c8-a1e3-f5a4ff64c105
parent 32fa93f3
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -140,6 +140,9 @@ datatable_archiving_maximum_rows_actions = 500 ...@@ -140,6 +140,9 @@ datatable_archiving_maximum_rows_actions = 500
; maximum number of rows for pages in categories (sub pages, when clicking on the + for a page category) ; maximum number of rows for pages in categories (sub pages, when clicking on the + for a page category)
datatable_archiving_maximum_rows_subtable_actions = 100 datatable_archiving_maximum_rows_subtable_actions = 100
; maximum number of rows for the provider table
datatable_archiving_maximum_rows_providers = 500
; by default, Piwik uses self-hosted AJAX libraries. ; by default, Piwik uses self-hosted AJAX libraries.
; If set to 1, Piwik uses a Content Distribution Network ; If set to 1, Piwik uses a Content Distribution Network
use_ajax_cdn = 0 use_ajax_cdn = 0
......
...@@ -156,6 +156,11 @@ class Piwik_ArchiveProcessing_Period extends Piwik_ArchiveProcessing ...@@ -156,6 +156,11 @@ class Piwik_ArchiveProcessing_Period extends Piwik_ArchiveProcessing
* final DataTable (ie. the number of distinct LABEL over the period) (eg. the number of distinct keywords over the last month) * final DataTable (ie. the number of distinct LABEL over the period) (eg. the number of distinct keywords over the last month)
* *
* @param string|array Field name(s) of DataTable to select so we can get the sum * @param string|array Field name(s) of DataTable to select so we can get the sum
* @param array (current_column_name => new_column_name) for columns that must change names when summed (eg. unique visitors go from nb_uniq_visitors to sum_daily_nb_uniq_visitors)
* @param int Max row count of parent datatable to archive
* @param int Max row count of children datatable(s) to archive
* @param string Column name to sort by, before truncating rows (ie. if there are more rows than the specified max row count)
*
* @return array array ( * @return array array (
* nameTable1 => number of rows, * nameTable1 => number of rows,
* nameTable2 => number of rows, * nameTable2 => number of rows,
......
...@@ -45,6 +45,7 @@ class Piwik_Provider_API ...@@ -45,6 +45,7 @@ class Piwik_Provider_API
$dataTable->queueFilter('ColumnCallbackAddMetadata', array('label', 'url', 'Piwik_getHostnameUrl')); $dataTable->queueFilter('ColumnCallbackAddMetadata', array('label', 'url', 'Piwik_getHostnameUrl'));
$dataTable->queueFilter('ColumnCallbackReplace', array('label', 'Piwik_getHostnameName')); $dataTable->queueFilter('ColumnCallbackReplace', array('label', 'Piwik_getHostnameName'));
$dataTable->queueFilter('ReplaceColumnNames'); $dataTable->queueFilter('ReplaceColumnNames');
$dataTable->queueFilter('ReplaceSummaryRowLabel');
return $dataTable; return $dataTable;
} }
} }
......
...@@ -84,11 +84,17 @@ class Piwik_Provider extends Piwik_Plugin ...@@ -84,11 +84,17 @@ class Piwik_Provider extends Piwik_Plugin
Piwik_AddAction('template_footerUserCountry', array('Piwik_Provider','footerUserCountry')); Piwik_AddAction('template_footerUserCountry', array('Piwik_Provider','footerUserCountry'));
} }
function __construct()
{
$this->columnToSortByBeforeTruncation = Piwik_Archive::INDEX_NB_VISITS;
$this->maximumRowsInDataTableLevelZero = Zend_Registry::get('config')->General->datatable_archiving_maximum_rows_providers;
}
function archivePeriod( $notification ) function archivePeriod( $notification )
{ {
$archiveProcessing = $notification->getNotificationObject(); $archiveProcessing = $notification->getNotificationObject();
$dataTableToSum = array( 'Provider_hostnameExt' ); $dataTableToSum = array( 'Provider_hostnameExt' );
$archiveProcessing->archiveDataTable($dataTableToSum); $archiveProcessing->archiveDataTable($dataTableToSum, null, $this->maximumRowsInDataTableLevelZero);
} }
/** /**
...@@ -102,7 +108,7 @@ class Piwik_Provider extends Piwik_Plugin ...@@ -102,7 +108,7 @@ class Piwik_Provider extends Piwik_Plugin
$labelSQL = "location_provider"; $labelSQL = "location_provider";
$interestByProvider = $archiveProcessing->getArrayInterestForLabel($labelSQL); $interestByProvider = $archiveProcessing->getArrayInterestForLabel($labelSQL);
$tableProvider = $archiveProcessing->getDataTableFromArray($interestByProvider); $tableProvider = $archiveProcessing->getDataTableFromArray($interestByProvider);
$archiveProcessing->insertBlobRecord($recordName, $tableProvider->getSerialized()); $archiveProcessing->insertBlobRecord($recordName, $tableProvider->getSerialized($this->maximumRowsInDataTableLevelZero, null, $this->columnToSortByBeforeTruncation));
destroy($tableProvider); destroy($tableProvider);
} }
......
...@@ -41,6 +41,10 @@ function Piwik_getHostnameName($in) ...@@ -41,6 +41,10 @@ function Piwik_getHostnameName($in)
*/ */
function Piwik_getHostnameUrl($in) function Piwik_getHostnameUrl($in)
{ {
if($in == Piwik_DataTable::LABEL_SUMMARY_ROW)
{
return false;
}
if(empty($in) if(empty($in)
|| strtolower($in) === 'ip') || strtolower($in) === 'ip')
{ {
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter