Skip to content
Extraits de code Groupes Projets
Valider 4b4277b3 rédigé par diosmosis's avatar diosmosis
Parcourir les fichiers

Fixes #3482, apply quick fix so Piwik works when ranking query is disabled and...

Fixes #3482, apply quick fix so Piwik works when ranking query is disabled and added test for disabled ranking query. Added FIXME comment to make sure underlying issue is eventually dealt with.
parent e6b6d8a6
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -106,6 +106,33 @@ class Piwik_Actions_Archiving ...@@ -106,6 +106,33 @@ class Piwik_Actions_Archiving
public function archiveDay(Piwik_ArchiveProcessing $archiveProcessing) public function archiveDay(Piwik_ArchiveProcessing $archiveProcessing)
{ {
$rankingQueryLimit = self::getRankingQueryLimit(); $rankingQueryLimit = self::getRankingQueryLimit();
// FIXME: This is a quick fix for #3482. The actual cause of the bug is that
// the site search & performance metrics additions to
// Piwik_Actions_ArchivingHelper::updateActionsTableWithRowQuery expect every
// row to have 'type' data, but not all of the SQL queries that are run w/o
// ranking query join on the log_action table and thus do not select the
// log_action.type column.
//
// NOTES: Archiving logic can be generalized as follows:
// 0) Do SQL query over log_link_visit_action & join on log_action to select
// some metrics (like visits, hits, etc.)
// 1) For each row, cache the action row & metrics. (This is done by
// updateActionsTableWithRowQuery for result set rows that have
// name & type columns.)
// 2) Do other SQL queries for metrics we can't put in the first query (like
// entry visits, exit vists, etc.) w/o joining log_action.
// 3) For each row, find the cached row by idaction & add the new metrics to
// it. (This is done by updateActionsTableWithRowQuery for result set rows
// that DO NOT have name & type columns.)
//
// The site search & performance metrics additions expect a 'type' all the time
// which breaks the original pre-rankingquery logic. Ranking query requires a
// join, so the bug is only seen when ranking query is disabled.
if ($rankingQueryLimit === 0) {
$rankingQueryLimit = 100000;
}
Piwik_Actions_ArchivingHelper::reloadConfig(); Piwik_Actions_ArchivingHelper::reloadConfig();
$this->initActionsTables(); $this->initActionsTables();
......
...@@ -22,6 +22,8 @@ class Piwik_Actions_ArchivingHelper ...@@ -22,6 +22,8 @@ class Piwik_Actions_ArchivingHelper
const OTHERS_ROW_KEY = ''; const OTHERS_ROW_KEY = '';
/** /**
* FIXME See FIXME related to this function at Piwik_Actions_Archiving::archiveDay.
*
* @param Zend_Db_Statement|PDOStatement $query * @param Zend_Db_Statement|PDOStatement $query
* @param string|bool $fieldQueried * @param string|bool $fieldQueried
* @param array $actionsTablesByType * @param array $actionsTablesByType
......
...@@ -48,6 +48,15 @@ class Test_Piwik_Integration_BlobReportLimitingTest extends IntegrationTestCase ...@@ -48,6 +48,15 @@ class Test_Piwik_Integration_BlobReportLimitingTest extends IntegrationTestCase
'periods' => 'day')), 'periods' => 'day')),
); );
} }
public function getRankingQueryDisabledApiForTesting()
{
return array(
array('Actions.getPageUrls', array('idSite' => self::$fixture->idSite,
'date' => self::$fixture->dateTime,
'periods' => array('day'))),
);
}
/** /**
* @dataProvider getApiForTesting * @dataProvider getApiForTesting
...@@ -82,6 +91,29 @@ class Test_Piwik_Integration_BlobReportLimitingTest extends IntegrationTestCase ...@@ -82,6 +91,29 @@ class Test_Piwik_Integration_BlobReportLimitingTest extends IntegrationTestCase
$this->runApiTests($apiToCall, $params); $this->runApiTests($apiToCall, $params);
} }
} }
/**
* @group Integration
* @group BlobReportLimiting
*/
public function testApiWithRankingQueryDisabled()
{
self::deleteArchiveTables();
$generalConfig =& Piwik_Config::getInstance()->General;
$generalConfig['datatable_archiving_maximum_rows_referers'] = 500;
$generalConfig['datatable_archiving_maximum_rows_subtable_referers'] = 500;
$generalConfig['datatable_archiving_maximum_rows_actions'] = 500;
$generalConfig['datatable_archiving_maximum_rows_subtable_actions'] = 500;
$generalConfig['datatable_archiving_maximum_rows_standard'] = 500;
$generalConfig['archiving_ranking_query_row_limit'] = 0;
foreach ($this->getRankingQueryDisabledApiForTesting() as $pair) {
list($apiToCall, $params) = $pair;
$params['testSuffix'] = '_rankingQueryDisabled';
$this->runApiTests($apiToCall, $params);
}
}
public function getOutputPrefix() public function getOutputPrefix()
{ {
......
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