/**
  * Inits the object
  * 
  * @return void
  */
 protected function loadArchiveProperties()
 {
     $this->idsite = $this->site->getId();
     $this->periodId = $this->period->getId();
     $this->dateStart = $this->period->getDateStart();
     $this->dateEnd = $this->period->getDateEnd();
     $this->tableArchiveNumeric = new Piwik_TablePartitioning_Monthly('archive_numeric');
     $this->tableArchiveNumeric->setIdSite($this->idsite);
     $this->tableArchiveNumeric->setTimestamp($this->dateStart->get());
     $this->tableArchiveBlob = new Piwik_TablePartitioning_Monthly('archive_blob');
     $this->tableArchiveBlob->setIdSite($this->idsite);
     $this->tableArchiveBlob->setTimestamp($this->dateStart->get());
     $this->strDateStart = $this->dateStart->toString();
     $this->strDateEnd = $this->dateEnd->toString();
     // if the current archive is a DAY and if it's today,
     // we set this maxTimestampArchive that defines the lifetime value of today's archive
     $this->maxTimestampArchive = 0;
     if ($this->period->getNumberOfSubperiods() == 0 && $this->period->toString() == date("Y-m-d")) {
         $this->maxTimestampArchive = time() - Zend_Registry::get('config')->General->time_before_today_archive_considered_outdated;
     } else {
         if ($this->period->isFinished()) {
             $this->maxTimestampArchive = $this->period->getDateEnd()->setTime('00:00:00')->addDay(1)->getTimestamp();
         } else {
             $this->maxTimestampArchive = Piwik_Date::today()->getTimestamp();
         }
     }
 }
Example #2
0
 /**
  * Inits the object
  */
 protected function loadArchiveProperties()
 {
     $this->idsite = $this->site->getId();
     $this->periodId = $this->period->getId();
     $this->dateStart = $this->period->getDateStart();
     $this->dateEnd = $this->period->getDateEnd();
     $this->tableArchiveNumeric = new Piwik_TablePartitioning_Monthly('archive_numeric');
     $this->tableArchiveNumeric->setIdSite($this->idsite);
     $this->tableArchiveNumeric->setTimestamp($this->dateStart->get());
     $this->tableArchiveBlob = new Piwik_TablePartitioning_Monthly('archive_blob');
     $this->tableArchiveBlob->setIdSite($this->idsite);
     $this->tableArchiveBlob->setTimestamp($this->dateStart->get());
     $this->strDateStart = $this->dateStart->toString();
     $this->strDateEnd = $this->dateEnd->toString();
     // if the current archive is a DAY and if it's today,
     // we set this maxTimestampArchive that defines the lifetime value of today's archive
     $this->maxTimestampArchive = 0;
     if ($this->period->getNumberOfSubperiods() == 0 && $this->period->toString() == date("Y-m-d")) {
         $this->maxTimestampArchive = time() - Zend_Registry::get('config')->General->time_before_today_archive_considered_outdated;
         $browserArchivingEnabled = Zend_Registry::get('config')->General->enable_browser_archiving_triggering;
         // see #1150; if new archives are not triggered from the browser,
         // we still want to try and return the latest archive available for today (rather than return nothing)
         if (!$browserArchivingEnabled) {
             $this->maxTimestampArchive = 0;
         }
     } else {
         if ($this->period->isFinished()) {
             $this->maxTimestampArchive = $this->period->getDateEnd()->setTime('00:00:00')->addDay(1)->getTimestamp();
         } else {
             $this->maxTimestampArchive = Piwik_Date::today()->getTimestamp();
         }
     }
     $db = Zend_Registry::get('db');
     $this->compressBlob = $db->hasBlobDataType();
 }
	/**
	 * Inits the object
	 */
	protected function loadArchiveProperties()
	{		
		$this->idsite = $this->site->getId();
		
		$this->periodId = $this->period->getId();
		
		$this->dateStart = $this->period->getDateStart();
		$this->dateEnd = $this->period->getDateEnd();
		
		$this->tableArchiveNumeric = new Piwik_TablePartitioning_Monthly('archive_numeric');
		$this->tableArchiveNumeric->setIdSite($this->idsite);
		$this->tableArchiveNumeric->setTimestamp($this->dateStart->get());
		$this->tableArchiveBlob = new Piwik_TablePartitioning_Monthly('archive_blob');
		$this->tableArchiveBlob->setIdSite($this->idsite);	
		$this->tableArchiveBlob->setTimestamp($this->dateStart->get());

		$this->strDateStart = $this->dateStart->toString();
		$this->strDateEnd = $this->dateEnd->toString();
		
		// if the current archive is a DAY and if it's today,
		// we set this maxTimestampArchive that defines the lifetime value of today's archive
		$this->maxTimestampArchive = 0;
		if( $this->period->getNumberOfSubperiods() == 0
			&& $this->period->toString() == date("Y-m-d")
			)
		{
			$this->maxTimestampArchive = time() - Zend_Registry::get('config')->General->time_before_today_archive_considered_outdated;
		}
		// either
		// - if the period we're looking for is finished, we look for a ts_archived that 
		//   is greater than the last day of the archive 
		// - if the period we're looking for is not finished, we look for a recent enough archive
		//   recent enough means maxTimestampArchive = 00:00:01 this morning
		else
		{
			if($this->period->isFinished())
			{
				$this->maxTimestampArchive = $this->period->getDateEnd()->setTime('00:00:00')->addDay(1)->getTimestamp();
			}
			else
			{
				$this->maxTimestampArchive = Piwik_Date::today()->getTimestamp();
			}
		}

		$db = Zend_Registry::get('db');
		$this->compressBlob = $db->hasBlobDataType();
	}