public function init() { SettingsServer::setMaxExecutionTime(0); $this->archivingStartingTime = time(); // Note: the order of methods call matters here. $this->initStateFromParameters(); $this->logInitInfo(); $this->logArchiveTimeoutInfo(); // record archiving start time Option::set(self::OPTION_ARCHIVING_STARTED_TS, time()); $this->segments = $this->initSegmentsToArchive(); $this->allWebsites = APISitesManager::getInstance()->getAllSitesId(); if (!empty($this->shouldArchiveOnlySpecificPeriods)) { $this->logger->info("- Will only process the following periods: " . implode(", ", $this->shouldArchiveOnlySpecificPeriods) . " (--force-periods)"); } $this->invalidateArchivedReportsForSitesThatNeedToBeArchivedAgain(); $websitesIds = $this->initWebsiteIds(); $this->filterWebsiteIds($websitesIds); $this->websites = $this->createSitesToArchiveQueue($websitesIds); if ($this->websites->getInitialSiteIds() != $websitesIds) { $this->logger->info('Will ignore websites and help finish a previous started queue instead. IDs: ' . implode(', ', $this->websites->getInitialSiteIds())); } $this->logForcedSegmentInfo(); /** * This event is triggered after a CronArchive instance is initialized. * * @param array $websiteIds The list of website IDs this CronArchive instance is processing. * This will be the entire list of IDs regardless of whether some have * already been processed. */ Piwik::postEvent('CronArchive.init.finish', array($this->websites->getInitialSiteIds())); }
public function init() { // Note: the order of methods call matters here. $this->initLog(); $this->initPiwikHost(); $this->initCore(); $this->initTokenAuth(); $this->initCheckCli(); $this->initStateFromParameters(); Piwik::setUserHasSuperUserAccess(true); $this->logInitInfo(); $this->checkPiwikUrlIsValid(); $this->logArchiveTimeoutInfo(); // record archiving start time Option::set(self::OPTION_ARCHIVING_STARTED_TS, time()); $this->segments = $this->initSegmentsToArchive(); $this->allWebsites = APISitesManager::getInstance()->getAllSitesId(); if (!empty($this->shouldArchiveOnlySpecificPeriods)) { $this->log("- Will process the following periods: " . implode(", ", $this->shouldArchiveOnlySpecificPeriods) . " (--force-periods)"); } $websitesIds = $this->initWebsiteIds(); $this->filterWebsiteIds($websitesIds); if (!empty($this->shouldArchiveSpecifiedSites) || !empty($this->shouldArchiveAllSites) || !SharedSiteIds::isSupported()) { $this->websites = new FixedSiteIds($websitesIds); } else { $this->websites = new SharedSiteIds($websitesIds); if ($this->websites->getInitialSiteIds() != $websitesIds) { $this->log('Will ignore websites and help finish a previous started queue instead. IDs: ' . implode(', ', $this->websites->getInitialSiteIds())); } } if ($this->shouldStartProfiler) { \Piwik\Profiler::setupProfilerXHProf($mainRun = true); $this->log("XHProf profiling is enabled."); } /** * This event is triggered after a CronArchive instance is initialized. * * @param array $websiteIds The list of website IDs this CronArchive instance is processing. * This will be the entire list of IDs regardless of whether some have * already been processed. */ Piwik::postEvent('CronArchive.init.finish', array($this->websites->getInitialSiteIds())); }