Skip to content

Commit

Permalink
fixed #268 Move dataTable truncation limit to the configuration file
Browse files Browse the repository at this point in the history
  • Loading branch information
matt committed Jan 14, 2009
1 parent 8d4baef commit a71e13b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
13 changes: 12 additions & 1 deletion config/global.ini.php
Expand Up @@ -64,7 +64,7 @@
[Debug]
; if set to true, the archiving process will always be triggered, even if the archive has already been computed
; this is useful when making changes to the archiving code so we can force the archiving process
always_archive_data = false
always_archive_data = true

; if set to true, all the SQL queries will be recorded by the profiler
; and a profiling summary will be printed at the end of the request
Expand Down Expand Up @@ -125,6 +125,17 @@
; login cookie expiration (30 days)
login_cookie_expire = 2592000

; during archiving, Piwik will limit the number of results recorded, for performance reasons
; maximum number of rows for any of the Referers tables (keywords, search engines, campaigns, etc.)
datatable_archiving_maximum_rows_referers = 500
; maximum number of rows for any of the Actions tables (pages, downloads, outlinks)
datatable_archiving_maximum_rows_actions = 500

; maximum number of rows for any of the Referers subtable (search engines by keyword, keyword by campaign, etc.)
datatable_archiving_maximum_rows_subtable_referers = 50
; 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

[Tracker]
; set to 0 if you want to stop tracking the visitors. Useful if you need to stop all the connections on the DB.
record_statistics = 1
Expand Down
8 changes: 4 additions & 4 deletions plugins/Actions/Actions.php
Expand Up @@ -76,8 +76,8 @@ function archivePeriod( $notification )
'Actions_outlink',
);

$maximumRowsInDataTableLevelZero = 200;
$maximumRowsInSubDataTable = 50;
$maximumRowsInDataTableLevelZero = Zend_Registry::get('config')->General->datatable_archiving_maximum_rows_actions;
$maximumRowsInSubDataTable = Zend_Registry::get('config')->General->datatable_archiving_maximum_rows_subtable_actions;
$archiveProcessing->archiveDataTable($dataTableToSum, $maximumRowsInDataTableLevelZero, $maximumRowsInSubDataTable);
}

Expand Down Expand Up @@ -189,8 +189,8 @@ public function archiveDay( $notification )

protected function archiveDayRecordInDatabase()
{
$maximumRowsInDataTableLevelZero = 1000;
$maximumRowsInSubDataTable = 200;
$maximumRowsInDataTableLevelZero = Zend_Registry::get('config')->General->datatable_archiving_maximum_rows_actions;
$maximumRowsInSubDataTable = Zend_Registry::get('config')->General->datatable_archiving_maximum_rows_subtable_actions;

$dataTable = Piwik_ArchiveProcessing_Day::generateDataTable($this->actionsTablesByType[Piwik_Tracker_Action::TYPE_ACTION]);
$s = $dataTable->getSerialized( $maximumRowsInDataTableLevelZero, $maximumRowsInSubDataTable );
Expand Down
9 changes: 5 additions & 4 deletions plugins/Referers/Referers.php
Expand Up @@ -73,8 +73,9 @@ function archivePeriod( $notification )
'Referers_urlByWebsite',
);

$maximumRowsInDataTableLevelZero = 500;
$maximumRowsInSubDataTable = 50;
$maximumRowsInDataTableLevelZero = Zend_Registry::get('config')->General->datatable_archiving_maximum_rows_referers;
$maximumRowsInSubDataTable = Zend_Registry::get('config')->General->datatable_archiving_maximum_rows_subtable_referers;

$nameToCount = $archiveProcessing->archiveDataTable($dataTableToSum, $maximumRowsInDataTableLevelZero, $maximumRowsInSubDataTable);

$mappingFromArchiveName = array(
Expand Down Expand Up @@ -300,8 +301,8 @@ protected function archiveDayRecordInDatabase($archiveProcessing)
$data = $archiveProcessing->getDataTableSerialized($this->interestByType);
$record = new Piwik_ArchiveProcessing_Record_BlobArray('Referers_type', $data);

$maximumRowsInDataTableLevelZero = 500;
$maximumRowsInSubDataTable = 50;
$maximumRowsInDataTableLevelZero = Zend_Registry::get('config')->General->datatable_archiving_maximum_rows_referers;
$maximumRowsInSubDataTable = Zend_Registry::get('config')->General->datatable_archiving_maximum_rows_subtable_referers;

$blobRecords = array(
'Referers_keywordBySearchEngine' => $archiveProcessing->getDataTableWithSubtablesFromArraysIndexedByLabel($this->interestBySearchEngineAndKeyword, $this->interestBySearchEngine),
Expand Down

0 comments on commit a71e13b

Please sign in to comment.