/** * Saves given server information to config. * * @param oxApplicationServer $oServer */ public function saveServer($oServer) { $aServersData = $this->_getServersData(); $aServersData[$oServer->getId()] = array('id' => $oServer->getId(), 'timestamp' => $oServer->getTimestamp(), 'ip' => $oServer->getIp(), 'lastFrontendUsage' => $oServer->getLastFrontendUsage(), 'lastAdminUsage' => $oServer->getLastAdminUsage(), 'isValid' => $oServer->isValid()); $this->_save($aServersData); }
/** * Check is server information out dated. * * @param oxApplicationServer $oServer * * @return bool */ private function _isValid($oServer) { return $oServer->getTimestamp() - $this->_getCurrentTime() + self::NODE_VALIDITY_TIME > 0; }
/** * Updates mode information. * * @param oxApplicationServer $oNode */ private function _updateNodeInformation($oNode) { $oUtilsServer = $this->_getUtilsServer(); $sServerNodeId = $oUtilsServer->getServerNodeId(); $oUtilsDate = $this->_getUtilsDate(); $oNode->setId($sServerNodeId); $oNode->setIp($oUtilsServer->getServerIp()); $oNode->setTimestamp($oUtilsDate->getTime()); $oNode->setIsValid(); if ($this->isAdmin()) { $oNode->setLastAdminUsage($oUtilsDate->getTime()); } else { $oNode->setLastFrontendUsage($oUtilsDate->getTime()); } }