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

There is now a new error in PrivacyManagerTest, making some progress...

parent 8575c02a
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -279,13 +279,18 @@ abstract class Piwik_ArchiveProcessor ...@@ -279,13 +279,18 @@ abstract class Piwik_ArchiveProcessor
} }
$this->logStatusDebug($requestedPlugin); $this->logStatusDebug($requestedPlugin);
if ($this->getNumberOfVisits() > 0 $isVisitsToday = $this->getNumberOfVisits() > 0;
&& !$enforceProcessCoreMetricsOnly if ($isVisitsToday
) { && !$enforceProcessCoreMetricsOnly) {
$this->compute(); $this->compute();
} }
$archiveWriter->finalizeArchive(); $archiveWriter->finalizeArchive();
if ($isVisitsToday && $this->period->getLabel() != 'day') {
Piwik_DataAccess_ArchiveSelector::purgeOutdatedArchives($this->getPeriod()->getDateStart());
}
return $archiveWriter->getIdArchive(); return $archiveWriter->getIdArchive();
} }
......
...@@ -233,7 +233,8 @@ class Piwik_DataAccess_ArchiveSelector ...@@ -233,7 +233,8 @@ class Piwik_DataAccess_ArchiveSelector
$table = Piwik_DataAccess_ArchiveTableCreator::getBlobTable($date); $table = Piwik_DataAccess_ArchiveTableCreator::getBlobTable($date);
} }
$sql = sprintf($getValuesSql, $table, implode(',', $ids)); $sql = sprintf($getValuesSql, $table, implode(',', $ids));
foreach (Piwik_FetchAll($sql, $bind) as $row) { $dataRows = Piwik_FetchAll($sql, $bind);
foreach ($dataRows as $row) {
$rows[] = $row; $rows[] = $row;
} }
} }
...@@ -271,50 +272,51 @@ class Piwik_DataAccess_ArchiveSelector ...@@ -271,50 +272,51 @@ class Piwik_DataAccess_ArchiveSelector
return; return;
} }
$numericTable = Piwik_DataAccess_ArchiveTableCreator::getNumericTable($dateStart); $idArchivesToDelete = self::getTemporaryArchiveIdsOlderThan($dateStart, $purgeArchivesOlderThan);
$blobTable = Piwik_DataAccess_ArchiveTableCreator::getBlobTable($dateStart);
$idArchivesToDelete = self::getTemporaryArchiveIdsOlderThan($numericTable, $purgeArchivesOlderThan);
if (!empty($idArchivesToDelete)) { if (!empty($idArchivesToDelete)) {
self::deleteArchiveIds($numericTable, $blobTable, $idArchivesToDelete); self::deleteArchiveIds($dateStart, $idArchivesToDelete);
} }
Piwik::log("Purging temporary archives: done [ purged archives older than $purgeArchivesOlderThan from $blobTable and $numericTable ] [Deleted IDs: " . implode(',', $idArchivesToDelete) . "]"); self::deleteArchivesWithPeriodRange($dateStart);
self::deleteArchivesWithPeriodRange($numericTable, $blobTable);
Piwik::log("Purging temporary archives: done [ purged archives older than $purgeArchivesOlderThan in "
. $dateStart->toString("Y-m") ." ] [Deleted IDs: " . implode (',', $idArchivesToDelete) . "]");
} }
/* /*
* Deleting "Custom Date Range" reports after 1 day, since they can be re-processed and would take up un-necessary space * Deleting "Custom Date Range" reports after 1 day, since they can be re-processed and would take up un-necessary space
*/ */
protected static function deleteArchivesWithPeriodRange($numericTable, $blobTable) protected static function deleteArchivesWithPeriodRange(Piwik_Date $date)
{ {
$query = "DELETE FROM %s WHERE period = ? AND ts_archived < ?"; $query = "DELETE FROM %s WHERE period = ? AND ts_archived < ?";
$yesterday = Piwik_Date::factory('yesterday')->getDateTime(); $yesterday = Piwik_Date::factory('yesterday')->getDateTime();
Piwik::log("Purging Custom Range archives: done [ purged archives older than $yesterday from $blobTable and $numericTable ]");
$bind = array(Piwik::$idPeriods['range'], $yesterday); $bind = array(Piwik::$idPeriods['range'], $yesterday);
$numericTable = Piwik_DataAccess_ArchiveTableCreator::getNumericTable($date);
Piwik_Query(sprintf($query, $numericTable), $bind); Piwik_Query(sprintf($query, $numericTable), $bind);
Piwik::log("Purging Custom Range archives: done [ purged archives older than $yesterday from $numericTable / blob ]");
try { try {
Piwik_Query(sprintf($query, $blobTable), $bind); Piwik_Query(sprintf($query, Piwik_DataAccess_ArchiveTableCreator::getBlobTable($date, $createIfNotFound = false)), $bind);
} catch (Exception $e) { } catch (Exception $e) {
// Individual blob tables could be missing // Individual blob tables could be missing
} }
} }
protected static function deleteArchiveIds($numericTable, $blobTable, $idArchivesToDelete) protected static function deleteArchiveIds(Piwik_Date $date, $idArchivesToDelete)
{ {
$query = "DELETE FROM %s WHERE idarchive IN (" . implode(',', $idArchivesToDelete) . ")"; $query = "DELETE FROM %s WHERE idarchive IN (" . implode(',', $idArchivesToDelete) . ")";
Piwik_Query(sprintf($query, $numericTable)); Piwik_Query(sprintf($query, Piwik_DataAccess_ArchiveTableCreator::getNumericTable($date)));
try { try {
Piwik_Query(sprintf($query, $blobTable)); Piwik_Query(sprintf($query, Piwik_DataAccess_ArchiveTableCreator::getBlobTable($date, $createIfNotFound = false)));
} catch (Exception $e) { } catch (Exception $e) {
// Individual blob tables could be missing // Individual blob tables could be missing
} }
} }
protected static function getTemporaryArchiveIdsOlderThan($numericTable, $purgeArchivesOlderThan) protected static function getTemporaryArchiveIdsOlderThan(Piwik_Date $date, $purgeArchivesOlderThan)
{ {
$query = "SELECT idarchive $query = "SELECT idarchive
FROM $numericTable FROM ". Piwik_DataAccess_ArchiveTableCreator::getNumericTable($date) ."
WHERE name LIKE 'done%' WHERE name LIKE 'done%'
AND (( value = " . Piwik_ArchiveProcessor::DONE_OK_TEMPORARY . " AND (( value = " . Piwik_ArchiveProcessor::DONE_OK_TEMPORARY . "
AND ts_archived < ?) AND ts_archived < ?)
......
...@@ -19,20 +19,23 @@ class Piwik_DataAccess_ArchiveTableCreator ...@@ -19,20 +19,23 @@ class Piwik_DataAccess_ArchiveTableCreator
static public function getNumericTable(Piwik_Date $date) static public function getNumericTable(Piwik_Date $date)
{ {
return self::getTable($date, self::NUMERIC_TABLE); return self::getTable($date, self::NUMERIC_TABLE, $createIfNotFound = true);
} }
static public function getBlobTable(Piwik_Date $date) static public function getBlobTable(Piwik_Date $date, $createIfNotFound = true)
{ {
return self::getTable($date, self::BLOB_TABLE); return self::getTable($date, self::BLOB_TABLE, $createIfNotFound);
} }
static protected function getTable(Piwik_Date $date, $type) static protected function getTable(Piwik_Date $date, $type, $createIfNotFound)
{ {
$tableNamePrefix = "archive_" . $type; $tableNamePrefix = "archive_" . $type;
$tableName = $tableNamePrefix . "_" . $date->toString('Y_m'); $tableName = $tableNamePrefix . "_" . $date->toString('Y_m');
$tableName = Piwik_Common::prefixTable($tableName); $tableName = Piwik_Common::prefixTable($tableName);
self::createArchiveTablesIfAbsent($tableName, $tableNamePrefix); if($createIfNotFound) {
self::createArchiveTablesIfAbsent($tableName, $tableNamePrefix);
}
return $tableName;
return $tableName; return $tableName;
} }
......
...@@ -37,8 +37,6 @@ class Piwik_DataAccess_ArchiveWriter ...@@ -37,8 +37,6 @@ class Piwik_DataAccess_ArchiveWriter
$this->isArchiveTemporary = $isArchiveTemporary; $this->isArchiveTemporary = $isArchiveTemporary;
$this->dateStart = $this->period->getDateStart(); $this->dateStart = $this->period->getDateStart();
$this->numericTable = Piwik_DataAccess_ArchiveTableCreator::getNumericTable($this->dateStart);
$this->blobTable = Piwik_DataAccess_ArchiveTableCreator::getBlobTable($this->dateStart);
} }
public function getIdArchive() public function getIdArchive()
...@@ -73,18 +71,18 @@ class Piwik_DataAccess_ArchiveWriter ...@@ -73,18 +71,18 @@ class Piwik_DataAccess_ArchiveWriter
protected function insertNewArchiveId() protected function insertNewArchiveId()
{ {
$table = $this->numericTable; $numericTable = $this->getTableNumeric();
$idSite = $this->idSite; $idSite = $this->idSite;
$db = Zend_Registry::get('db'); $db = Zend_Registry::get('db');
$locked = self::PREFIX_SQL_LOCK . Piwik_Common::generateUniqId(); $locked = self::PREFIX_SQL_LOCK . Piwik_Common::generateUniqId();
$date = date("Y-m-d H:i:s"); $date = date("Y-m-d H:i:s");
$dbLockName = "allocateNewArchiveId.$table"; $dbLockName = "allocateNewArchiveId.$numericTable";
if (Piwik_GetDbLock($dbLockName, $maxRetries = 30) === false) { if (Piwik_GetDbLock($dbLockName, $maxRetries = 30) === false) {
throw new Exception("allocateNewArchiveId: Cannot get named lock for table $table."); throw new Exception("allocateNewArchiveId: Cannot get named lock for table $numericTable.");
} }
$insertSql = "INSERT INTO $table " $insertSql = "INSERT INTO $numericTable "
. " SELECT ifnull(max(idarchive),0)+1, . " SELECT ifnull(max(idarchive),0)+1,
'" . $locked . "', '" . $locked . "',
" . (int)$idSite . ", " . (int)$idSite . ",
...@@ -93,10 +91,10 @@ class Piwik_DataAccess_ArchiveWriter ...@@ -93,10 +91,10 @@ class Piwik_DataAccess_ArchiveWriter
0, 0,
'" . $date . "', '" . $date . "',
0 " 0 "
. " FROM $table as tb1"; . " FROM $numericTable as tb1";
$db->exec($insertSql); $db->exec($insertSql);
Piwik_ReleaseDbLock($dbLockName); Piwik_ReleaseDbLock($dbLockName);
$selectIdSql = "SELECT idarchive FROM $table WHERE name = ? LIMIT 1"; $selectIdSql = "SELECT idarchive FROM $numericTable WHERE name = ? LIMIT 1";
$id = $db->fetchOne($selectIdSql, $locked); $id = $db->fetchOne($selectIdSql, $locked);
return $id; return $id;
} }
...@@ -132,15 +130,12 @@ class Piwik_DataAccess_ArchiveWriter ...@@ -132,15 +130,12 @@ class Piwik_DataAccess_ArchiveWriter
$this->deletePreviousArchiveStatus(); $this->deletePreviousArchiveStatus();
$this->logArchiveStatusAsFinal(); $this->logArchiveStatusAsFinal();
$this->releaseArchiveProcessorLock(); $this->releaseArchiveProcessorLock();
if ($this->period->getLabel() != 'day') {
Piwik_DataAccess_ArchiveSelector::purgeOutdatedArchives($this->dateStart);
}
} }
protected function deletePreviousArchiveStatus() protected function deletePreviousArchiveStatus()
{ {
Piwik_Query("DELETE FROM " . $this->numericTable . "
Piwik_Query("DELETE FROM " . $this->getTableNumeric() . "
WHERE idarchive = ? AND (name = '" . $this->doneFlag . "' OR name LIKE '" . self::PREFIX_SQL_LOCK . "%')", WHERE idarchive = ? AND (name = '" . $this->doneFlag . "' OR name LIKE '" . self::PREFIX_SQL_LOCK . "%')",
array($this->getIdArchive()) array($this->getIdArchive())
); );
...@@ -190,7 +185,6 @@ class Piwik_DataAccess_ArchiveWriter ...@@ -190,7 +185,6 @@ class Piwik_DataAccess_ArchiveWriter
if (empty($values)) return true; if (empty($values)) return true;
$tableName = $this->getTableNameToInsert($valueSeen); $tableName = $this->getTableNameToInsert($valueSeen);
Piwik::tableInsertBatch($tableName, $this->getInsertFields(), $values); Piwik::tableInsertBatch($tableName, $this->getInsertFields(), $values);
return true; return true;
} }
...@@ -210,7 +204,6 @@ class Piwik_DataAccess_ArchiveWriter ...@@ -210,7 +204,6 @@ class Piwik_DataAccess_ArchiveWriter
$tableName = $this->getTableNameToInsert($value); $tableName = $this->getTableNameToInsert($value);
// duplicate idarchives are Ignored, see http://dev.piwik.org/trac/ticket/987 // duplicate idarchives are Ignored, see http://dev.piwik.org/trac/ticket/987
$query = "INSERT IGNORE INTO " . $tableName . " $query = "INSERT IGNORE INTO " . $tableName . "
(" . implode(", ", $this->getInsertFields()) . ") (" . implode(", ", $this->getInsertFields()) . ")
VALUES (?,?,?,?,?,?,?,?)"; VALUES (?,?,?,?,?,?,?,?)";
...@@ -234,9 +227,14 @@ class Piwik_DataAccess_ArchiveWriter ...@@ -234,9 +227,14 @@ class Piwik_DataAccess_ArchiveWriter
protected function getTableNameToInsert($value) protected function getTableNameToInsert($value)
{ {
if (is_numeric($value)) { if (is_numeric($value)) {
return $this->numericTable; return $this->getTableNumeric();
} }
return $this->blobTable; return Piwik_DataAccess_ArchiveTableCreator::getBlobTable($this->dateStart);;
}
protected function getTableNumeric()
{
return Piwik_DataAccess_ArchiveTableCreator::getNumericTable($this->dateStart);
} }
protected function getInsertFields() protected function getInsertFields()
......
...@@ -165,6 +165,25 @@ class PrivacyManagerTest extends IntegrationTestCase ...@@ -165,6 +165,25 @@ 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.
* *
...@@ -183,8 +202,9 @@ class PrivacyManagerTest extends IntegrationTestCase ...@@ -183,8 +202,9 @@ 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
...@@ -287,9 +307,7 @@ class PrivacyManagerTest extends IntegrationTestCase ...@@ -287,9 +307,7 @@ class PrivacyManagerTest extends IntegrationTestCase
*/ */
public function testPurgeDataDeleteReportsKeepBasicMetrics() public function testPurgeDataDeleteReportsKeepBasicMetrics()
{ {
Piwik_PrivacyManager::savePurgeDataSettings(array( Piwik_PrivacyManager::savePurgeDataSettings(array('delete_reports_keep_basic_metrics' => 1));
'delete_reports_keep_basic_metrics' => 1
));
// get purge data prediction // get purge data prediction
$prediction = Piwik_PrivacyManager::getPurgeEstimate(); $prediction = Piwik_PrivacyManager::getPurgeEstimate();
...@@ -301,7 +319,9 @@ class PrivacyManagerTest extends IntegrationTestCase ...@@ -301,7 +319,9 @@ 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);
...@@ -359,8 +379,9 @@ class PrivacyManagerTest extends IntegrationTestCase ...@@ -359,8 +379,9 @@ 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
...@@ -397,7 +418,7 @@ class PrivacyManagerTest extends IntegrationTestCase ...@@ -397,7 +418,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
...@@ -434,7 +455,7 @@ class PrivacyManagerTest extends IntegrationTestCase ...@@ -434,7 +455,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
...@@ -471,7 +492,7 @@ class PrivacyManagerTest extends IntegrationTestCase ...@@ -471,7 +492,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
...@@ -540,7 +561,7 @@ class PrivacyManagerTest extends IntegrationTestCase ...@@ -540,7 +561,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
...@@ -577,8 +598,9 @@ class PrivacyManagerTest extends IntegrationTestCase ...@@ -577,8 +598,9 @@ 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
...@@ -654,8 +676,6 @@ class PrivacyManagerTest extends IntegrationTestCase ...@@ -654,8 +676,6 @@ 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);
...@@ -839,7 +859,11 @@ class PrivacyManagerTest extends IntegrationTestCase ...@@ -839,7 +859,11 @@ 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";
return Piwik_FetchOne($sql); // try {
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