OXID eShop CE  4.10.7
 All Classes Namespaces Files Functions Variables Pages
oxserverchecker.php
Go to the documentation of this file.
1 <?php
2 
12 {
13 
17  const NODE_VALIDITY_TIME = 86400;
18 
24  private $_iCurrentTime = 0;
25 
29  public function __construct()
30  {
31  $this->_iCurrentTime = oxRegistry::get("oxUtilsDate")->getTime();
32  }
33 
41  public function check(oxApplicationServer $oServer)
42  {
43  $blResult = false;
44 
45  if ($this->_isValid($oServer) && $this->_isServerTimeValid($oServer->getTimestamp())) {
46  $blResult = true;
47  }
48 
49  return $blResult;
50  }
51 
59  private function _isValid($oServer)
60  {
61  return ($oServer->getTimestamp() - $this->_getCurrentTime() + self::NODE_VALIDITY_TIME) > 0;
62  }
63 
71  private function _isServerTimeValid($iServerTimeInPast)
72  {
73  return ($this->_getCurrentTime() - $iServerTimeInPast) >= 0;
74  }
75 
81  private function _getCurrentTime()
82  {
83  return $this->_iCurrentTime;
84  }
85 }