Exemple #1
0
 public function purgeOutdatedArchives()
 {
     $archiveTables = ArchiveTableCreator::getTablesArchivesInstalled();
     foreach ($archiveTables as $table) {
         $date = ArchiveTableCreator::getDateFromTableName($table);
         list($year, $month) = explode('_', $date);
         // Somehow we may have archive tables created with older dates, prevent exception from being thrown
         if ($year > 1990) {
             ArchiveSelector::purgeOutdatedArchives(Date::factory("{$year}-{$month}-15"));
         }
     }
 }
Exemple #2
0
 protected function prepareAllPluginsArchive($visits, $visitsConverted)
 {
     $pluginsArchiver = new PluginsArchiver($this->params, $this->isArchiveTemporary());
     if ($this->mustProcessVisitCount($visits) || $this->doesRequestedPluginIncludeVisitsSummary()) {
         $metrics = $pluginsArchiver->callAggregateCoreMetrics();
         $visits = $metrics['nb_visits'];
         $visitsConverted = $metrics['nb_visits_converted'];
     }
     if ($this->isThereSomeVisits($visits)) {
         $pluginsArchiver->callAggregateAllPlugins($visits, $visitsConverted);
     }
     $idArchive = $pluginsArchiver->finalizeArchive();
     if (!$this->params->isSingleSiteDayArchive() && $visits) {
         ArchiveSelector::purgeOutdatedArchives($this->params->getPeriod()->getDateStart());
     }
     return array($idArchive, $visits);
 }