예제 #1
0
파일: Rules.php 프로젝트: diosmosis/piwik
 public static function getMinTimeProcessedForTemporaryArchive(Date $dateStart, \Piwik\Period $period, Segment $segment, Site $site)
 {
     $now = time();
     $minimumArchiveTime = $now - Rules::getTodayArchiveTimeToLive();
     $idSites = array($site->getId());
     $isArchivingDisabled = Rules::isArchivingDisabledFor($idSites, $segment, $period->getLabel());
     if ($isArchivingDisabled) {
         if ($period->getNumberOfSubperiods() == 0 && $dateStart->getTimestamp() <= $now) {
             // Today: accept any recent enough archive
             $minimumArchiveTime = false;
         } else {
             // This week, this month, this year:
             // accept any archive that was processed today after 00:00:01 this morning
             $timezone = $site->getTimezone();
             $minimumArchiveTime = Date::factory(Date::factory('now', $timezone)->getDateStartUTC())->setTimezone($timezone)->getTimestamp();
         }
     }
     return $minimumArchiveTime;
 }