/** * 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(); } } }
/** * 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(); }
/** * Sets object attributes that will be used throughout the process */ public function init() { $this->idsite = $this->site->getId(); $this->periodId = $this->period->getId(); $dateStartLocalTimezone = $this->period->getDateStart(); $dateEndLocalTimezone = $this->period->getDateEnd(); $this->tableArchiveNumeric = self::makeNumericArchiveTable($this->period); $this->tableArchiveBlob = self::makeBlobArchiveTable($this->period); $dateStartUTC = $dateStartLocalTimezone->setTimezone($this->site->getTimezone()); $dateEndUTC = $dateEndLocalTimezone->setTimezone($this->site->getTimezone()); $this->startDatetimeUTC = $dateStartUTC->getDateStartUTC(); $this->endDatetimeUTC = $dateEndUTC->getDateEndUTC(); $this->startTimestampUTC = $dateStartUTC->getTimestamp(); $this->endTimestampUTC = strtotime($this->endDatetimeUTC); $this->minDatetimeArchiveProcessedUTC = $this->getMinTimeArchivedProcessed(); $db = Zend_Registry::get('db'); $this->compressBlob = $db->hasBlobDataType(); }
/** * Generate advisory lock name * * @param int $idsite * @param Piwik_Period $period * @return string */ public static function getArchiveProcessingLockName($idsite, $period, Piwik_Segment $segment) { $config = Zend_Registry::get('config'); $lockName = 'piwik.' . $config->database->dbname . '.' . $config->database->tables_prefix . '/' . $idsite . '/' . (!$segment->isEmpty() ? $segment->getHash() . '/' : '') . $period->getId() . '/' . $period->getDateStart()->toString('Y-m-d') . ',' . $period->getDateEnd()->toString('Y-m-d'); return $lockName . '/' . md5($lockName . $config->superuser->salt); }
/** * 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(); }
/** * Sets object attributes that will be used throughout the process */ public function init() { $this->idsite = $this->site->getId(); $this->periodId = $this->period->getId(); $dateStartLocalTimezone = $this->period->getDateStart(); $dateEndLocalTimezone = $this->period->getDateEnd(); $this->tableArchiveNumeric = new Piwik_TablePartitioning_Monthly('archive_numeric'); $this->tableArchiveNumeric->setIdSite($this->idsite); $this->tableArchiveNumeric->setTimestamp($dateStartLocalTimezone->getTimestamp()); $this->tableArchiveBlob = new Piwik_TablePartitioning_Monthly('archive_blob'); $this->tableArchiveBlob->setIdSite($this->idsite); $this->tableArchiveBlob->setTimestamp($dateStartLocalTimezone->getTimestamp()); $dateStartUTC = $dateStartLocalTimezone->setTimezone($this->site->getTimezone()); $dateEndUTC = $dateEndLocalTimezone->setTimezone($this->site->getTimezone()); $this->startDatetimeUTC = $dateStartUTC->getDateStartUTC(); $this->endDatetimeUTC = $dateEndUTC->getDateEndUTC(); $this->startTimestampUTC = $dateStartUTC->getTimestamp(); $this->endTimestampUTC = strtotime($this->endDatetimeUTC); $this->minDatetimeArchiveProcessedUTC = $this->getMinTimeArchivedProcessed(); $db = Zend_Registry::get('db'); $this->compressBlob = $db->hasBlobDataType(); }
/** * Sets object attributes that will be used throughout the process */ public function init() { $this->idsite = $this->site->getId(); $this->periodId = $this->period->getId(); $this->initDates(); $this->tableArchiveNumeric = self::makeNumericArchiveTable($this->period); $this->tableArchiveBlob = self::makeBlobArchiveTable($this->period); $this->minDatetimeArchiveProcessedUTC = $this->getMinTimeArchivedProcessed(); $db = Zend_Registry::get('db'); $this->compressBlob = $db->hasBlobDataType(); }
/** * Generate advisory lock name * * @param int $idsite * @param Piwik_Period $period * @param Piwik_Segment $segment * @return string */ protected function getProcessingLockName($idsite, $period, $segment) { $config = Config::getInstance(); $lockName = 'piwik.' . $config->database['dbname'] . '.' . $config->database['tables_prefix'] . '/' . $idsite . '/' . (!$segment->isEmpty() ? $segment->getHash() . '/' : '') . $period->getId() . '/' . $period->getDateStart()->toString('Y-m-d') . ',' . $period->getDateEnd()->toString('Y-m-d'); $return = $lockName . '/' . md5($lockName . SettingsPiwik::getSalt()); return $return; }
/** * Generate advisory lock name * * @param int $idsite * @param Piwik_Period $period * @return string */ public static function getArchiveProcessingLockName($idsite, $period, Piwik_Segment $segment) { $config = Piwik_Config::getInstance(); $lockName = 'piwik.' . $config->database['dbname'] . '.' . $config->database['tables_prefix'] . '/' . $idsite . '/' . (!$segment->isEmpty() ? $segment->getHash() . '/' : '') . $period->getId() . '/' . $period->getDateStart()->toString('Y-m-d') . ',' . $period->getDateEnd()->toString('Y-m-d'); return $lockName . '/' . md5($lockName . $config->superuser['salt']); }