db = $connection; } public function forceRendering($force = true) { $this->forceRendering = $force; return $this; } public function getConfig() { if ($this->shouldGenerate()) { return IcingaConfig::generate($this->db); } return $this->loadLatestActivityConfig(); } protected function loadLatestActivityConfig() { $db = $this->db; return IcingaConfig::loadByActivityChecksum($db->getLastActivityChecksum(), $db); } protected function shouldGenerate() { return $this->forceRendering || !$this->configForLatestActivityExists(); } protected function configForLatestActivityExists() { $db = $this->db; try { $latestActivity = DirectorActivityLog::loadLatest($db); } catch (NotFoundError $e) { return false; } return IcingaConfig::existsForActivityChecksum( bin2hex($latestActivity->get('checksum')), $db ); } }