Example #1
0
 /**
  * Deletes by batches Archive IDs in the specified month,
  *
  * @param Date $date
  * @param $idArchivesToDelete
  * @return int Number of rows deleted from both numeric + blob table.
  */
 protected function deleteArchiveIds(Date $date, $idArchivesToDelete)
 {
     $batches = array_chunk($idArchivesToDelete, 1000);
     $numericTable = ArchiveTableCreator::getNumericTable($date);
     $blobTable = ArchiveTableCreator::getBlobTable($date);
     $deletedCount = 0;
     foreach ($batches as $idsToDelete) {
         $deletedCount += $this->model->deleteArchiveIds($numericTable, $blobTable, $idsToDelete);
     }
     return $deletedCount;
 }
Example #2
0
 /**
  * @param int[] $idSites
  * @param string[][][] $dates
  * @throws \Exception
  */
 private function markArchivesInvalidated($idSites, $dates, Segment $segment = null)
 {
     $archiveNumericTables = ArchiveTableCreator::getTablesArchivesInstalled($type = ArchiveTableCreator::NUMERIC_TABLE);
     foreach ($archiveNumericTables as $table) {
         $tableDate = ArchiveTableCreator::getDateFromTableName($table);
         if (empty($dates[$tableDate])) {
             continue;
         }
         $this->model->updateArchiveAsInvalidated($table, $idSites, $dates[$tableDate], $segment);
     }
 }
Example #3
0
 private function assertCreatedArchiveId($expectedId, $siteId = 1)
 {
     $id = $this->model->insertNewArchiveId($this->tableName, $siteId, '2014-01-01 00:01:02');
     $this->assertEquals($expectedId, $id);
 }
Example #4
0
 private function assertAllocatedArchiveId($expectedId)
 {
     $id = $this->model->allocateNewArchiveId($this->tableName);
     $this->assertEquals($expectedId, $id);
 }