Example #1
0
 /**
  * Deleting "Custom Date Range" reports after 1 day, since they can be re-processed and would take up un-necessary space.
  *
  * @param $date Date
  * @return int The total number of rows deleted from both the numeric & blob table.
  */
 public function purgeArchivesWithPeriodRange(Date $date)
 {
     $numericTable = ArchiveTableCreator::getNumericTable($date);
     $blobTable = ArchiveTableCreator::getBlobTable($date);
     $deletedCount = $this->model->deleteArchivesWithPeriod($numericTable, $blobTable, Piwik::$idPeriods['range'], $this->purgeCustomRangesOlderThan);
     $level = $deletedCount == 0 ? LogLevel::DEBUG : LogLevel::INFO;
     $this->logger->log($level, "Purged {count} range archive rows from {numericTable} & {blobTable}.", array('count' => $deletedCount, 'numericTable' => $numericTable, 'blobTable' => $blobTable));
     $this->logger->debug("  [ purged archives older than {threshold} ]", array('threshold' => $this->purgeCustomRangesOlderThan));
     return $deletedCount;
 }