Skip to content
Extraits de code Groupes Projets
Valider 141bda6e rédigé par mattab's avatar mattab
Parcourir les fichiers

Reverting to previous revision

parent 27ff8f4d
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -165,25 +165,6 @@ class PrivacyManagerTest extends IntegrationTestCase ...@@ -165,25 +165,6 @@ class PrivacyManagerTest extends IntegrationTestCase
$this->_checkNoDataChanges(); $this->_checkNoDataChanges();
} }
protected function getEmptyNumericEstimates()
{
return array(
Piwik_Common::prefixTable('archive_numeric_2012_02') => -1,
Piwik_Common::prefixTable('archive_numeric_2012_03') => -1,
Piwik_Common::prefixTable('archive_numeric_2012_04') => -1,
Piwik_Common::prefixTable('archive_numeric_2012_05') => -1,
Piwik_Common::prefixTable('archive_numeric_2012_06') => -1,
Piwik_Common::prefixTable('archive_numeric_2012_07') => -1,
Piwik_Common::prefixTable('archive_numeric_2012_08') => -1,
Piwik_Common::prefixTable('archive_numeric_2012_09') => -1,
Piwik_Common::prefixTable('archive_numeric_2012_10') => -1,
Piwik_Common::prefixTable('archive_numeric_2012_11') => -1,
Piwik_Common::prefixTable('archive_numeric_2012_12') => -1,
);
}
/** /**
* Make sure purging data runs when scheduled. * Make sure purging data runs when scheduled.
* *
...@@ -202,9 +183,8 @@ class PrivacyManagerTest extends IntegrationTestCase ...@@ -202,9 +183,8 @@ class PrivacyManagerTest extends IntegrationTestCase
Piwik_Common::prefixTable('log_visit') => 3, Piwik_Common::prefixTable('log_visit') => 3,
Piwik_Common::prefixTable('log_conversion_item') => 3, Piwik_Common::prefixTable('log_conversion_item') => 3,
Piwik_Common::prefixTable('archive_numeric_2012_01') => -1, Piwik_Common::prefixTable('archive_numeric_2012_01') => -1,
Piwik_Common::prefixTable('archive_blob_2012_01') => -1, Piwik_Common::prefixTable('archive_blob_2012_01') => -1
Piwik_Common::prefixTable('archive_blob_2012_02') => -1) );
+ $this->getEmptyNumericEstimates();
$this->assertEquals($expectedPrediction, $prediction); $this->assertEquals($expectedPrediction, $prediction);
// purge data // purge data
...@@ -307,7 +287,9 @@ class PrivacyManagerTest extends IntegrationTestCase ...@@ -307,7 +287,9 @@ class PrivacyManagerTest extends IntegrationTestCase
*/ */
public function testPurgeDataDeleteReportsKeepBasicMetrics() public function testPurgeDataDeleteReportsKeepBasicMetrics()
{ {
Piwik_PrivacyManager::savePurgeDataSettings(array('delete_reports_keep_basic_metrics' => 1)); Piwik_PrivacyManager::savePurgeDataSettings(array(
'delete_reports_keep_basic_metrics' => 1
));
// get purge data prediction // get purge data prediction
$prediction = Piwik_PrivacyManager::getPurgeEstimate(); $prediction = Piwik_PrivacyManager::getPurgeEstimate();
...@@ -319,9 +301,7 @@ class PrivacyManagerTest extends IntegrationTestCase ...@@ -319,9 +301,7 @@ class PrivacyManagerTest extends IntegrationTestCase
Piwik_Common::prefixTable('log_visit') => 3, Piwik_Common::prefixTable('log_visit') => 3,
Piwik_Common::prefixTable('log_conversion_item') => 3, Piwik_Common::prefixTable('log_conversion_item') => 3,
Piwik_Common::prefixTable('archive_numeric_2012_01') => 1, // remove the garbage metric Piwik_Common::prefixTable('archive_numeric_2012_01') => 1, // remove the garbage metric
Piwik_Common::prefixTable('archive_blob_2012_01') => -1, Piwik_Common::prefixTable('archive_blob_2012_01') => -1
Piwik_Common::prefixTable('archive_blob_2012_02') => -1,
Piwik_Common::prefixTable('archive_numeric_2012_02') => 1
); );
$this->assertEquals($expectedPrediction, $prediction); $this->assertEquals($expectedPrediction, $prediction);
...@@ -379,9 +359,8 @@ class PrivacyManagerTest extends IntegrationTestCase ...@@ -379,9 +359,8 @@ class PrivacyManagerTest extends IntegrationTestCase
Piwik_Common::prefixTable('log_visit') => 3, Piwik_Common::prefixTable('log_visit') => 3,
Piwik_Common::prefixTable('log_conversion_item') => 3, Piwik_Common::prefixTable('log_conversion_item') => 3,
Piwik_Common::prefixTable('archive_numeric_2012_01') => -1, Piwik_Common::prefixTable('archive_numeric_2012_01') => -1,
Piwik_Common::prefixTable('archive_blob_2012_01') => 10 + $unexplained, // removing 4 weeks, 1 month & 1 year + 1 garbage report + 2 range reports + 1 segmented report Piwik_Common::prefixTable('archive_blob_2012_01') => 10 + $unexplained // removing 4 weeks, 1 month & 1 year + 1 garbage report + 2 range reports + 1 segmented report
Piwik_Common::prefixTable('archive_blob_2012_02') => 6, );
) + $this->getEmptyNumericEstimates();
$this->assertEquals($expectedPrediction, $prediction); $this->assertEquals($expectedPrediction, $prediction);
// purge data // purge data
...@@ -418,7 +397,7 @@ class PrivacyManagerTest extends IntegrationTestCase ...@@ -418,7 +397,7 @@ class PrivacyManagerTest extends IntegrationTestCase
Piwik_Common::prefixTable('log_conversion_item') => 3, Piwik_Common::prefixTable('log_conversion_item') => 3,
Piwik_Common::prefixTable('archive_numeric_2012_01') => -1, Piwik_Common::prefixTable('archive_numeric_2012_01') => -1,
Piwik_Common::prefixTable('archive_blob_2012_01') => 11 + $unexplained // 5 days, 1 month & 1 year to remove + 1 garbage report + 2 range reports + 1 segmented report Piwik_Common::prefixTable('archive_blob_2012_01') => 11 + $unexplained // 5 days, 1 month & 1 year to remove + 1 garbage report + 2 range reports + 1 segmented report
) + $this->getEmptyNumericEstimates(); );
$this->assertEquals($expectedPrediction, $prediction); $this->assertEquals($expectedPrediction, $prediction);
// purge data // purge data
...@@ -455,7 +434,7 @@ class PrivacyManagerTest extends IntegrationTestCase ...@@ -455,7 +434,7 @@ class PrivacyManagerTest extends IntegrationTestCase
Piwik_Common::prefixTable('log_conversion_item') => 3, Piwik_Common::prefixTable('log_conversion_item') => 3,
Piwik_Common::prefixTable('archive_numeric_2012_01') => -1, Piwik_Common::prefixTable('archive_numeric_2012_01') => -1,
Piwik_Common::prefixTable('archive_blob_2012_01') => 14 + $unexplained // 5 days, 4 weeks, 1 year to remove + 1 garbage report + 2 range reports + 1 segmented report Piwik_Common::prefixTable('archive_blob_2012_01') => 14 + $unexplained // 5 days, 4 weeks, 1 year to remove + 1 garbage report + 2 range reports + 1 segmented report
) + $this->getEmptyNumericEstimates(); );
$this->assertEquals($expectedPrediction, $prediction); $this->assertEquals($expectedPrediction, $prediction);
// purge data // purge data
...@@ -492,7 +471,7 @@ class PrivacyManagerTest extends IntegrationTestCase ...@@ -492,7 +471,7 @@ class PrivacyManagerTest extends IntegrationTestCase
Piwik_Common::prefixTable('log_conversion_item') => 3, Piwik_Common::prefixTable('log_conversion_item') => 3,
Piwik_Common::prefixTable('archive_numeric_2012_01') => -1, Piwik_Common::prefixTable('archive_numeric_2012_01') => -1,
Piwik_Common::prefixTable('archive_blob_2012_01') => 14 + $unexplained // 5 days, 4 weeks & 1 year to remove + 1 garbage report + 2 range reports + 1 segmented report Piwik_Common::prefixTable('archive_blob_2012_01') => 14 + $unexplained // 5 days, 4 weeks & 1 year to remove + 1 garbage report + 2 range reports + 1 segmented report
) + $this->getEmptyNumericEstimates(); );
$this->assertEquals($expectedPrediction, $prediction); $this->assertEquals($expectedPrediction, $prediction);
// purge data // purge data
...@@ -561,7 +540,7 @@ class PrivacyManagerTest extends IntegrationTestCase ...@@ -561,7 +540,7 @@ class PrivacyManagerTest extends IntegrationTestCase
Piwik_Common::prefixTable('log_conversion_item') => 3, Piwik_Common::prefixTable('log_conversion_item') => 3,
Piwik_Common::prefixTable('archive_numeric_2012_01') => -1, Piwik_Common::prefixTable('archive_numeric_2012_01') => -1,
Piwik_Common::prefixTable('archive_blob_2012_01') => 13 + $unexplained // 5 days, 4 weeks, 1 month & 1 year + 1 garbage report + 1 segmented report Piwik_Common::prefixTable('archive_blob_2012_01') => 13 + $unexplained // 5 days, 4 weeks, 1 month & 1 year + 1 garbage report + 1 segmented report
) + $this->getEmptyNumericEstimates(); );
$this->assertEquals($expectedPrediction, $prediction); $this->assertEquals($expectedPrediction, $prediction);
// purge data // purge data
...@@ -598,9 +577,8 @@ class PrivacyManagerTest extends IntegrationTestCase ...@@ -598,9 +577,8 @@ class PrivacyManagerTest extends IntegrationTestCase
Piwik_Common::prefixTable('log_visit') => 3, Piwik_Common::prefixTable('log_visit') => 3,
Piwik_Common::prefixTable('log_conversion_item') => 3, Piwik_Common::prefixTable('log_conversion_item') => 3,
Piwik_Common::prefixTable('archive_numeric_2012_01') => -1, Piwik_Common::prefixTable('archive_numeric_2012_01') => -1,
Piwik_Common::prefixTable('archive_blob_2012_01') => 9 + $unexplained, // 4 weeks, 1 month & 1 year + 1 garbage report + 2 range reports, Piwik_Common::prefixTable('archive_blob_2012_01') => 9 + $unexplained // 4 weeks, 1 month & 1 year + 1 garbage report + 2 range reports
Piwik_Common::prefixTable('archive_blob_2012_02') => 6, );
) + $this->getEmptyNumericEstimates();
$this->assertEquals($expectedPrediction, $prediction); $this->assertEquals($expectedPrediction, $prediction);
// purge data // purge data
...@@ -676,6 +654,8 @@ class PrivacyManagerTest extends IntegrationTestCase ...@@ -676,6 +654,8 @@ class PrivacyManagerTest extends IntegrationTestCase
{ {
$date = Piwik_Date::factory(self::$dateTime); $date = Piwik_Date::factory(self::$dateTime);
$archive = Piwik_Archive::build(self::$idSite, 'year', $date);
Piwik_VisitorInterest_API::getInstance()->getNumberOfVisitsPerVisitDuration(self::$idSite, 'year', $date); Piwik_VisitorInterest_API::getInstance()->getNumberOfVisitsPerVisitDuration(self::$idSite, 'year', $date);
// Piwik_Goals_API::getInstance()->get(self::$idSite, 'month', $date, $segment = false, self::$idSite); // Piwik_Goals_API::getInstance()->get(self::$idSite, 'month', $date, $segment = false, self::$idSite);
...@@ -859,11 +839,7 @@ class PrivacyManagerTest extends IntegrationTestCase ...@@ -859,11 +839,7 @@ class PrivacyManagerTest extends IntegrationTestCase
protected function _getTableCount($tableName, $where = '') protected function _getTableCount($tableName, $where = '')
{ {
$sql = "SELECT COUNT(*) FROM " . Piwik_Common::prefixTable($tableName) . " $where"; $sql = "SELECT COUNT(*) FROM " . Piwik_Common::prefixTable($tableName) . " $where";
// try { return Piwik_FetchOne($sql);
return Piwik_FetchOne($sql);
// } catch(Zend_Db_Statement_Exception $e) {
// return 0;
// }
} }
protected function _tableExists($tableName) protected function _tableExists($tableName)
......
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